Closed zisiszikos closed 2 years ago
Open a file where you'd expect LSP-eslint to run and run LSP: Troubleshoot Server
from the Command Palette.
You can paste the output here (optionally censor any private information before).
What syntax are you using and what is the base scope of that syntax?
The problem doesn't seem to has something to do with the selected syntax, because whetever syntax I use -Javascript (Babel), JSX or Javascript- it works fine at the node.js project but it doesn't work at the react project.
And this is the Troubleshoot output:
## Server Configuration
- command
```json
[
"${node_bin}",
"${server_path}",
"--stdio"
]
/Users/_USERNAME_/.nvm/versions/node/v16.4.0/bin/node "/Users/_USERNAME_/Library/Caches/Sublime Text/Package Storage/LSP-eslint/16.4.0/language-server/out/eslintServer.js" --stdio
source.js | source.ts | source.jsx | source.tsx | source.js.jsx | source.js.react | source.ts.react | text.html.vue | text.html.basic
source.js | source.ts | source.jsx | source.tsx | source.js.jsx | source.js.react | source.ts.react | text.html.vue | text.html.basic
{}
{
"codeAction": {
"disableRuleComment": {
"enable": true,
"location": "separateLine"
},
"showDocumentation": {
"enable": true
}
},
"codeActionOnSave": {
"enable": true,
"mode": "all"
},
"format": false,
"nodePath": null,
"onIgnoredFiles": "off",
"options": {},
"packageManager": "npm",
"probe": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"html",
"vue",
"markdown"
],
"quiet": false,
"rulesCustomizations": [],
"run": "onType",
"useESLintClass": false,
"validate": [
"javascript",
"javascriptreact"
]
}
{
"PATH": "/Users/_USERNAME_/.nvm/versions/node/v16.4.0/bin:/Users/_USERNAME_/.nvm/versions/node/v16.4.0/bin:/Users/_USERNAME_/.nvm/versions/node/v16.4.0/bin:/Users/_USERNAME_/.nvm/versions/node/v16.4.0/bin:/Users/_USERNAME_/.nvm/versions/node/v16.4.0/bin:"
}
/Users/_USERNAME_/Projects/_MYPROJECT_/src/settings.js
{
"auto_complete_selector": "meta.tag, source - comment - string.quoted.double.block - string.quoted.single.block - string.unquoted.heredoc",
"lsp_active": true,
"syntax": "Packages/Babel/JavaScript (Babel).sublime-syntax"
}
source.js
[
"/Users/_USERNAME_/Projects/_MYPROJECT_"
]
{
"lsp_code_actions_on_save": {},
"show_diagnostics_count_in_view_status": true,
"show_diagnostics_panel_on_save": 0
}
According to this output, the LSP-eslint
should show in the status bar. You said it doesn't.
There is an issue with using *.js
extension though if that's an react file because js
file will report a javascript
langauge ID to the server while you want javascriptreact
if it's a react file. So you should name the file jsx
.
But if you really don't see LSP-eslint
in the status bar then run LSP: Toggle Log Panel
from the command palette and provide its output. It's possible that eslint server is crashing in your project for whatever reason.
Thank you all for your feedback.
The react project contains react files with both js
and jsx
extensions and native javascript files. LSP-eslint
is not working at neither of them.
I checked all possible extensions with all possible syntaxes with no luck.
The weird thing is that LSP-eslint
string is showing as the status bar at the beggining for 5 to 10 seconds and then disappears.
LSP: Toggle Log Panel
has this output (LSP-typescript
is also used at both react and nodejs projects and works fine at both of them):
LSP-typescript: [lspserver] Using Typescript version (bundled) 4.5.4 from path "/Users/zisiszikos/Library/Caches/Sublime Text/Package Storage/LSP-typescript/16.4.0/typescript-language-server/node_modules/typescript/lib/tsserver.js"
LSP-eslint: ESLint server running in node v16.4.0
LSP-eslint: ESLint library loaded from: /Users/zisiszikos/Projects/trigonon/ui-core/node_modules/eslint/lib/api.js
I wonder if there is some how a conflict between the nodejs version used by the lib (16.4.0 here), and the version that node_modules are installed at the react project (10.15.3).
If you can reproduce in vscode then you could report it at https://github.com/microsoft/vscode-eslint.
Different node versions should not be an issue as long as eslint server runs in a recent enough version.
You could try enabling more verbose logging (https://lsp.sublimetext.io/troubleshooting/#self-help-instructions) and check whether the LSP-eslint server says something relevant before it shuts itself down.
Closing due to no response. We'll look into it more if you provide the requested information.
LSP-eslint seems to be correctly installed and works fine for a node.js project, but it doesn't work for a react project. Nothing is written at the sublime console and the language server status at sublime status bar is not showing at this project.
I use the 16.4.0 node.js version and the following eslint configuration:
I also use eslint version 7.22.0 at package.json.
Is there something else that might prevent the service from running?