Skip to content

Commit 1151432

Browse files
committed
Use language display name in notifications
1 parent 42f1e81 commit 1151432

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

extensions/ql-vscode/src/local-queries/skeleton-query-wizard.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ import { Uri, window as Window, window, workspace } from "vscode";
33
import { CodeQLCliServer } from "../codeql-cli/cli";
44
import { showAndLogExceptionWithTelemetry } from "../common/logging";
55
import { Credentials } from "../common/authentication";
6-
import { QueryLanguage } from "../common/query-language";
6+
import {
7+
getLanguageDisplayName,
8+
QueryLanguage,
9+
} from "../common/query-language";
710
import {
811
getFirstWorkspaceFolder,
912
isFolderAlreadyInWorkspace,
@@ -249,10 +252,15 @@ export class SkeletonQueryWizard {
249252
throw new Error("QL Pack storage path is undefined");
250253
}
251254

255+
if (this.language === undefined) {
256+
throw new Error("Language is undefined");
257+
}
258+
252259
const openFileLink = this.openFileMarkdownLink;
253260

261+
const displayLanguage = getLanguageDisplayName(this.language);
254262
const action = await showInformationMessageWithAction(
255-
`New CodeQL query for ${this.language} ${openFileLink} created, but no CodeQL databases for ${this.language} were detected in your workspace. Would you like to download a CodeQL database for ${this.language} to analyze with ${openFileLink}?`,
263+
`New CodeQL query for ${displayLanguage} ${openFileLink} created, but no CodeQL databases for ${displayLanguage} were detected in your workspace. Would you like to download a CodeQL database for ${displayLanguage} to analyze with ${openFileLink}?`,
256264
"Download database",
257265
);
258266

@@ -338,8 +346,9 @@ export class SkeletonQueryWizard {
338346
// select the found database
339347
await this.databaseManager.setCurrentDatabaseItem(existingDatabaseItem);
340348

349+
const displayLanguage = getLanguageDisplayName(this.language);
341350
void window.showInformationMessage(
342-
`New CodeQL query for ${this.language} ${openFileLink} created. We have automatically selected your existing CodeQL ${this.language} database ${existingDatabaseItem.name} for you to analyze with ${openFileLink}.`,
351+
`New CodeQL query for ${displayLanguage} ${openFileLink} created. We have automatically selected your existing CodeQL ${displayLanguage} database ${existingDatabaseItem.name} for you to analyze with ${openFileLink}.`,
343352
);
344353
}
345354
} else {

0 commit comments

Comments
 (0)