Skip to content
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 handler not happy with multiple tsconfig.json #67

Open
EricDriussi opened this issue Jan 24, 2022 · 1 comment
Open

Lsp handler not happy with multiple tsconfig.json #67

EricDriussi opened this issue Jan 24, 2022 · 1 comment

Comments

@EricDriussi
Copy link

EricDriussi commented Jan 24, 2022

Hi there! Thanks for putting this together, it has helped immensely 😄

I'm currently working on a rather large project with multiple tsconfigs in the same project (different dirs tho).
I bring this up because the following issue only comes up in this setup. Other ts projects work just fine, so there is a chance it has nothing to do with the config.

That being said, temporarily swapping my config for the one in this repo and opening ts files in the problematic project produces the same outcome. So there's that 🤷

The project is also big. As in 1.5GB (without node_modules) kinda big.

Basically, (after a small delay after opening a file) I get a recurring error:

Error detected while processing CursorHold Autocommands for "<buffer=1>":
method textDocument/documentHighlight is not supported by any of the servers registered for the current buffer

This keeps popping up constantly which prevents me from doing anything.

Trying to run something like :Telescope lsp_code_actions just repeats part of the previous error:

method textDocument/documentHighlight is not supported by any of the servers registered for the current buffer

Might be worth mentioning that I occasionally get the following error:

Client 3 quit with exit code 1 and signal 0

