sveltejs / language-tools

The Svelte Language Server, and official extensions which use it
MIT License
1.26k stars 200 forks source link

Readme file in language server package misses instructions on how to run the language server #1247

Open peshoicov opened 3 years ago

peshoicov commented 3 years ago

I have installed coc-svelte - which should use this language server. However - I don't know how to run this language server so that coc-svelte uses it.

The result is that I have some highlighting but no real intellisense.

Furthermore - I get very often this error which heavily disrupts the dev experience:

Error detected while processing function <lambda>10[1]..<SNR>60_execute

which started happening after I installed coc-vim. Thus - I think it's because of the missing language server.

dummdidumm commented 3 years ago

To me this sounds like a usage question specific to coc-svelte, so I suggest to ask at https://github.com/coc-extensions/coc-svelte how to set this up. I don't know how much sense additional docs make in our README since it probably highly depends on the environment you use the language server in.

peshoicov commented 3 years ago

@dummdidumm - thank you for your reply.

But I think the ticket I opened is valid. Cause at the end of the day - I have no idea what should I do when I clone this repo?

...

For example - should I run a command in a terminal, which will start this language server, and from there the coc-svelte will use it automatically when I run vim? ... And if so - what command should I use? Or - should I run some command inside the language-server package that will install it? ... And from there on it'll be available A) system wide or B) in some other way? Or - should I pass this directory - or the language-server package directory - to the coc-svelte so that it uses it? Or probably I should build it, and the get the final output - binary, JS file, etc - ... and even then - what should I do with it?

Do you get my idea? ... I don't have any idea what to do this repo at all - once I clone it. No idea how to use it.

The how can i use it section in the readme is too small and too ambiguous.

dummdidumm commented 3 years ago

As I said, these things depend highly on how coc-svelte functions, and I don't know how coc-svelte functions. If coc-svelte says "I work with the language server" I would expect coc-svelte to instruct me how to set it up. All we could add to our README is "it is possible to run the language-server by running svelte-language-server/bin/server.js with node" (see #1111) - but we can't tell you how to connect these things with the client you are using.

sullyj3 commented 2 years ago

All we could add to our README is "it is possible to run the language-server by running svelte-language-server/bin/server.js with node" (see https://github.com/sveltejs/language-tools/issues/1111) - but we can't tell you how to connect these things with the client you are using.

Imo this should be added, because it's not at all obvious. Clearly setting up an LSP will be highly editor specific, but most editor specific methods are at some point going to involve putting the command that starts the svelte language server into a config file somewhere, and it's difficult to do that if you don't know what the command is.

As a non user of vs-code, seeing:

## How can I use it?

Install a plugin for your editor:

-   [VS Code](../svelte-vscode)

with no further elaboration is a little frustrating.

Edit: having googled some more, I've discovered this can be installed with npm! Also very non obvious, at least to me!

Without wanting to put words into anyone's mouth, my hunch is that there's an assumption that anyone who's used language servers at all before would be familiar with this. However all the language servers I've encountered so far have been self contained binaries to be placed in PATH.

jasonlyu123 commented 2 years ago

What is your use case? We probably also need to know what the target audience for this documentation is. There are already a lot of editor plugins so it might be rare for you to manually run it.

sullyj3 commented 2 years ago

I'm using neovim + lspconfig. On reflection, I probably should've checked there first, as it's documented. Apologies.

davidhaley commented 1 year ago

I'm using neovim + lspconfig. On reflection, I probably should've checked there first, as it's documented. Apologies.

I was looking for the same information (for setting up Eglot to use svelte-language-server in web-mode). The --stdio flag is what I was missing. Thank you.