Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions extensions/ql-vscode/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ let isInstallingOrUpdatingDistribution = false;
*
* @param excludedCommands List of commands for which we should not register error stubs.
*/
function registerErrorStubs(excludedCommands: string[], stubGenerator: (command: string) => () => void) {
function registerErrorStubs(excludedCommands: string[], stubGenerator: (command: string) => () => void): void {
// Remove existing stubs
errorStubs.forEach(stub => stub.dispose());

Expand Down Expand Up @@ -229,7 +229,7 @@ export async function activate(ctx: ExtensionContext): Promise<void> {
});
}

async function activateWithInstalledDistribution(ctx: ExtensionContext, distributionManager: DistributionManager) {
async function activateWithInstalledDistribution(ctx: ExtensionContext, distributionManager: DistributionManager): Promise<void> {
beganMainExtensionActivation = true;
// Remove any error stubs command handlers left over from first part
// of activation.
Expand Down Expand Up @@ -270,7 +270,7 @@ async function activateWithInstalledDistribution(ctx: ExtensionContext, distribu
await intm.showResults(query, forceReveal, false);
}

async function compileAndRunQuery(quickEval: boolean, selectedQuery: Uri | undefined) {
async function compileAndRunQuery(quickEval: boolean, selectedQuery: Uri | undefined): Promise<void> {
if (qs !== undefined) {
try {
const dbItem = await databaseUI.getDatabaseItem();
Expand All @@ -294,7 +294,7 @@ async function activateWithInstalledDistribution(ctx: ExtensionContext, distribu

ctx.subscriptions.push(tmpDirDisposal);

let client = new LanguageClient('CodeQL Language Server', () => spawnIdeServer(qlConfigurationListener), {
const client = new LanguageClient('CodeQL Language Server', () => spawnIdeServer(qlConfigurationListener), {
documentSelector: [
{ language: 'ql', scheme: 'file' },
{ language: 'yaml', scheme: 'file', pattern: '**/qlpack.yml' }
Expand Down
6 changes: 5 additions & 1 deletion extensions/ql-vscode/src/run-queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,11 @@ async function determineSelectedQuery(selectedResourceUri: vscode.Uri | undefine
if (queryUri.scheme !== 'file') {
throw new Error('Can only run queries that are on disk.');
}
const queryPath = queryUri.fsPath;
const queryPath = queryUri.fsPath || '';

if (!queryPath.endsWith('.ql')) {
throw new Error('The selected resource is not a CodeQL query file; It should have the extension ".ql".');
}

// Whether we chose the file from the active editor or from a context menu,
// if the same file is open with unsaved changes in the active editor,
Expand Down