sublimelsp / LSP-typescript

TypeScript, JavaScript support for Sublime LSP plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is it possible to get jQuery autocomplete globally?

todordvv opened this issue · comments

I just installed LSP-Typescript and it works out of the box for JavaScript autocompletion and suggestions. However I want to be able to use jQuery in my .js files and I would very much like it if I could somehow load the jQuery library on a global level (say from a C:/ path) and get full autocomplete. I am not always using project folders (for example when working on something directly via FTP and editing single files) so I definitely need an option that can use a global config file or such.

Any way to do this?

It's not really specific to this package and you should be able to pretty easily find on the Internet how to make your project aware of jQuery types if you search in context of Typescript.

You do typically want to open a project though as it's controlled by the projects tsconfig.json.

It's not really specific to this package and you should be able to pretty easily find on the Internet how to make your project aware of jQuery types if you search in context of Typescript.

You do typically want to open a project though as it's controlled by the projects tsconfig.json.

Thanks for the answer/guidance. I have been searching the whole day yesterday and again today - so it might be me being inept at this particular thing or it I just might now be hitting the right keywords but regardless any info would be immense.

If I include a script tag manually inside HTML and link it to a jQuery CDN it automatically loads up and the autocomplete is available then and there (thanks to LSP-typescript I presume).

But trying to find how to include it (in the background somewhere) when I haven't got a project loaded and I've just opened a JS file from FTP or from my desktop is where I'm stuck at.

Ideally in the User config somewhere I would include a URL to the jQuery js file and that would be it - I just can't find any documentation as to how to achieve this. I thought there might be an addon for LSP-typescript or maybe a config argument that would let me link to custom files to be loaded every time I'm editing a JS/TS file.

Thanks again!

Okay someone from LSP-html helped me out to figure out a few things regarding this because LSP-html works in autocompleting jQuery in script tags out of the box (it might be because I have jQuery installed in npm globally):

sublimelsp/LSP-html#40

So I guess my last question is, is it possible to have it detect the global npm config without having to type the "require(jQuery)" part in the file?