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 8x 8x 2x 6x 6x 6x | import * as vscode from 'vscode';
import { SparqlQueryExecutionState } from '@src/languages/sparql/services/sparql-query-state';
import { BindingsFormat, formatQueryResult, getLanguageIdForFormat } from '@src/languages/sparql/services/bindings-formatter';
import { getResultsIriFormat } from '@src/languages/sparql/services/query-results-format';
export const saveSparqlQueryResults = {
id: 'mentor.command.saveSparqlQueryResults',
handler: async (context: SparqlQueryExecutionState | undefined, format: BindingsFormat = 'csv'): Promise<void> => {
const result = context?.result;
if (result?.type !== 'bindings' && result?.type !== 'boolean') {
return;
}
const content = formatQueryResult(result, { format, iriForm: getResultsIriFormat() });
const document = await vscode.workspace.openTextDocument({
content,
language: getLanguageIdForFormat(format)
});
await vscode.window.showTextDocument(document, { preview: false });
}
};
|