Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow setting the node runtime to use for the language server. Fixes #345 #516

Merged
merged 2 commits into from
Aug 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ This extension contributes the following variables to the [settings](https://cod
```
- `eslint.run` - run the linter `onSave` or `onType`, default is `onType`.
- `eslint.autoFixOnSave` - enables auto fix on save. Please note auto fix on save is only available if VS Code's `files.autoSave` is either `off`, `onFocusChange` or `onWindowChange`. It will not work with `afterDelay`.
- `eslint.runtime` - use this setting to set the path of the node runtime to run ESLint under.
- `eslint.nodePath` - use this setting if an installed ESLint package can't be detected, for example `/myGlobalNodePackages/node_modules`.
- `eslint.validate` - an array of language identifiers specify the files to be validated. Something like `"eslint.validate": [ "javascript", "javascriptreact", "html" ]`. If the setting is missing, it defaults to `["javascript", "javascriptreact"]`. You can also control which plugins should provide autofix support. To do so simply provide an object literal in the validate setting with the properties `language` and `autoFix` instead of a simple `string`. An example is:
```json
Expand Down
5 changes: 3 additions & 2 deletions client/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,10 @@ export function realActivate(context: ExtensionContext) {
// the output folder.
// serverModule
let serverModule = context.asAbsolutePath(path.join('server', 'out', 'eslintServer.js'));
let runtime = Workspace.getConfiguration('eslint').get('runtime', null);
let serverOptions: ServerOptions = {
run: { module: serverModule, transport: TransportKind.ipc, options: { cwd: process.cwd() } },
debug: { module: serverModule, transport: TransportKind.ipc, options: { execArgv: ["--nolazy", "--inspect=6010"], cwd: process.cwd() } }
run: { module: serverModule, transport: TransportKind.ipc, runtime, options: { cwd: process.cwd() } },
debug: { module: serverModule, transport: TransportKind.ipc, runtime, options: { execArgv: ["--nolazy", "--inspect=6010"], cwd: process.cwd() } }
};

let defaultErrorHandler: ErrorHandler;
Expand Down
9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,15 @@
"type": "boolean",
"default": false,
"description": "Controls whether a task for linting the whole workspace will be available."
},
"eslint.runtime": {
"scope": "window",
"type": [
"string",
"null"
],
"default": null,
"description": "The location of the node binary to run ESLint under."
}
}
},
Expand Down
1 change: 1 addition & 0 deletions server/src/eslintServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ process.on('uncaughtException', (error: any) => {
});

let connection = createConnection();
connection.console.info(`ESLint server running in node ${process.version}`);
let documents: TextDocuments = new TextDocuments();

let _globalNpmPath: string | null | undefined;
Expand Down