Skip to content

Commit f737832

Browse files
authored
Merge pull request #666 from fortran-lang:gnikit/issue664
feat: path variable resolution for `fortls`
2 parents 81a0542 + f3adbc2 commit f737832

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,10 @@ coverage
99
# Fortran files
1010
*.o
1111
*.mod
12-
*.smod
12+
*.smod
13+
14+
# Python files
15+
venv/
16+
*.egg-info/
17+
*.eggs/
18+
*.pyc

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
99

1010
### Added
1111

12+
- Added support for variable resolution in `fortls`
13+
([#664](https://github.com/fortran-lang/vscode-fortran-support/issues/664))
1214
- Added Run and Debug buttons for single Fortran files based on linter settings
1315
([#646](https://github.com/fortran-lang/vscode-fortran-support/issues/646))
1416
- Added linter support for [LFortran](https://lfortran.org/)

src/lsp/client.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
isFortran,
1313
getOuterMostWorkspaceFolder,
1414
pipInstall,
15+
resolveVariables,
1516
} from '../lib/tools';
1617
import { Logger } from '../services/logging';
1718
import { RestartLS } from '../features/commands';
@@ -82,7 +83,8 @@ export class FortlsClient {
8283
if (!isFortran(document)) return;
8384

8485
const args: string[] = await this.fortlsArguments();
85-
const executablePath = workspace.getConfiguration(EXTENSION_ID).get<string>('fortls.path');
86+
const fortlsPath = workspace.getConfiguration(EXTENSION_ID).get<string>('fortls.path');
87+
const executablePath = resolveVariables(fortlsPath);
8688

8789
// Detect language server version and verify selected options
8890
this.version = this.getLSVersion(executablePath, args);
@@ -304,7 +306,7 @@ export class FortlsClient {
304306
*/
305307
private async fortlsDownload(): Promise<boolean> {
306308
const config = workspace.getConfiguration(EXTENSION_ID);
307-
const ls = config.get<string>('fortls.path');
309+
const ls = resolveVariables(config.get<string>('fortls.path'));
308310

309311
// Check for version, if this fails fortls provided is invalid
310312
const results = spawnSync(ls, ['--version']);

0 commit comments

Comments
 (0)