-
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
LSP-eslint exits unexpectedly in ST 4098 due to non-conforming stdout input #1612
Comments
If it shows up in the lower-left corner of ST window then it means it's working. It's just a matter of configuring eslint through project-specific eslint configuration to make it report errors. Stuff like |
Thx reply fisrt the same eslint setting in vscode was worked, |
are you able to provide a github repository that reproduces the issue? |
ok |
here is a test demo: https://github.com/tamamadesu/eslint-test |
LSP-eslint doesn't seem to report any error and just crashes silently. But if you try to run
You are using very old versions of both |
The fact that it works in VSCode is a bit of a mystery for me right now. I'll have a look at it later. |
It appears that this warning (the one starting with |
Moved this to the LSP repo. At the minimum, we should print the exception to make cases like this easier to diagnose in the future. Possibly we can gracefully handle such cases and just print those non-recognized messages to the LSP log panel. |
Ok, Thx!!! |
Actually, VSCode uses IPC transport and not STDIO so it's not affected by this issue. I'm not sure we can or should even try to fix it as the fix would be against the spec. We can probably only just make sure that the error is surfaced. |
Continuing from #2013.
As noted in the comment above, indeed, VSCode doesn't have this issue because it uses IPC. The client sets the transport kind here, and it executes the server with
This is possible (ESLint could invoke configuration files and plugins in a separate process and pipe the stdout only if asked to, and vscode-eslint could communicate with I'm thinking of adding IPC support instead, it actually looks pretty doable! |
Wish I would remember that I've investigated it before. :) |
Well, it would need to be done in python though and that's probably "a bit" more work as you can't rely on anything built-in into node. |
It's actually not bad, here's a PoC: # foo.py
import json
import multiprocessing
import os
import subprocess
parent_conn, child_conn = multiprocessing.Pipe()
env = os.environ.copy()
env['NODE_CHANNEL_FD'] = str(child_conn.fileno())
subprocess.Popen(
['node', 'foo.js'],
pass_fds=(child_conn.fileno(),),
env=env,
)
parent_conn._write(parent_conn.fileno(), json.dumps('Hello from Python!').encode("ascii") + b'\n')
print('Python received: ' + json.loads(parent_conn._read(parent_conn.fileno(), 1000))) // foo.js
process.on('message', (m) => console.log(`JavaScript received: ${m}`));
process.send('Hello from JavaScript!'); # python foo.py
Python received: Hello from JavaScript!
JavaScript received: Hello from Python!
Should I proceed with this? |
Any help here is appreciated so yeah :) If that's all it takes then it should be pretty easy to integrate it with the LSP code base and add it as a new client configuration option. Feel free to ask if you have any questions. You can also create a draft PR to make collaboration easier. |
It works! #2015 |
in .TSX file , Here is the startup console:
LSP-eslint.sublime-settings:
{ "enabled": true, "settings": { "validate": [ "javascript", "javascriptreact", "vue", "typescript", "typescriptreact" ], "options": { "parserOptions": { "project": [ "./tsconfig.json" ], } }, } }
Need some help, Thx !
The text was updated successfully, but these errors were encountered: