Merge pull request #3548 from github/koesie10/remove-access-path-suggestions-ff
Remove `codeQL.model.enableAccessPathSuggestions` config
This commit is contained in:
@@ -738,10 +738,6 @@ const MODEL_EVALUATION = new Setting("evaluation", MODEL_SETTING);
|
||||
const MODEL_PACK_LOCATION = new Setting("packLocation", MODEL_SETTING);
|
||||
const MODEL_PACK_NAME = new Setting("packName", MODEL_SETTING);
|
||||
const ENABLE_PYTHON = new Setting("enablePython", MODEL_SETTING);
|
||||
const ENABLE_ACCESS_PATH_SUGGESTIONS = new Setting(
|
||||
"enableAccessPathSuggestions",
|
||||
MODEL_SETTING,
|
||||
);
|
||||
|
||||
export type ModelConfigPackVariables = {
|
||||
database: string;
|
||||
@@ -760,7 +756,6 @@ export interface ModelConfig {
|
||||
): string;
|
||||
getPackName(languageId: string, variables: ModelConfigPackVariables): string;
|
||||
enablePython: boolean;
|
||||
enableAccessPathSuggestions: boolean;
|
||||
}
|
||||
|
||||
export class ModelConfigListener extends ConfigListener implements ModelConfig {
|
||||
@@ -827,10 +822,6 @@ export class ModelConfigListener extends ConfigListener implements ModelConfig {
|
||||
public get enablePython(): boolean {
|
||||
return !!ENABLE_PYTHON.getValue<boolean>();
|
||||
}
|
||||
|
||||
public get enableAccessPathSuggestions(): boolean {
|
||||
return !!ENABLE_ACCESS_PATH_SUGGESTIONS.getValue<boolean>();
|
||||
}
|
||||
}
|
||||
|
||||
const GITHUB_DATABASE_SETTING = new Setting("githubDatabase", ROOT_SETTING);
|
||||
|
||||
@@ -348,17 +348,7 @@ export class ModelEditorView extends AbstractWebview<
|
||||
withProgress((progress) => this.loadMethods(progress), {
|
||||
cancellable: false,
|
||||
}),
|
||||
// Only load access path suggestions if the feature is enabled
|
||||
this.modelConfig.enableAccessPathSuggestions
|
||||
? withProgress(
|
||||
(progress) => this.loadAccessPathSuggestions(progress),
|
||||
{
|
||||
cancellable: false,
|
||||
location: ProgressLocation.Window,
|
||||
title: "Loading access path suggestions",
|
||||
},
|
||||
)
|
||||
: undefined,
|
||||
this.loadAccessPathSuggestions(),
|
||||
]);
|
||||
void telemetryListener?.sendUIInteraction("model-editor-switch-modes");
|
||||
|
||||
@@ -416,14 +406,7 @@ export class ModelEditorView extends AbstractWebview<
|
||||
await this.generateModeledMethodsOnStartup();
|
||||
}),
|
||||
this.loadExistingModeledMethods(),
|
||||
// Only load access path suggestions if the feature is enabled
|
||||
this.modelConfig.enableAccessPathSuggestions
|
||||
? withProgress((progress) => this.loadAccessPathSuggestions(progress), {
|
||||
cancellable: false,
|
||||
location: ProgressLocation.Window,
|
||||
title: "Loading access path suggestions",
|
||||
})
|
||||
: undefined,
|
||||
this.loadAccessPathSuggestions(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -568,9 +551,7 @@ export class ModelEditorView extends AbstractWebview<
|
||||
}
|
||||
}
|
||||
|
||||
protected async loadAccessPathSuggestions(
|
||||
progress: ProgressCallback,
|
||||
): Promise<void> {
|
||||
protected async loadAccessPathSuggestions(): Promise<void> {
|
||||
const mode = this.modelingStore.getMode(this.databaseItem);
|
||||
|
||||
const modelsAsDataLanguage = getModelsAsDataLanguage(this.language);
|
||||
@@ -579,46 +560,55 @@ export class ModelEditorView extends AbstractWebview<
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const suggestions = await runSuggestionsQuery(mode, {
|
||||
parseResults: (results) =>
|
||||
accessPathSuggestions.parseResults(
|
||||
results,
|
||||
modelsAsDataLanguage,
|
||||
await withProgress(
|
||||
async (progress) => {
|
||||
try {
|
||||
const suggestions = await runSuggestionsQuery(mode, {
|
||||
parseResults: (results) =>
|
||||
accessPathSuggestions.parseResults(
|
||||
results,
|
||||
modelsAsDataLanguage,
|
||||
this.app.logger,
|
||||
),
|
||||
queryConstraints: accessPathSuggestions.queryConstraints(mode),
|
||||
cliServer: this.cliServer,
|
||||
queryRunner: this.queryRunner,
|
||||
queryStorageDir: this.queryStorageDir,
|
||||
databaseItem: this.databaseItem,
|
||||
progress,
|
||||
token: this.cancellationTokenSource.token,
|
||||
logger: this.app.logger,
|
||||
});
|
||||
|
||||
if (!suggestions) {
|
||||
return;
|
||||
}
|
||||
|
||||
const options: AccessPathSuggestionOptions = {
|
||||
input: parseAccessPathSuggestionRowsToOptions(suggestions.input),
|
||||
output: parseAccessPathSuggestionRowsToOptions(suggestions.output),
|
||||
};
|
||||
|
||||
await this.postMessage({
|
||||
t: "setAccessPathSuggestions",
|
||||
accessPathSuggestions: options,
|
||||
});
|
||||
} catch (e: unknown) {
|
||||
void showAndLogExceptionWithTelemetry(
|
||||
this.app.logger,
|
||||
),
|
||||
queryConstraints: accessPathSuggestions.queryConstraints(mode),
|
||||
cliServer: this.cliServer,
|
||||
queryRunner: this.queryRunner,
|
||||
queryStorageDir: this.queryStorageDir,
|
||||
databaseItem: this.databaseItem,
|
||||
progress,
|
||||
token: this.cancellationTokenSource.token,
|
||||
logger: this.app.logger,
|
||||
});
|
||||
|
||||
if (!suggestions) {
|
||||
return;
|
||||
}
|
||||
|
||||
const options: AccessPathSuggestionOptions = {
|
||||
input: parseAccessPathSuggestionRowsToOptions(suggestions.input),
|
||||
output: parseAccessPathSuggestionRowsToOptions(suggestions.output),
|
||||
};
|
||||
|
||||
await this.postMessage({
|
||||
t: "setAccessPathSuggestions",
|
||||
accessPathSuggestions: options,
|
||||
});
|
||||
} catch (e: unknown) {
|
||||
void showAndLogExceptionWithTelemetry(
|
||||
this.app.logger,
|
||||
this.app.telemetry,
|
||||
redactableError(
|
||||
asError(e),
|
||||
)`Failed to fetch access path suggestions: ${getErrorMessage(e)}`,
|
||||
);
|
||||
}
|
||||
this.app.telemetry,
|
||||
redactableError(
|
||||
asError(e),
|
||||
)`Failed to fetch access path suggestions: ${getErrorMessage(e)}`,
|
||||
);
|
||||
}
|
||||
},
|
||||
{
|
||||
cancellable: false,
|
||||
location: ProgressLocation.Window,
|
||||
title: "Loading access path suggestions",
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
protected async generateModeledMethods(): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user