1

Today I have been setting up neovim on windows 11 (not WSL). I can't get the lsp servers to work. The issue is that nvim isn't loading the projects root tsconfig.json or eslintrc.json file for any file in a subdirectory of the project. I open nvim in the project directory. VSCode lints and parses all files in subdirectories correctly, so the tsconfig and eslintrc files are fine.

Here is a minimal config that fails:

return require('packer').startup(function(use)
    -- Packer can manage itself
    use 'wbthomason/packer.nvim'
    use 'neovim/nvim-lspconfig'
end)
require'lspconfig'.eslint.setup{}

For every file inside a subdirectory of the project I see this error - error message path will change depending on file path. E.g the file c:\dev\project\src\subdir\file.ts will come with this error:

Parsing error: Cannot read file 'c:\dev\project\src\subdir\tsconfig.json'

In addition to any errors that I shouldn't be seeing based on eslint config. A file created inside the project root directory gets correctly parsed. It looks like the lsp servers are trying to locate config files in the same directory as the file I have open instead of the project directory.

Here is the structure of the project is and it's located at C:/dev/project

src/
├─ testfile2.ts -- this one fails to parse according to configs
tsconfig.json
.eslintrc.json
testfile.ts -- this one parses correctly

This is my :LspInfo screen

 Language client log: C:\Users\Mark\AppData\Local\nvim-data\lsp.log
 Detected filetype:   typescript

1 client(s) attached to this buffer:

Client: eslint (id: 1, bufnr: [4]) filetypes: javascript, javascriptreact, javascript.jsx, typescript, typescriptreact, typescript.tsx, vue, svelte, astro autostart: true root directory: C:/dev/chat-room/ui cmd: cmd.exe /C vscode-eslint-language-server --stdio

Configured servers list: eslint

Thanks in advance!!

Edit I am fairly certain the issue is related to Windows. The exact same minimal config works without issues on WSL2. Sadly, I need to use Windows for my workflow.

Gehaktmolen
  • 111
  • 4
  • Try How to debug my vimrc with the specific idea that you may need to configure your LSP to find the configuration file correctly. FWIW, I doubt most will sift through your config link looking for the issue, so if you can post the minimal configuration necessary to demonstrate the issue that would go a long way towards getting an answer. – D. Ben Knoble Mar 21 '23 at 13:29
  • 1
    That is a fair point. I did expect I may need to have configured something but I'm struggling to find much documentation on the eslint server. I have added a minimal config that fails. See https://github.com/markr90/minimal_config . It consists of only eslint lsp setup. I'll have a look at debugging vimrc. – Gehaktmolen Mar 21 '23 at 22:02
  • 1
    The minimal config is short: plenty short enough to fit in-line. Please [edit] and include it directly so the question stands on its own. PS you should be able to put it all in one file, since it's just a packer require + eslint setup. – D. Ben Knoble Mar 22 '23 at 13:34

0 Answers0