Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lysender/0a8e26ba01ac5c67adf50849d675306c to your computer and use it in GitHub Desktop.
Save lysender/0a8e26ba01ac5c67adf50849d675306c to your computer and use it in GitHub Desktop.
NeoVim + TypeScript LSP - auto import path incorrect - always starts at src

I am working on several projects with neovim with TypeScript LSP installed.

In some projects, the auto import correctly set the path using relative paths.

However, some projects always starts its import at src for some reason.

Tried to configure LSP to always use relative path but can't make it work.

Somehow, there is something in my project configuration that broke the LSP import.

Compared the tsconfig.json for two projects and found out that one of them has no "baseUrl" and the other has "baseUrl" set to "./".

I just removed "baseUrl" from the tsconfig compiler options and neovim is happily resolving the correct relative paths.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment