-
Notifications
You must be signed in to change notification settings - Fork 184
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
can't get eslint working #526
Comments
It might be because eslint sends the See: https://microsoft.github.io/language-server-protocol/specification#workspace_configuration Could you figure out what VSCode does in case it receives a |
Hey, thanks for getting back to me this quick. Unfortunately I don't use vscode, and I'm totally a newcomer to LSP. I started out installing it only yesterday. Eslint in itself is not that important if I can get the above mentioned js-langserver working, as it supposedly does JS and linting in one. |
I'm not a JS user, so if you could give me precise instructions on how to install this js-langserver I could give it a try on getting it to work. |
With pleasure :) You install it with "eslint":
{
"enabled": true,
"command":
[
"/home/karolyi/Work/private/project/node_modules/.bin/js-langserver",
"--stdio"
],
}, You can also start it manually with the above command line to see if it works. Thanks for your efforts! |
This seems to be working for me:
But I don't know how to actually test if eslint does its thing with this server. |
Um, where does
I guess it's not recognizing that it should use this server for it? |
I'm still just scratching the surface, but I added a However after starting, I still get this debug from LSP:
|
That Click to see my complete personal preferences
|
By the way, do not override default_clients! Doing so will disable all other pre-configured language servers. Instead, override clients in your user preferences (see my personal config as an example). |
Yep, I did that now, and started initializing. Yet, the error message is the same as above in #526 (comment) |
I got the same message
With the following config
And I don't know why :) |
Topic changed from
I've checked that:
Here is the code that sends the response: https://github.com/Microsoft/vscode-eslint/blob/ff75d429be69ec09237ee859343739768f6c4a6d/client/src/extension.ts#L470 And here is, I think, the code that validates response: https://github.com/Microsoft/vscode-eslint/blob/ff75d429be69ec09237ee859343739768f6c4a6d/server/src/eslintServer.ts#L416 It seems that LSP would need to send pretty much the same response for server not to break but I haven't verified if that's all that is needed. (It would probably be best to split this discussion into two bugs, one for each LS.) |
Hi @rchl, this seems useful information. Also notice that the response type of workspace/configuration is an I don't understand the js-langserver error, and I also cannot find that particular error message (or part of it) in the python code, so I am somewhat at a loss where that error comes from. |
I think the error is coming from |
This will be fixed once tbodt/js-langserver#5 is merged. |
I'll close this issue as js-langserver should be a working alternative for now. Created #699 if we want to support the workspace/configuration request for eslint. |
Am I correct in deducing that this issue was/is about code-completion as well as just linting? For instance, I have LSP setup using |
@tsujp If you want eslint to lint your code, you need eslint language server. There is one at https://github.com/Microsoft/vscode-eslint but it doesn't work currently in LSP due to missing feature #699. If you are really desperate to use it, you could use my hacked version that removes use of (EDIT: I see that |
I'll give those a shot later, also I've been doing some digging and I've found these: typescript-language-server/typescript-language-server#58 So apparently we can use plugins in So, I'll be trying what I've just mentioned and your suggestions @rchl EDIT I found a repo that works https://github.com/Quramy/typescript-eslint-language-service Just add this into your
|
@tsujp hello can you please tell me how you got theia-ide/typescript-language-server work with https://github.com/Quramy/typescript-eslint-language-service? Because I just don't seem to get it working... :D |
Sure thing mate, here are my configs, I've included literally everything I can think of for this. Let me know how you go. Sublime Text packages:
Directory structure:
Global NPM install
tsconfig.json{
"compilerOptions": {
"rootDir": "./",
"baseUrl": "./",
"target": "es6",
"module": "commonjs",
"lib": [
"es2018",
"esnext.asynciterable",
"esnext.array"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"plugins": [
{
"name": "typescript-eslint-language-service"
}
]
},
"include": [
"**/**/**.ts",
"**/*.d.ts"
],
"typeRoots": [
"**/*.d.ts"
],
"exclude": [
"node_modules",
"**/node_modules/**",
"**/*.spec.ts",
"dist"
]
} .eslintrc.jsmodule.exports = {
env: {
browser: false, // make true if react
node: true
},
settings: {
'import/resolver': {
node: {
extensions: ['.ts', '.js'] // add '.tsx' if react
}
}
},
parser: '@typescript-eslint/parser', // you could use... 'babel-eslint'... but nah
parserOptions: {
ecmaVersion: 2018, // modern features
sourceType: 'module', // allow use of node modules `import` and `export`
project: './tsconfig.json', // typescript rule settings
tsconfigRootDir: __dirname,
createDefaultProgram: true
},
extends: [
'plugin:@typescript-eslint/recommended', // ootb eslint recommends
'standard' // ootb standardjs
// 'standard-jsx' // ootb standardjs-jsx
],
plugins: [
'@typescript-eslint' // allows override via rules below
// 'react-hooks'
],
rules: {
// 'react-hooks/rules-of-hooks': 'error',
// 'react-hooks/exhaustive-deps': 'warn',
'@typescript-eslint/no-use-before-define': ['error', { // hoist functions (not variables)
"functions": false
}],
'@typescript-eslint/no-explicit-any': 'off', // sometimes we need to jerry-rig
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/interface-name-prefix': 'off', // use our own prefix
'@typescript-eslint/member-delimiter-style': ['error', { // no delimiters for interfaces
multiline: {
'delimiter': 'none',
'requireLast': false
},
singleline: {
'delimiter': 'comma',
'requireLast': false
}
}],
'@typescript-eslint/indent': 'off', // standardjs is doing this instead
'camelcase': 'off', // & 3 below, graphql calls to postgres require snake_case
'@typescript-eslint/camelcase': ['error', { // as it's postgres' convention.
'ignoreDestructuring': true
}],
'no-unused-vars': 'off',
'node/no-unsupported-features/es-syntax': 'off' // allows use of `import` and `export`
}
} LSP settings, user{
"auto_show_diagnostics_panel_level": 3,
"clients":
{
"bashls":
{
"enabled": false
},
"js-ls": {
"enabled": true,
"command": [
"typescript-language-server",
"--stdio"
],
"languageId": "javascript",
"scopes": [
"source.js"
],
"syntaxes": [
"Packages/Babel/JavaScript (Babel).sublime-syntax",
]
},
"ts-ls":
{
"enabled": true,
"command": [
"typescript-language-server",
"--stdio"
],
"languageId": [
"typescript",
"typescriptreact"
],
"scopes": [
"source.ts",
"source.tsx"
],
"syntaxes": [
"Packages/TypeScript Syntax/TypeScript.tmLanguage",
"Packages/TypeScript Syntax/TypeScriptReact.tmLanguage"
]
},
"vscode-css":
{
"enabled": true
}
},
"completion_hint_type": "kind",
"log_debug": true,
"log_server": true,
"log_payloads": false,
"only_show_lsp_completions": true,
"show_diagnostics_count_in_view_status": true,
"show_diagnostics_phantoms": false,
"show_references_in_quick_panel": true,
"show_view_status": true
} babel.config.jsmodule.exports = (api) => {
api.cache(false)
const presets = ['@babel/preset-env']
const plugins = [
["@babel/plugin-transform-runtime",
{
"regenerator": true
}
]
]
return {
presets,
plugins
}
} Package.json{
"name": "thing",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@babel/runtime": "^7.6.0"
},
"devDependencies": {
"@babel/cli": "^7.5.0",
"@babel/core": "^7.5.0",
"@babel/node": "^7.6.1",
"@babel/plugin-transform-runtime": "^7.6.0",
"@babel/preset-env": "^7.5.0",
"@types/node": "^12.7.2",
"@typescript-eslint/eslint-plugin": "^2.0.0",
"@typescript-eslint/parser": "2.0.0",
"eslint": "^6.4.0",
"eslint-config-standard": "^13.0.1",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-node": "^9.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.0",
"ts-node": "^8.4.1",
"typescript": "^3.5.3",
"typescript-eslint-language-service": "^1.4.0"
}
} |
A big thank you! |
Hey,
I am trying to get the eslint server working, but to no avail. I have tried the vscode-eslint server as seen in an example config (although vscode-eslint is not on npm), and I have tried several versions of the eslint server that takes the --stdin value.
The server is started, but my code doesn't seem to output the eslint errors that I have configured to display with running eslint manually.
an example config for eslint-server:
Would there be a way for you to integrate https://github.com/tbodt/js-langserver ? It uses tern and eslint the same time, which would be perfect.
The text was updated successfully, but these errors were encountered: