manateelazycat / lsp-bridge

A blazingly fast LSP client for Emacs
GNU General Public License v3.0
1.47k stars 214 forks source link

Eslint doesn't work with vscode-langservers-extracted@4.9.0+ #1041

Open kuba-orlik opened 2 months ago

kuba-orlik commented 2 months ago

When visiting a buffer in a typescript project, only Typescript errors are shown in the diagnostic list. Eslint errors are not shown. VSCode properly displays eslint issues in this project, so I know that eslint is properly configured.

I have both typescript-language-server and vscode-eslint-language-server installed. Here's how I'm setting up lsp-bridge:

(use-package lsp-bridge
  :straight '(lsp-bridge :type git :host github :repo "manateelazycat/lsp-bridge"
             :files (:defaults "*.el" "*.py" "acm" "core" "langserver" "multiserver" "resources")
             :build (:not compile))
  :bind (("M-." . lsp-bridge-find-def)
     ("M-," . lsp-bridge-find-def-return)
     ("C-M-." . lsp-bridge-peek)
     ("C-c c a" . lsp-bridge-code-action)
     ("M-?" . lsp-bridge-find-references)
     ("C-c ! n" . lsp-bridge-diagnostic-jump-next)
     ("C-c ! p" . lsp-bridge-diagnostic-jump-prev)
     )
  :init
  (global-lsp-bridge-mode))

With pgrep I can see that the eslint server is in fact running.

In the messages buffer, I can see that the eslint server is detected

[LSP-Bridge] found language server: /home/kuba/.nvm/versions/node/v20.11.1/bin/typescript-language-server
[LSP-Bridge] found language server: /home/kuba/.nvm/versions/node/v20.11.1/bin/vscode-eslint-language-server

However, in the *lsp-bridge* buffer, I see that messages are sent to eslint server, but it doesn't seem to reply. The only Recv lines from the eslint server are Recv window/logMessage notification from 'vscode-eslint-language-server' after opening a file.

--- [13:52:56.712765] Recv window/logMessage notification from 'vscode-eslint-language-server' for project my-project
{
   "jsonrpc": "2.0",
   "method": "$/typescriptVersion",
   "params": {
      "version": "4.9.4",
      "source": "workspace"
   }
}

But no more Recvs than that.

I'm using vscode-langservers-extracted v4.10.0

Downgrading to vscode-langservers-extracted@4.8.0 (npm install -g vscode-langservers-extracted@4.8.0) and restarting emacs makes the eslint diagnostics work properly

braineo commented 1 month ago

Hello @manateelazycat i encountered the same problem.

I attached the reproduction code

test.tar.gz

npm install
npm run lint

eslint outputs following but lsp bridge does not receive any diagnosis from lsp

./src/app/layout.tsx
15:13  Error: 'React' is not defined.  no-undef
30:7  Error: Expected a 'break' statement before 'case'.  no-fallthrough
manateelazycat commented 1 month ago

@braineo 可以考虑打开 VSCode 的 lsp trace log , 像这个issue https://github.com/manateelazycat/lsp-bridge/issues/1039#issuecomment-2394939660 那样。

我们对比一下 lsp-bridge 和 VSCode 的消息交互, 应该就可以修复。

braineo commented 1 month ago

@braineo 可以考虑打开 VSCode 的 lsp trace log , 像这个issue #1039 (comment) 那样。

我们对比一下 lsp-bridge 和 VSCode 的消息交互, 应该就可以修复。

That's exactly what i did, but i ran out of idea how to fix it.

Log from lsp bridge

lsp-eslint.log

Log from vscode

vscode-eslint.log

What I've tried by mimicking vscode but did not work

  1. add workspace field in initialization call to server
  2. do not send didConfigurationChange actively to server
  3. let server know the the client support registration capability
  4. send textDocument/diagonstic to server (this seems to be the key difference in vscode side)