manateelazycat / lsp-bridge

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

Tailwindcss and Eslint working with javascriptreact but not typescriptreact. #1019

Open Matthew-Craig01 opened 3 months ago

Matthew-Craig01 commented 3 months ago

I've configured multi-lang servers for javascriptreact and typescript react:

(setq lsp-bridge-multi-lang-server-extension-list
  '(
    (("ts" )   . "typescript_eslint")
    (("tsx" )   . "typescriptreact_eslint_tailwindcss")
    (("jsx" )   . "javascriptreact_eslint_tailwindcss")
    (("html") . "html_tailwindcss")
    )
  )

typescriptreact_eslint_tailwindcss:

{
  "completion": ["typescriptreact", "tailwindcss"],
  "completion_item_resolve": ["typescriptreact", "tailwindcss"],
  "diagnostics": ["typescriptreact", "vscode-eslint-language-server"],
  "code_action": ["typescriptreact", "vscode-eslint-language-server"],
  "execute_command": ["typescriptreact", "vscode-eslint-language-server"],
  "find_define": "typescriptreact",
  "find_type_define": "typescriptreact",
  "find_implementation": "typescriptreact",
  "find_references": "typescriptreact",
  "peek_find_definition": "typescriptreact",
  "peek_find_references": "typescriptreact",
  "formatting": "typescriptreact",
  "hover": ["typescriptreact", "tailwindcss"],
  "signature_help": "typescriptreact",
  "prepare_rename": "typescriptreact",
  "rename": "typescriptreact",
  "document_symbol": "typescriptreact",
  "workspace_symbol": "typescriptreact",
  "semantic_tokens": "typescriptreact",
  "inlay_hint": "typescriptreact"
}

javascriptreact_eslint_tailwindcss:

{
  "completion": ["javascriptreact", "tailwindcss"],
  "completion_item_resolve": ["javascriptreact", "tailwindcss"],
  "diagnostics": ["javascriptreact", "vscode-eslint-language-server"],
  "code_action": ["javascriptreact", "vscode-eslint-language-server"],
  "execute_command": ["javascriptreact", "vscode-eslint-language-server"],
  "find_define": "javascriptreact",
  "find_type_define": "javascriptreact",
  "find_implementation": "javascriptreact",
  "find_references": "javascriptreact",
  "peek_find_definition": "javascriptreact",
  "peek_find_references": "javascriptreact",
  "formatting": "javascriptreact",
  "hover": ["javascriptreact", "tailwindcss"],
  "signature_help": "javascriptreact",
  "prepare_rename": "javascriptreact",
  "rename": "javascriptreact",
  "document_symbol": "javascriptreact",
  "workspace_symbol": "javascriptreact",
  "semantic_tokens": "javascriptreact",
  "inlay_hint": "javascriptreact"

}

However, only typescriptreact is working in tsx files (not tailwind or eslint)

My temporary solution for the tailwind part of it is to define a tailwindreact server that I've used in javascriptreact_eslint_tailwindcss:

{
  "name": "tailwindreact",
  "languageId": "javascriptreact",
  "command": ["tailwindcss-language-server", "--stdio"],
  "settings": {},
  "support-single-file": false
}

Similary, for eslint, I've changed vscode-eslint-language-server:

 "languageIds": {
    "tsx": "javascriptreact",
    "ts": "typescript",
    "js": "javascript",
    "jsx": "javascriptreact"
  },

This has fixed my issues for now, however, I thought I'd report this in case there was an underlying reason.

manateelazycat commented 3 months ago

It's looks you need "javascriptreact" as languageId pass to taildwindcss, otherwise can't work.

Ref issue https://github.com/manateelazycat/lsp-bridge/issues/907