Skip to content

Commit b3d1766

Browse files
add error message when fortls spawn fails from user defined path
1 parent 8af551b commit b3d1766

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/lsp/client.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ export class FortlsClient {
4949
// Do not allow activating the LS functionality if no fortls is detected
5050
const fortlsFound = this.getLSPath();
5151

52+
const configuredPath = resolveVariables(config.get<string>('fortls.path'));
53+
if (configuredPath) {
54+
const msg = `Failed to run fortls from user configured path '` + configuredPath + `'`;
55+
await window.showErrorMessage(msg);
56+
return;
57+
}
58+
5259
if (!fortlsFound) {
5360
const msg = `Forlts wasn't found on your system.
5461
It is highly recommended to use the fortls to enable IDE features like hover, peeking, GoTos and many more.
@@ -304,7 +311,8 @@ export class FortlsClient {
304311
// if there's a user configured path to the executable, check if it's absolute
305312
if (configuredPath !== '') {
306313
if (!path.isAbsolute(configuredPath)) {
307-
throw Error("The path to fortls (fortls.path) must be absolute.");
314+
window.showErrorMessage("The path to fortls (fortran.fortls.path) must be absolute.");
315+
return false;
308316
}
309317

310318
pathsToCheck.push(configuredPath);

0 commit comments

Comments
 (0)