Skip to content

Commit c7a048b

Browse files
authored
Merge pull request #3548 from github/koesie10/remove-access-path-suggestions-ff
Remove `codeQL.model.enableAccessPathSuggestions` config
2 parents 9026076 + 232d4c3 commit c7a048b

File tree

2 files changed

+49
-68
lines changed

2 files changed

+49
-68
lines changed

extensions/ql-vscode/src/config.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -738,10 +738,6 @@ const MODEL_EVALUATION = new Setting("evaluation", MODEL_SETTING);
738738
const MODEL_PACK_LOCATION = new Setting("packLocation", MODEL_SETTING);
739739
const MODEL_PACK_NAME = new Setting("packName", MODEL_SETTING);
740740
const ENABLE_PYTHON = new Setting("enablePython", MODEL_SETTING);
741-
const ENABLE_ACCESS_PATH_SUGGESTIONS = new Setting(
742-
"enableAccessPathSuggestions",
743-
MODEL_SETTING,
744-
);
745741

746742
export type ModelConfigPackVariables = {
747743
database: string;
@@ -760,7 +756,6 @@ export interface ModelConfig {
760756
): string;
761757
getPackName(languageId: string, variables: ModelConfigPackVariables): string;
762758
enablePython: boolean;
763-
enableAccessPathSuggestions: boolean;
764759
}
765760

766761
export class ModelConfigListener extends ConfigListener implements ModelConfig {
@@ -827,10 +822,6 @@ export class ModelConfigListener extends ConfigListener implements ModelConfig {
827822
public get enablePython(): boolean {
828823
return !!ENABLE_PYTHON.getValue<boolean>();
829824
}
830-
831-
public get enableAccessPathSuggestions(): boolean {
832-
return !!ENABLE_ACCESS_PATH_SUGGESTIONS.getValue<boolean>();
833-
}
834825
}
835826

836827
const GITHUB_DATABASE_SETTING = new Setting("githubDatabase", ROOT_SETTING);

extensions/ql-vscode/src/model-editor/model-editor-view.ts

Lines changed: 49 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -348,17 +348,7 @@ export class ModelEditorView extends AbstractWebview<
348348
withProgress((progress) => this.loadMethods(progress), {
349349
cancellable: false,
350350
}),
351-
// Only load access path suggestions if the feature is enabled
352-
this.modelConfig.enableAccessPathSuggestions
353-
? withProgress(
354-
(progress) => this.loadAccessPathSuggestions(progress),
355-
{
356-
cancellable: false,
357-
location: ProgressLocation.Window,
358-
title: "Loading access path suggestions",
359-
},
360-
)
361-
: undefined,
351+
this.loadAccessPathSuggestions(),
362352
]);
363353
void telemetryListener?.sendUIInteraction("model-editor-switch-modes");
364354

@@ -416,14 +406,7 @@ export class ModelEditorView extends AbstractWebview<
416406
await this.generateModeledMethodsOnStartup();
417407
}),
418408
this.loadExistingModeledMethods(),
419-
// Only load access path suggestions if the feature is enabled
420-
this.modelConfig.enableAccessPathSuggestions
421-
? withProgress((progress) => this.loadAccessPathSuggestions(progress), {
422-
cancellable: false,
423-
location: ProgressLocation.Window,
424-
title: "Loading access path suggestions",
425-
})
426-
: undefined,
409+
this.loadAccessPathSuggestions(),
427410
]);
428411
}
429412

@@ -568,9 +551,7 @@ export class ModelEditorView extends AbstractWebview<
568551
}
569552
}
570553

571-
protected async loadAccessPathSuggestions(
572-
progress: ProgressCallback,
573-
): Promise<void> {
554+
protected async loadAccessPathSuggestions(): Promise<void> {
574555
const mode = this.modelingStore.getMode(this.databaseItem);
575556

576557
const modelsAsDataLanguage = getModelsAsDataLanguage(this.language);
@@ -579,46 +560,55 @@ export class ModelEditorView extends AbstractWebview<
579560
return;
580561
}
581562

582-
try {
583-
const suggestions = await runSuggestionsQuery(mode, {
584-
parseResults: (results) =>
585-
accessPathSuggestions.parseResults(
586-
results,
587-
modelsAsDataLanguage,
588-
this.app.logger,
589-
),
590-
queryConstraints: accessPathSuggestions.queryConstraints(mode),
591-
cliServer: this.cliServer,
592-
queryRunner: this.queryRunner,
593-
queryStorageDir: this.queryStorageDir,
594-
databaseItem: this.databaseItem,
595-
progress,
596-
token: this.cancellationTokenSource.token,
597-
logger: this.app.logger,
598-
});
563+
await withProgress(
564+
async (progress) => {
565+
try {
566+
const suggestions = await runSuggestionsQuery(mode, {
567+
parseResults: (results) =>
568+
accessPathSuggestions.parseResults(
569+
results,
570+
modelsAsDataLanguage,
571+
this.app.logger,
572+
),
573+
queryConstraints: accessPathSuggestions.queryConstraints(mode),
574+
cliServer: this.cliServer,
575+
queryRunner: this.queryRunner,
576+
queryStorageDir: this.queryStorageDir,
577+
databaseItem: this.databaseItem,
578+
progress,
579+
token: this.cancellationTokenSource.token,
580+
logger: this.app.logger,
581+
});
599582

600-
if (!suggestions) {
601-
return;
602-
}
583+
if (!suggestions) {
584+
return;
585+
}
603586

604-
const options: AccessPathSuggestionOptions = {
605-
input: parseAccessPathSuggestionRowsToOptions(suggestions.input),
606-
output: parseAccessPathSuggestionRowsToOptions(suggestions.output),
607-
};
587+
const options: AccessPathSuggestionOptions = {
588+
input: parseAccessPathSuggestionRowsToOptions(suggestions.input),
589+
output: parseAccessPathSuggestionRowsToOptions(suggestions.output),
590+
};
608591

609-
await this.postMessage({
610-
t: "setAccessPathSuggestions",
611-
accessPathSuggestions: options,
612-
});
613-
} catch (e: unknown) {
614-
void showAndLogExceptionWithTelemetry(
615-
this.app.logger,
616-
this.app.telemetry,
617-
redactableError(
618-
asError(e),
619-
)`Failed to fetch access path suggestions: ${getErrorMessage(e)}`,
620-
);
621-
}
592+
await this.postMessage({
593+
t: "setAccessPathSuggestions",
594+
accessPathSuggestions: options,
595+
});
596+
} catch (e: unknown) {
597+
void showAndLogExceptionWithTelemetry(
598+
this.app.logger,
599+
this.app.telemetry,
600+
redactableError(
601+
asError(e),
602+
)`Failed to fetch access path suggestions: ${getErrorMessage(e)}`,
603+
);
604+
}
605+
},
606+
{
607+
cancellable: false,
608+
location: ProgressLocation.Window,
609+
title: "Loading access path suggestions",
610+
},
611+
);
622612
}
623613

624614
protected async generateModeledMethods(): Promise<void> {

0 commit comments

Comments
 (0)