@@ -7,7 +7,7 @@ import '../../common/extensions';
7
7
import { inject , injectable , named } from 'inversify' ;
8
8
9
9
import { ICommandManager } from '../../common/application/types' ;
10
- import { traceDecorators } from '../../common/logger' ;
10
+ import { traceDecorators , traceVerbose } from '../../common/logger' ;
11
11
import { IDisposable , Resource } from '../../common/types' ;
12
12
import { debounceSync } from '../../common/utils/decorators' ;
13
13
import { EXTENSION_ROOT_DIR } from '../../constants' ;
@@ -80,16 +80,22 @@ export class JediLanguageServerManager implements ILanguageServerManager {
80
80
this . interpreter = interpreter ;
81
81
this . analysisOptions . onDidChange ( this . restartLanguageServerDebounced , this , this . disposables ) ;
82
82
83
- // Version is actually hardcoded in our requirements.txt.
84
- const requirementsTxt = await fs . readFile ( path . join ( EXTENSION_ROOT_DIR , 'requirements.txt' ) , 'utf-8' ) ;
85
-
86
- // Search using a regex in the text
87
- const match = / j e d i - l a n g u a g e - s e r v e r = = ( [ 0 - 9 \. ] * ) / . exec ( requirementsTxt ) ;
88
- if ( match && match . length > 1 ) {
89
- // eslint-disable-next-line prefer-destructuring
90
- this . lsVersion = match [ 1 ] ;
91
- } else {
92
- this . lsVersion = '0.19.3' ;
83
+ try {
84
+ // Version is actually hardcoded in our requirements.txt.
85
+ const requirementsTxt = await fs . readFile (
86
+ path . join ( EXTENSION_ROOT_DIR , 'jedils_requirements.txt' ) ,
87
+ 'utf-8' ,
88
+ ) ;
89
+
90
+ // Search using a regex in the text
91
+ const match = / j e d i - l a n g u a g e - s e r v e r = = ( [ 0 - 9 \. ] * ) / . exec ( requirementsTxt ) ;
92
+ if ( match && match . length === 2 ) {
93
+ [ , this . lsVersion ] = match ;
94
+ }
95
+ } catch ( ex ) {
96
+ // Getting version here is best effort and does not affect how LS works and
97
+ // failing to get version should not stop LS from working.
98
+ traceVerbose ( 'Failed to get jedi-language-server version: ' , ex ) ;
93
99
}
94
100
95
101
await this . analysisOptions . initialize ( resource , interpreter ) ;
0 commit comments