For example, when editing my init.vim (even though there's just vimls and null-ls)

I noticed that removing the line with autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight() (located in the handlers.lua file), gets rid of the first error message, although that still leaves the second one and simply means not having proper highlighting.
So that didn't solve much...

In case it helps, running :LspInfo with a problematic file open shows:

 Language client log: /home/eric/.cache/nvim/lsp.log
 Detected filetype:   typescript
 
 1 client(s) attached to this buffer: 
 
 Client: null-ls (id: 1, pid: 5001, bufnr: [1])
 	filetypes:       lua, javascript, typescript, typescriptreact, javascriptreact, vue, sass, scss, less, css, sh
 	autostart:       false
 	root directory:  /home/eric/Documents/leanmind/audiense/socialbro
 	cmd:             nvim
 
 Other clients that match the filetype: typescript
 
 Config: tsserver
 	filetypes:         javascript, javascriptreact, javascript.jsx, typescript, typescriptreact, typescript.tsx
 	root directory:    /home/eric/Documents/leanmind/audiense/socialbro
 	cmd:               typescript-language-server --stdio
 	cmd is executable: true
 	autostart:         true
 	custom handlers:   
 
 Configured servers list: html, ltex, tsserver, yamlls, cssls, sqlls, emmet_ls, vimls, sumneko_lua, dockerls, jsonls

And :checkhealth shows:


bettersml: health#bettersml#check
========================================================================
## REPL
  - OK: REPL backend is available and valid: neovim
  - OK: SML/NJ is executable at '/usr/bin/smlnj'.
  - OK: rlwrap is available and will be used to launch REPLs

## Type information
  - OK: MLton is executable at 'mlton'.
  - OK: Support files are executable at '/home/eric/.config/nvim/plugged/vim-better-sml/bin/vbs-util'.

## General
  - OK: Asynchronous jobs are available.
  - WARNING: def-use files will not be auto-built
    - ADVICE:
      - We did not find an MLBasis file for your project, and you have
      - g:sml_auto_create_def_use = 'mlb'. This means that def-use files
      - will only be auto-built for multi-file projects.
      - See :help |g:sml_auto_create_def_use| for more information.
  - WARNING: Compilation errors will not be reported.
    - ADVICE:
      - To have Vim report SML errors and warnings alongside your code,
      - install one of w0rp/ale or scrooloose/syntastic.
      - Also be sure to have SML/NJ installed.

mkdp: health#mkdp#check
========================================================================
  - INFO: Platform: linux
  - INFO: Nvim Version: NVIM v0.6.1
  - INFO: Node version: v17.3.0

  - INFO: Script: /home/eric/.config/nvim/plugged/markdown-preview.nvim/app/server.js
  - INFO: Script exists: 1
  - OK: Using node

null-ls: require("null-ls.health").check()
========================================================================
  - OK: stylua: the command "stylua" is executable.
  - OK: eslint: the command "eslint" is executable.
  - OK: stylelint: the command "stylelint" is executable.
  - OK: stylelint: the command "stylelint" is executable.
  - OK: shellharden: the command "shellharden" is executable.
  - OK: shellcheck: the command "shellcheck" is executable.

nvim: health#nvim#check
========================================================================
## Configuration
  - OK: no issues found

## Performance
  - OK: Build type: Release

## Remote Plugins
  - OK: Up to date

## terminal
  - INFO: key_backspace (kbs) terminfo entry: key_backspace=\177
  - INFO: key_dc (kdch1) terminfo entry: key_dc=\E[3~
  - INFO: $COLORTERM='truecolor'

nvim-lsp-installer: require("nvim-lsp-installer.health").check()
========================================================================
## nvim-lsp-installer report
  - OK: neovim version >= 0.6.0
  - WARNING: **Ruby**: not available
  - WARNING: **RubyGem**: not available
  - WARNING: **Composer**: not available
  - WARNING: **PHP**: not available
  - WARNING: **julia**: not available
  - OK: **bash**: `GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)`
  - OK: **tar**: `tar (GNU tar) 1.34`
  - OK: **gzip**: `gzip 1.11`
  - OK: **curl**: `curl 7.81.0 (x86_64-pc-linux-gnu) libcurl/7.81.0 OpenSSL/1.1.1m zlib/1.2.11 brotli/1.0.9 zstd/1.5.1 libidn2/2.3.2 libpsl/0.21.1 (+libidn2/2.3.0) libssh2/1.10.0 nghttp2/1.46.0`
  - OK: **wget**: `GNU Wget 1.21.2 built on linux-gnu.`
  - OK: **python3**: `Python 3.10.1`
  - OK: **node**: `v17.3.0`
  - OK: **Go**: `go version go1.17.6 linux/amd64`
  - OK: **sh**: `Ok`
  - OK: **java**: `Ok`
  - OK: **javac**: `Ok`
  - OK: **npm**: `8.3.2`
  - OK: **pip3**: `pip 20.3.4 from /usr/lib/python3.10/site-packages/pip (python 3.10)`

nvim-treesitter: require("nvim-treesitter.health").check()
========================================================================
## Installation
  - OK: `tree-sitter` found  0.20.3 (parser generator, only needed for :TSInstallFromGrammar)
  - OK: `node` found v17.3.0 (only needed for :TSInstallFromGrammar)
  - OK: `git` executable found.
  - OK: `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
    Version: cc (GCC) 11.1.0
  - OK: Neovim was compiled with tree-sitter runtime ABI version 13 (required >=13). Parsers must be compatible with runtime ABI.

## Parser/Features H L F I J
  - ocaml_interface✓ ✓ ✓ . ✓ 
  - beancount      ✓ . ✓ . . 
  - python         ✓ ✓ ✓ ✓ ✓ 
  - sparql         ✓ ✓ ✓ ✓ ✓ 
  - comment        ✓ . . . . 
  - lua            ✓ ✓ ✓ ✓ ✓ 
  - ocaml          ✓ ✓ ✓ . ✓ 
  - ninja          ✓ . ✓ ✓ . 
  - ql             ✓ ✓ . ✓ ✓ 
  - glsl           ✓ ✓ ✓ ✓ ✓ 
  - json           ✓ ✓ ✓ ✓ . 
  - pug            ✓ . . . ✓ 
  - ledger         ✓ . ✓ ✓ ✓ 
  - php            ✓ ✓ ✓ ✓ ✓ 
  - clojure        ✓ ✓ ✓ . ✓ 
  - supercollider  ✓ ✓ ✓ ✓ ✓ 
  - heex           ✓ . ✓ ✓ ✓ 
  - godot_resource ✓ ✓ ✓ . . 
  - typescript     ✓ ✓ ✓ ✓ ✓ 
  - fennel         ✓ ✓ . . ✓ 
  - query          ✓ ✓ ✓ ✓ ✓ 
  - cpp            ✓ ✓ ✓ ✓ ✓ 
  - vue            ✓ . ✓ ✓ ✓ 
  - latex          ✓ . ✓ . ✓ 
  - make           ✓ . . . ✓ 
  - rst            ✓ ✓ . . ✓ 
  - css            ✓ . ✓ ✓ ✓ 
  - glimmer        ✓ . . . . 
  - erlang         . . . . . 
  - gowork         ✓ . . . ✓ 
  - regex          ✓ . . . . 
  - nix            ✓ ✓ ✓ . ✓ 
  - svelte         ✓ . ✓ ✓ ✓ 
  - prisma         ✓ . . . . 
  - c              ✓ ✓ ✓ ✓ ✓ 
  - teal           ✓ ✓ ✓ ✓ ✓ 
  - java           ✓ ✓ . ✓ ✓ 
  - http           ✓ . . . ✓ 
  - llvm           ✓ . . . . 
  - hjson          ✓ ✓ ✓ ✓ ✓ 
  - gomod          ✓ . . . ✓ 
  - dart           ✓ ✓ . ✓ ✓ 
  - javascript     ✓ ✓ ✓ ✓ ✓ 
  - pioasm         ✓ . . . ✓ 
  - bash           ✓ ✓ ✓ . ✓ 
  - json5          ✓ . . . ✓ 
  - vim            ✓ ✓ . . ✓ 
  - yaml           ✓ ✓ ✓ ✓ ✓ 
  - cmake          ✓ . ✓ . . 
  - zig            ✓ . ✓ ✓ ✓ 
  - bibtex         ✓ . ✓ ✓ . 
  - r              ✓ ✓ . . . 
  - julia          ✓ ✓ ✓ ✓ ✓ 
  - devicetree     ✓ ✓ ✓ ✓ ✓ 
  - jsdoc          ✓ . . . . 
  - gdscript       ✓ ✓ . . ✓ 
  - turtle         ✓ ✓ ✓ ✓ ✓ 
  - pascal         ✓ ✓ ✓ ✓ ✓ 
  - toml           ✓ ✓ ✓ ✓ ✓ 
  - tsx            ✓ ✓ ✓ ✓ ✓ 
  - fusion         ✓ ✓ ✓ ✓ . 
  - scss           ✓ . . ✓ . 
  - yang           ✓ . ✓ . . 
  - hocon          ✓ . . . ✓ 
  - surface        ✓ . ✓ ✓ ✓ 
  - jsonc          ✓ ✓ ✓ ✓ ✓ 
  - dot            ✓ . . . ✓ 
  - go             ✓ ✓ ✓ ✓ ✓ 
  - commonlisp     ✓ ✓ ✓ . . 
  - cuda           ✓ ✓ ✓ ✓ ✓ 
  - c_sharp        ✓ ✓ ✓ . ✓ 
  - elixir         ✓ ✓ ✓ ✓ ✓ 
  - kotlin         ✓ ✓ ✓ . ✓ 
  - ruby           ✓ ✓ ✓ ✓ ✓ 
  - fish           ✓ ✓ ✓ ✓ ✓ 
  - ocamllex       ✓ . . . ✓ 
  - scala          ✓ . ✓ . ✓ 
  - dockerfile     ✓ . . . ✓ 
  - rust           ✓ ✓ ✓ ✓ ✓ 
  - perl           ✓ . . . . 
  - tlaplus        ✓ . ✓ . ✓ 
  - html           ✓ ✓ ✓ ✓ ✓ 
  - graphql        ✓ . . ✓ ✓ 
  - rasi           ✓ ✓ ✓ ✓ . 
  - hcl            ✓ . ✓ ✓ ✓ 

  Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections
         +) multiple parsers found, only one will be used
         x) errors found in the query, try to run :TSUpdate {lang}

provider: health#provider#check
========================================================================
## Clipboard (optional)
  - OK: Clipboard tool found: xclip

## Python 2 provider (optional)
  - WARNING: No Python executable found that can `import neovim`. Using the first available executable for diagnostics.
  - ERROR: Python provider error:
    - ADVICE:
      - provider/pythonx: Could not load Python 2:
          /usr/bin/python2 does not have the "neovim" module. :help |provider-python|
          /usr/bin/python2.7 does not have the "neovim" module. :help |provider-python|
          python2.6 not found in search path or not executable.
          /usr/bin/python is Python 3.10 and cannot provide Python 2.
  - INFO: Executable: Not found

## Python 3 provider (optional)
  - WARNING: No Python executable found that can `import neovim`. Using the first available executable for diagnostics.
  - ERROR: Python provider error:
    - ADVICE:
      - provider/pythonx: Could not load Python 3:
          /usr/bin/python3 does not have the "neovim" module. :help |provider-python|
          /usr/bin/python3.10 does not have the "neovim" module. :help |provider-python|
          python3.9 not found in search path or not executable.
          python3.8 not found in search path or not executable.
          python3.7 not found in search path or not executable.
          python3.6 not found in search path or not executable.
          /usr/bin/python does not have the "neovim" module. :help |provider-python|
  - INFO: Executable: Not found

## Python virtualenv
  - OK: no $VIRTUAL_ENV

## Ruby provider (optional)
  - WARNING: `ruby` and `gem` must be in $PATH.
    - ADVICE:
      - Install Ruby and verify that `ruby` and `gem` commands work.

## Node.js provider (optional)
  - INFO: Node.js: v17.3.0
  - WARNING: Missing "neovim" npm (or yarn) package.
    - ADVICE:
      - Run in shell: npm install -g neovim
      - Run in shell (if you use yarn): yarn global add neovim

## Perl provider (optional)
  - ERROR: perl provider error:
    - ADVICE:
      - "Neovim::Ext" cpan module is not installed

telescope: require("telescope.health").check()
========================================================================
## Checking for required plugins
  - OK: plenary installed.
  - OK: nvim-treesitter installed.

## Checking external dependencies
  - OK: rg: found ripgrep 13.0.0
  - WARNING: fd: not found. Install [sharkdp/fd](https://github.com/sharkdp/fd) for extended capabilities

## ===== Installed extensions =====

## Telescope Extension: `fzf`
  - INFO: No healthcheck provided

vim.lsp: require("vim.lsp.health").check()
========================================================================
  - INFO: LSP log level : WARN
  - INFO: Log path: /home/eric/.cache/nvim/lsp.log
  - INFO: Log size: 14277 KB

vim.treesitter: require("vim.treesitter.health").check()
========================================================================
  - INFO: Runtime ABI version : 13
  - OK: Loaded parser for bash: ABI version 13
  - OK: Loaded parser for beancount: ABI version 13
  - OK: Loaded parser for bibtex: ABI version 13
  - OK: Loaded parser for c: ABI version 13
  - OK: Loaded parser for c_sharp: ABI version 13
  - OK: Loaded parser for clojure: ABI version 13
  - OK: Loaded parser for cmake: ABI version 13
  - OK: Loaded parser for comment: ABI version 13
  - OK: Loaded parser for commonlisp: ABI version 13
  - OK: Loaded parser for cpp: ABI version 13
  - OK: Loaded parser for css: ABI version 13
  - OK: Loaded parser for cuda: ABI version 13
  - OK: Loaded parser for dart: ABI version 13
  - OK: Loaded parser for devicetree: ABI version 13
  - OK: Loaded parser for dockerfile: ABI version 13
  - OK: Loaded parser for dot: ABI version 13
  - OK: Loaded parser for elixir: ABI version 13
  - OK: Loaded parser for erlang: ABI version 13
  - OK: Loaded parser for fennel: ABI version 13
  - OK: Loaded parser for fish: ABI version 13
  - OK: Loaded parser for fusion: ABI version 13
  - OK: Loaded parser for gdscript: ABI version 13
  - OK: Loaded parser for glimmer: ABI version 13
  - OK: Loaded parser for glsl: ABI version 13
  - OK: Loaded parser for go: ABI version 13
  - OK: Loaded parser for godot_resource: ABI version 13
  - OK: Loaded parser for gomod: ABI version 13
  - OK: Loaded parser for gowork: ABI version 13
  - OK: Loaded parser for graphql: ABI version 13
  - OK: Loaded parser for hcl: ABI version 13
  - OK: Loaded parser for heex: ABI version 13
  - OK: Loaded parser for hjson: ABI version 13
  - OK: Loaded parser for hocon: ABI version 13
  - OK: Loaded parser for html: ABI version 13
  - OK: Loaded parser for http: ABI version 13
  - OK: Loaded parser for java: ABI version 13
  - OK: Loaded parser for javascript: ABI version 13
  - OK: Loaded parser for jsdoc: ABI version 13
  - OK: Loaded parser for json: ABI version 13
  - OK: Loaded parser for json5: ABI version 13
  - OK: Loaded parser for jsonc: ABI version 13
  - OK: Loaded parser for julia: ABI version 13
  - OK: Loaded parser for kotlin: ABI version 13
  - OK: Loaded parser for latex: ABI version 13
  - OK: Loaded parser for ledger: ABI version 13
  - OK: Loaded parser for llvm: ABI version 13
  - OK: Loaded parser for lua: ABI version 13
  - OK: Loaded parser for make: ABI version 13
  - OK: Loaded parser for ninja: ABI version 13
  - OK: Loaded parser for nix: ABI version 13
  - OK: Loaded parser for ocaml: ABI version 13
  - OK: Loaded parser for ocaml_interface: ABI version 13
  - OK: Loaded parser for ocamllex: ABI version 13
  - OK: Loaded parser for pascal: ABI version 13
  - OK: Loaded parser for perl: ABI version 13
  - OK: Loaded parser for php: ABI version 13
  - OK: Loaded parser for pioasm: ABI version 13
  - OK: Loaded parser for prisma: ABI version 13
  - OK: Loaded parser for pug: ABI version 13
  - OK: Loaded parser for python: ABI version 13
  - OK: Loaded parser for ql: ABI version 13
  - OK: Loaded parser for query: ABI version 13
  - OK: Loaded parser for r: ABI version 13
  - OK: Loaded parser for rasi: ABI version 13
  - OK: Loaded parser for regex: ABI version 13
  - OK: Loaded parser for rst: ABI version 13
  - OK: Loaded parser for ruby: ABI version 13
  - OK: Loaded parser for rust: ABI version 13
  - OK: Loaded parser for scala: ABI version 13
  - OK: Loaded parser for scss: ABI version 13
  - OK: Loaded parser for sparql: ABI version 13
  - OK: Loaded parser for supercollider: ABI version 13
  - OK: Loaded parser for surface: ABI version 13
  - OK: Loaded parser for svelte: ABI version 13
  - OK: Loaded parser for teal: ABI version 13
  - OK: Loaded parser for tlaplus: ABI version 13
  - OK: Loaded parser for toml: ABI version 13
  - OK: Loaded parser for tsx: ABI version 13
  - OK: Loaded parser for turtle: ABI version 13
  - OK: Loaded parser for typescript: ABI version 13
  - OK: Loaded parser for vim: ABI version 13
  - OK: Loaded parser for vue: ABI version 13
  - OK: Loaded parser for yaml: ABI version 13
  - OK: Loaded parser for yang: ABI version 13
  - OK: Loaded parser for zig: ABI version 13

which_key: health#which_key#check
========================================================================
## WhichKey: checking conflicting keymaps
  - WARNING: conflicting keymap exists for mode **"v"**, lhs: **"["**
  - INFO: rhs: `S]`
  - WARNING: conflicting keymap exists for mode **"n"**, lhs: **"<C-W>"**
  - INFO: rhs: `:q<CR>`
  - WARNING: conflicting keymap exists for mode **"n"**, lhs: **" s"**
  - INFO: rhs: `:SMLReplStop<CR>:SMLReplStart<CR>:wincmd l<CR>`
  - WARNING: conflicting keymap exists for mode **"n"**, lhs: **"ys"**
  - INFO: rhs: `<Plug>Ysurround`
  - WARNING: conflicting keymap exists for mode **"n"**, lhs: **"yS"**
  - INFO: rhs: `<Plug>YSurround`
  - WARNING: buffer-local keymap overriding global for mode **"n"**, buf: 0, lhs: **"<leader>u"**
  - INFO: old rhs: `<cmd>UndotreeToggle<CR>`
  - INFO: new rhs: `<cmd>UndotreeToggle<cr>`
  - WARNING: buffer-local keymap overriding global for mode **"n"**, buf: 0, lhs: **"<leader>e"**
  - INFO: old rhs: `<cmd>NvimTreeToggle<CR>`
  - INFO: new rhs: `<cmd>NvimTreeToggle<cr>`

Thanks in advance to anyone willing to shed some light on the situation!

@EricDriussi
Copy link
Author

Switching from <buffer> to * in the problematic lines seem to work just fine 🤔

So from

autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()

to

autocmd CursorHold * lua vim.lsp.buf.document_highlight()
autocmd CursorMoved * lua vim.lsp.buf.clear_references()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant