@@ -73,7 +73,6 @@ export class FortlsClient {
73
73
// restart this class
74
74
this . deactivate ( ) ;
75
75
this . activate ( ) ;
76
-
77
76
} catch ( error ) {
78
77
this . logger . error ( `[lsp.client] Error installing ${ LS_NAME } : ${ error } ` ) ;
79
78
window . showErrorMessage ( error ) ;
@@ -83,7 +82,6 @@ export class FortlsClient {
83
82
this . logger . info ( `[lsp.client] ${ LS_NAME } disabled in settings` ) ;
84
83
}
85
84
} ) ;
86
-
87
85
} else {
88
86
workspace . onDidOpenTextDocument ( this . didOpenTextDocument , this ) ;
89
87
workspace . textDocuments . forEach ( this . didOpenTextDocument , this ) ;
@@ -100,7 +98,6 @@ export class FortlsClient {
100
98
}
101
99
102
100
return ;
103
-
104
101
}
105
102
106
103
public async deactivate ( ) : Promise < void > {
@@ -296,11 +293,11 @@ export class FortlsClient {
296
293
297
294
/**
298
295
* Tries to find fortls and saves its path to this.path.
299
- *
296
+ *
300
297
* If a user path is configured, then only use this.
301
298
* If not, try running fortls globally, or from python user scripts folder on Windows.
302
- *
303
- * @returns true if fortls found, false if not
299
+ *
300
+ * @returns true if fortls found, false if not
304
301
*/
305
302
private getLSPath ( ) : boolean {
306
303
const config = workspace . getConfiguration ( EXTENSION_ID ) ;
@@ -311,29 +308,31 @@ export class FortlsClient {
311
308
// if there's a user configured path to the executable, check if it's absolute
312
309
if ( configuredPath !== '' ) {
313
310
if ( ! path . isAbsolute ( configuredPath ) ) {
314
- window . showErrorMessage ( " The path to fortls (fortran.fortls.path) must be absolute." ) ;
311
+ window . showErrorMessage ( ' The path to fortls (fortran.fortls.path) must be absolute.' ) ;
315
312
return false ;
316
313
}
317
314
318
315
pathsToCheck . push ( configuredPath ) ;
316
+ } else {
317
+ // no user configured path => perform standard search for fortls
319
318
320
- } else { // no user configured path => perform standard search for fortls
321
-
322
319
pathsToCheck . push ( 'fortls' ) ;
323
-
320
+
324
321
// On Windows, `pip install fortls --user` installs fortls to the userbase\PythonXY\Scripts path,
325
322
// so we want to look for it in this path as well.
326
323
if ( os . platform ( ) == 'win32' ) {
327
- const result = spawnSync ( 'python' , [ '-c' , 'import site; print(site.getusersitepackages())' ] ) ;
324
+ const result = spawnSync ( 'python' , [
325
+ '-c' ,
326
+ 'import site; print(site.getusersitepackages())' ,
327
+ ] ) ;
328
328
const userSitePackagesStr = result . stdout . toString ( ) . trim ( ) ;
329
-
329
+
330
330
// check if the call above returned something, in case the site module in python ever changes...
331
331
if ( userSitePackagesStr ) {
332
332
const userScriptsPath = path . resolve ( userSitePackagesStr , '../Scripts/fortls' ) ;
333
333
pathsToCheck . push ( userScriptsPath ) ;
334
334
}
335
335
}
336
-
337
336
}
338
337
339
338
// try to run `fortls --version` for all the given paths
@@ -400,7 +399,6 @@ export class FortlsClient {
400
399
return results . stdout . toString ( ) . trim ( ) ;
401
400
}
402
401
403
-
404
402
/**
405
403
* Restart the language server
406
404
*/
0 commit comments