This repository was archived by the owner on Jul 8, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change 1010 */
1111class Config
1212{
13+ analyzeOnOpenDocument : string ;
14+ analyzeOnSaveDocument : string ;
1315 stackAnalysisCommand : string ;
1416 trackRecommendationAcceptanceCommand : string ;
1517 telemetryId : string ;
@@ -59,6 +61,8 @@ class Config
5961 }
6062
6163 load ( ) {
64+ this . analyzeOnOpenDocument = process . env . VSCEXT_ANALYZE_ON_OPEN_DOCUMENT || 'false' ;
65+ this . analyzeOnSaveDocument = process . env . VSCEXT_ANALYZE_ON_SAVE_DOCUMENT || 'false' ;
6266 this . stackAnalysisCommand = process . env . VSCEXT_STACK_ANALYSIS_COMMAND || '' ;
6367 this . trackRecommendationAcceptanceCommand = process . env . VSCEXT_TRACK_RECOMMENDATION_ACCEPTANCE_COMMAND || '' ;
6468 this . telemetryId = process . env . VSCEXT_TELEMETRY_ID || '' ;
@@ -92,6 +96,8 @@ class Config
9296 * @param data - The data from extension workspace settings to update the global configuration with.
9397 */
9498 updateConfig ( rhdaConfig : any ) {
99+ this . analyzeOnOpenDocument = rhdaConfig . analyzeOnOpenDocument ? 'true' : 'false' ;
100+ this . analyzeOnSaveDocument = rhdaConfig . analyzeOnSaveDocument ? 'true' : 'false' ;
95101 this . matchManifestVersions = rhdaConfig . matchManifestVersions ? 'true' : 'false' ;
96102 this . usePythonVirtualEnvironment = rhdaConfig . usePythonVirtualEnvironment ? 'true' : 'false' ;
97103 this . useGoMVS = rhdaConfig . useGoMVS ? 'true' : 'false' ;
Original file line number Diff line number Diff line change @@ -63,6 +63,9 @@ const server = new AnalysisLSPServer(connection);
6363 * On open document trigger event handler
6464 */
6565connection . onDidOpenTextDocument ( ( params ) => {
66+ if ( ! globalConfig . analyzeOnOpenDocument ) {
67+ return ;
68+ }
6669 server . handleFileEvent ( params . textDocument . uri , params . textDocument . text ) ;
6770} ) ;
6871
@@ -77,6 +80,9 @@ connection.onDidChangeTextDocument((params) => {
7780 * On save document trigger event handler
7881 */
7982connection . onDidSaveTextDocument ( ( params ) => {
83+ if ( ! globalConfig . analyzeOnSaveDocument ) {
84+ return ;
85+ }
8086 server . handleFileEvent ( params . textDocument . uri , server . files . fileData [ params . textDocument . uri ] ) ;
8187} ) ;
8288
You can’t perform that action at this time.
0 commit comments