@@ -73,7 +73,6 @@ export class FortlsClient {
7373 // restart this class
7474 this . deactivate ( ) ;
7575 this . activate ( ) ;
76-
7776 } catch ( error ) {
7877 this . logger . error ( `[lsp.client] Error installing ${ LS_NAME } : ${ error } ` ) ;
7978 window . showErrorMessage ( error ) ;
@@ -83,7 +82,6 @@ export class FortlsClient {
8382 this . logger . info ( `[lsp.client] ${ LS_NAME } disabled in settings` ) ;
8483 }
8584 } ) ;
86-
8785 } else {
8886 workspace . onDidOpenTextDocument ( this . didOpenTextDocument , this ) ;
8987 workspace . textDocuments . forEach ( this . didOpenTextDocument , this ) ;
@@ -100,7 +98,6 @@ export class FortlsClient {
10098 }
10199
102100 return ;
103-
104101 }
105102
106103 public async deactivate ( ) : Promise < void > {
@@ -296,11 +293,11 @@ export class FortlsClient {
296293
297294 /**
298295 * Tries to find fortls and saves its path to this.path.
299- *
296+ *
300297 * If a user path is configured, then only use this.
301298 * 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
304301 */
305302 private getLSPath ( ) : boolean {
306303 const config = workspace . getConfiguration ( EXTENSION_ID ) ;
@@ -311,29 +308,31 @@ export class FortlsClient {
311308 // if there's a user configured path to the executable, check if it's absolute
312309 if ( configuredPath !== '' ) {
313310 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.' ) ;
315312 return false ;
316313 }
317314
318315 pathsToCheck . push ( configuredPath ) ;
316+ } else {
317+ // no user configured path => perform standard search for fortls
319318
320- } else { // no user configured path => perform standard search for fortls
321-
322319 pathsToCheck . push ( 'fortls' ) ;
323-
320+
324321 // On Windows, `pip install fortls --user` installs fortls to the userbase\PythonXY\Scripts path,
325322 // so we want to look for it in this path as well.
326323 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+ ] ) ;
328328 const userSitePackagesStr = result . stdout . toString ( ) . trim ( ) ;
329-
329+
330330 // check if the call above returned something, in case the site module in python ever changes...
331331 if ( userSitePackagesStr ) {
332332 const userScriptsPath = path . resolve ( userSitePackagesStr , '../Scripts/fortls' ) ;
333333 pathsToCheck . push ( userScriptsPath ) ;
334334 }
335335 }
336-
337336 }
338337
339338 // try to run `fortls --version` for all the given paths
@@ -400,7 +399,6 @@ export class FortlsClient {
400399 return results . stdout . toString ( ) . trim ( ) ;
401400 }
402401
403-
404402 /**
405403 * Restart the language server
406404 */
0 commit comments