sublimelsp / LSP-typescript

TypeScript, JavaScript support for Sublime LSP plugin
MIT License
135 stars 11 forks source link

Support for extends in tsconfig #138

Closed Narretz closed 2 years ago

Narretz commented 2 years ago

I have tried the following setup:

My sublime project has two paths:

I have both a tsconfig in project/ and one in project/special. The latter extends the former.

LSP-typescript correctly starts two language servers.

However, the config for project/special doesn't seem to get extended from project/

Specifically, it can't resolve path aliases.

Could this be something that the plugin is failing to do correctly?

rchl commented 2 years ago

It's not really something that this package or the underlying language server handles itself. Its's the typescript (used by the language server).

That said, do you have those two projects added separately in the sidebar or only the project/ is in the sidebar?

Also, does the typescript itself is able to resolve aliases properly when you run npx tsc in project/special?

Narretz commented 2 years ago

Hi @rchl,

thanks for asking these questions, they helped me find the problem. I had named the tsconfig in server/ tsconfig.server.json, and with tsc I define --project to use it.

That means LSP-ts never used it. (probably didn't use any config file) Once I rename it to tsconfig.json, LSP-typescript correctly picks it up.

So renaming is not a big deal. I guess it would be a bit finicky to support --project per project folder.

rchl commented 2 years ago

typescript-langauge-server runs one instance of typescript so it's not possible to use different configurations per different directories (apart from what typescript does by itself by reading tsconfig.json files itself).