File tree Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -716,6 +716,7 @@ const LLM_GENERATION_DEV_ENDPOINT = new Setting(
716716 MODEL_SETTING ,
717717) ;
718718const EXTENSIONS_DIRECTORY = new Setting ( "extensionsDirectory" , MODEL_SETTING ) ;
719+ const ENABLE_PYTHON = new Setting ( "enablePython" , MODEL_SETTING ) ;
719720const ENABLE_ACCESS_PATH_SUGGESTIONS = new Setting (
720721 "enableAccessPathSuggestions" ,
721722 MODEL_SETTING ,
@@ -725,6 +726,7 @@ export interface ModelConfig {
725726 flowGeneration : boolean ;
726727 llmGeneration : boolean ;
727728 getExtensionsDirectory ( languageId : string ) : string | undefined ;
729+ enablePython : boolean ;
728730 enableAccessPathSuggestions : boolean ;
729731}
730732
@@ -763,6 +765,10 @@ export class ModelConfigListener extends ConfigListener implements ModelConfig {
763765 } ) ;
764766 }
765767
768+ public get enablePython ( ) : boolean {
769+ return ! ! ENABLE_PYTHON . getValue < boolean > ( ) ;
770+ }
771+
766772 public get enableAccessPathSuggestions ( ) : boolean {
767773 return ! ! ENABLE_ACCESS_PATH_SUGGESTIONS . getValue < boolean > ( ) ;
768774 }
Original file line number Diff line number Diff line change @@ -143,7 +143,10 @@ export class ModelEditorModule extends DisposableObject {
143143
144144 const language = db . language ;
145145
146- if ( ! isQueryLanguage ( language ) || ! isSupportedLanguage ( language ) ) {
146+ if (
147+ ! isQueryLanguage ( language ) ||
148+ ! isSupportedLanguage ( language , this . modelConfig )
149+ ) {
147150 void showAndLogErrorMessage (
148151 this . app . logger ,
149152 `The CodeQL Model Editor is not supported for ${ language } databases.` ,
Original file line number Diff line number Diff line change 11import { QueryLanguage } from "../common/query-language" ;
2+ import type { ModelConfig } from "../config" ;
23import { isCanary } from "../config" ;
34
45/**
@@ -10,7 +11,10 @@ export const SUPPORTED_LANGUAGES: QueryLanguage[] = [
1011 QueryLanguage . CSharp ,
1112] ;
1213
13- export function isSupportedLanguage ( language : QueryLanguage ) {
14+ export function isSupportedLanguage (
15+ language : QueryLanguage ,
16+ modelConfig : ModelConfig ,
17+ ) {
1418 if ( SUPPORTED_LANGUAGES . includes ( language ) ) {
1519 return true ;
1620 }
@@ -20,5 +24,10 @@ export function isSupportedLanguage(language: QueryLanguage) {
2024 return isCanary ( ) ;
2125 }
2226
27+ if ( language === QueryLanguage . Python ) {
28+ // Python is only enabled when the config setting is set
29+ return modelConfig . enablePython ;
30+ }
31+
2332 return false ;
2433}
You can’t perform that action at this time.
0 commit comments