Skip to content
Open
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 @@ -371,6 +371,7 @@ This extension contributes the following variables to the [settings](https://cod

- `eslint.enable`: enable/disable ESLint for the workspace folder. Is enabled by default.
- `eslint.debug`: enables ESLint's debug mode (same as --debug command line option). Please see the ESLint output channel for the debug output. This options is very helpful to track down configuration and installation problems with ESLint since it provides verbose information about how ESLint is validating a file.
- `eslint.showOutputOnRestart`: shows the ESLint output channel after manually restarting the ESLint server. Disabled by default.
- `eslint.lintTask.enable`: whether the extension contributes a lint task to lint a whole workspace folder.
- `eslint.lintTask.options`: Command line options applied when running the task for linting the whole workspace (https://eslint.org/docs/user-guide/command-line-interface).
An example to point to a custom `.eslintrc.json` file and a custom `.eslintignore` is:
Expand Down
9 changes: 9 additions & 0 deletions client/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ let client: LanguageClient;
let acknowledgePerformanceStatus: () => void;
const taskProvider: TaskProvider = new TaskProvider();
const validator: Validator = new Validator();

function showOutputOnRestart(): void {
if (Workspace.getConfiguration('eslint').get<boolean>('showOutputOnRestart', false)) {
client.outputChannel.show();
}
}


export function activate(context: ExtensionContext) {

Expand Down Expand Up @@ -148,6 +155,7 @@ function realActivate(context: ExtensionContext): void {
[client, acknowledgePerformanceStatus] = ESLintClient.create(context, validator);
return client.start().then(() => {
client.info('ESLint server restarted.');
showOutputOnRestart();
}).catch((error) => {
client.error(`Starting the server failed.`, error, 'force');
const message = typeof error === 'string' ? error : typeof error.message === 'string' ? error.message : undefined;
Expand All @@ -158,6 +166,7 @@ function realActivate(context: ExtensionContext): void {
} else {
return client.restart().then(() => {
client.info('ESLint server restarted.');
showOutputOnRestart();
}).catch((error) => client.error(`Restarting client failed`, error, 'force'));
}
}),
Expand Down
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,12 @@
"default": false,
"markdownDescription": "Enables ESLint debug mode (same as `--debug` on the command line)"
},
"eslint.showOutputOnRestart": {
"scope": "window",
"type": "boolean",
"default": false,
"markdownDescription": "Shows the ESLint output channel after manually restarting the ESLint server."
},
"eslint.codeAction.disableRuleComment": {
"scope": "resource",
"type": "object",
Expand Down