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

Support for editors other than VSCode #96

Closed
Ailrun opened this issue Aug 19, 2021 · 4 comments
Closed

Support for editors other than VSCode #96

Ailrun opened this issue Aug 19, 2021 · 4 comments
Labels
1-feature-request ✨ Issue type: Request for a desirable, nice-to-have feature 3-no-action Issue resolution: No action taken (e.g., question has been answered, issue has been withdrawn)

Comments

@Ailrun
Copy link

Ailrun commented Aug 19, 2021

Is your feature request related to a problem? Please describe.
Currently, code actions like Add "..." to dictionary or Disable rule work only in VSCode, as their behavior depends on VSCode setting modification. It will be nicer if it can delegate the responsibility of modifying the setting to clients so that those actions work with other editors, e.g., Emacs.

Describe the solution you'd like
Delegating the responsibility of modifying the setting to clients if possible. (Though this requires some client update too)

Describe alternatives you've considered

Additional context
I'm using LSP-mode on Emacs with lsp-ltex.

@Ailrun Ailrun added the 1-feature-request ✨ Issue type: Request for a desirable, nice-to-have feature label Aug 19, 2021
@valentjn
Copy link
Owner

valentjn commented Aug 19, 2021

The language client is already responsible to perform the necessary configuration changes, like the README says:

Some commands are handled by LTEX LS, while others must be handled by the language client. This is in contrast to the LSP specification, which recommends that the server handles all commands. However, handling of some commands by the client is necessary as these commands change the client configuration, which the LSP does not allow server-side.

For example, the documentation for _ltex.addToDictionary (the command behind Add '...' to dictionary) says:

_ltex.addToDictionary is executed by the client when it should add words to the dictionary by adding them to ltex.dictionary.

It works like this: First, the language client requests code actions from the server. If there's an unknown word, then a code action with kind quickfix.ltex.addToDictionary will be returned by LTEX LS. That code action contains the command _ltex.addToDictionary and its necessary parameters (as documented). If the user runs the code action, the language client has to implement the command _ltex.addToDictionary and do what LTEX LS expects it to do according to the docs.

In the case of VS Code, the language client vscode-ltex implements these commands, not the editor (VS Code) itself. If the language client you use doesn't implement the commands, then this is a problem of the language client and not of LTEX LS.

There's also the custom request ltex/workspaceSpecificConfiguration, which takes precedence over the configuration returned by workspace/configuration. It allows to implement file-based dictionaries, so that the “normal” configuration (whatever format the editor is using; in the case of VS Code, it's settings.json) doesn't get too cluttered.

@Ailrun
Copy link
Author

Ailrun commented Aug 19, 2021

Oh I was confused since the documentation mentions ltex.dictionary, which has a link to VSCode specific setting. OK, I will check lsp-ltex side to make this work. Thank you for the answer.

Maybe it's worthwhile to update README to make it less confusing? What do you think?

@valentjn
Copy link
Owner

the documentation mentions ltex.dictionary, which has a link to VSCode specific setting

Again, I'm not sure what you mean. The documentation of _ltex.addToDictionary links to ltex.dictionary, but the docs of ltex.dictionary don't say anywhere that's a VS-Code-specific setting, because it isn't. Only the parts about multi-scope settings and external files are tagged as client-specific, as clearly marked with the striped line. That's because multi-scope settings and external files are implemented by the language client. Those are “bonus features” of vscode-ltex, if you will.

However, this has to be separated from the fact that _ltex.addToDictionary has to be implemented by the client. If it doesn't, then that command obviously won't work at all. IMO, the README is pretty clear about that.

I'm not sure how to make the available info any clearer. What would your proposal look like?

@Ailrun
Copy link
Author

Ailrun commented Aug 20, 2021

Oh sorry. It was indeed my misunderstanding. Thank you for your patience on my non-sense. I will close this issue.

@Ailrun Ailrun closed this as completed Aug 20, 2021
@valentjn valentjn added the 3-no-action Issue resolution: No action taken (e.g., question has been answered, issue has been withdrawn) label Sep 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1-feature-request ✨ Issue type: Request for a desirable, nice-to-have feature 3-no-action Issue resolution: No action taken (e.g., question has been answered, issue has been withdrawn)
Projects
None yet
Development

No branches or pull requests

2 participants