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

How to use with an LSP host other than vscode? #55

Open
beaugunderson opened this issue May 18, 2023 · 5 comments
Open

How to use with an LSP host other than vscode? #55

beaugunderson opened this issue May 18, 2023 · 5 comments

Comments

@beaugunderson
Copy link

Hi there, I'm using neovim with the typescript-language-server language server. How can I see my strict violations using this language server?

I use mason to manage my LSP configs, so the version installed gets installed by mason as:

/Users/beau/.local/share/nvim/mason/packages/typescript-language-server/node_modules/typescript/lib/tsserver.js

Anyone had luck getting this working in vim?

@KostkaBrukowa
Copy link
Collaborator

Hey I'm using nvim with typescript-language-server and mason and it works for me. If you've followed every step from readme it should work out of the box.

@beaugunderson
Copy link
Author

the only thing I've done differently is added a non-existent path as the paths array and used the @ts-strict comment instead so that my project is opt-in instead of opt-out... it works for tsc-strict but I get nothing in vim sadly

@KostkaBrukowa
Copy link
Collaborator

Could you share you vim config?

@beaugunderson
Copy link
Author

beaugunderson commented May 21, 2023

@KostkaBrukowa sure! here you go: https://gist.github.com/beaugunderson/7acffd22a8df616cba263655aaa6b6fe

and alternately, since yours is working, if you share yours I can see how it differs from my own :)

61091

12774

@kaiwah
Copy link

kaiwah commented Dec 14, 2023

Just fyi, I ran across this issue and took many hours of debugging but I realized it was due to a pathing issue for me.

Basically I had a few tsconfig.json scattered throughout my proj directory, that extends the main one in root.
But because the root directory for mason tsserver resolves to the nearest tsconfig... it ended up with the wrong root dir which mean't all the relative paths included in the plugin technically were incorrect.

i.e.

// main tsconfig.json in root
{
  "compilerOptions": {
    "plugins": [
      {
        "name": "typescript-strict-plugin",
        "paths": [
          "foo/bar/baz",
        ]
     }
   ]
 }
// tsconfig.json in foo/bar
{
  extends: "../../tsconfig.json"
}

Above setup causes:

tsserver root dir = root/foo/bar
and now the plugin path instead of being ./foo/bar/baz which I expected, ended up being root/foo/bar/foo/bar/baz which does not exist.

Thus the following worked for me:

  • Removing the other tsconfig's
  • Adding absolute paths for the plugin
  • Adding ./ path for the plugin

YMMV however

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

3 participants