Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | 1x 1x 1x 1x 1x 1x | import * as vscode from 'vscode';
import { container } from 'tsyringe';
import { ServiceToken } from '@src/services/tokens';
import { IDocumentConnectionService } from '@src/languages/sparql/services';
import { getConfig } from '@src/utilities/vscode/config';
/**
* Creates a new untitled SPARQL query document from the default template and
* binds the given connection as its query source, so executing the query runs
* against that endpoint. Invoked from the connections list on the SPARQL
* results welcome view.
*/
export const createQueryForConnection = {
id: 'mentor.command.createQueryForConnection',
handler: async (connectionId: string) => {
const content = getConfig().get<string>('language.sparql.defaultDocumentTemplate', '');
const document = await vscode.workspace.openTextDocument({ content, language: 'sparql' });
await vscode.window.showTextDocument(document);
const connectionService = container.resolve<IDocumentConnectionService>(ServiceToken.DocumentConnectionService);
await connectionService.setQuerySourceForDocument(document.uri, connectionId);
}
};
|