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

Add LspWindowCommand #1988

Closed
jwortmann opened this issue Jul 5, 2022 · 0 comments · Fixed by #1991
Closed

Add LspWindowCommand #1988

jwortmann opened this issue Jul 5, 2022 · 0 comments · Fixed by #1991

Comments

@jwortmann
Copy link
Member

It would be good to have a LspWindowCommand, which is enabled when there is any active session with a certain name/capability in this window (i.e. attached to any existing view of the window).

An example use case is to show documentation provided by the language server in a separate tab as HtmlSheet (rendered minihtml). It might be desired to run a request to the server, when a link within the HtmlSheet is clicked, but this is not possible via a LspTextCommand, because a HtmlSheet is not a View.

I have an implementation for the Julia language server, currently with an ugly workaround to store a reference to the session in a global variable when a certain LspTextCommand is run. Later, this global variable is used from a normal sublime_plugin.WindowCommand to run the server request. This has several drawbacks:

  • The WindowCommand only works after the LspTextCommand has been invoked at least one time
  • By using a single global variable for the session, the WindowCommand is not actually bound to the particular window. It is also active for other, entirely unrelated windows, and also it would be problematic if there exist multiple sessions of the language server at the same time.
  • There is no way to check if the session is still alive
rwols pushed a commit that referenced this issue Jul 6, 2022
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

Successfully merging a pull request may close this issue.

1 participant