Skip to content

Commit bf8b6c0

Browse files
authored
Add ignorePATH option (#534)
* Add ignorePATH option * Move ignorePATH logic to findLocalServer
1 parent 79456aa commit bf8b6c0

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,12 @@
167167
"default": "keep-up-to-date",
168168
"markdownDescription": "Determine what to do when a new version of the language server is available."
169169
},
170+
"haskell.ignorePATH": {
171+
"scope": "resource",
172+
"type": "boolean",
173+
"default": false,
174+
"description": "Whether to ignore haskell-language-server on PATH"
175+
},
170176
"haskell.checkProject": {
171177
"scope": "resource",
172178
"type": "boolean",
@@ -429,4 +435,4 @@
429435
"which": "^2.0.1",
430436
"yauzl": "^2.10.0"
431437
}
432-
}
438+
}

src/extension.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,15 @@ function findManualExecutable(logger: Logger, uri: Uri, folder?: WorkspaceFolder
122122
return exePath;
123123
}
124124

125-
/** Searches the PATH for whatever is set in serverVariant */
125+
/** Searches the PATH for whatever is set in serverVariant
126+
*
127+
* return null when **haskell.ignorePATH** set
128+
*/
126129
function findLocalServer(context: ExtensionContext, logger: Logger, uri: Uri, folder?: WorkspaceFolder): string | null {
130+
if (workspace.getConfiguration('haskell').get('ignorePATH') === true) {
131+
logger.info('Ignoring haskell-language-server on PATH');
132+
return null;
133+
}
127134
const exes: string[] = ['haskell-language-server-wrapper', 'haskell-language-server'];
128135
logger.info(`Searching for server executables ${exes.join(',')} in $PATH`);
129136
logger.info(`$PATH environment variable: ${process.env.PATH}`);

0 commit comments

Comments
 (0)