sublimelsp / LSP-volar

Vue support for Sublime's LSP plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Disabiling and enabling the package will throw an error.

predragnikolic opened this issue · comments

Packgage Control: Disable Package
Packgage Control: Enable Package
no longer work after the introduction of multiserver support 🙈

Disabling the package will throw an error:

Unable to start subprocess for LSP-volar(HTML Server)
Traceback (most recent call last):
  File "/home/predragnikolic/.config/sublime-text/Packages/LSP/plugin/core/windows.py", line 247, in start_async
    if plugin_class.needs_update_or_installation():
  File "/home/predragnikolic/.config/sublime-text/Packages/lsp_utils/st3/lsp_utils/_client_handler/abstract_plugin.py", line 102, in needs_update_or_installation
    return bool(server and server.needs_installation())
  File "/home/predragnikolic/.config/sublime-text/Packages/lsp_utils/st3/lsp_utils/server_npm_resource.py", line 81, in needs_installation
    raise Exception('Missing required "package.json" in {}'.format(self._server_src))
Exception: Missing required "package.json" in Packages/LSP-volar/server/

There are 2 cases from this point.

  1. Trying to immediately enable the server will throw:
    Unable to start subprocess for LSP-volar
Traceback (most recent call last):
  File "/home/predragnikolic/.config/sublime-text/Packages/LSP/plugin/core/windows.py", line 253, in start_async
    cannot_start_reason = plugin_class.can_start(self._window, initiating_view, workspace_folders, config)
  File "/home/predragnikolic/.config/sublime-text/Packages/lsp_utils/st3/lsp_utils/npm_client_handler.py", line 110, in can_start
    reason = super().can_start(window, initiating_view, workspace_folders, configuration)
  File "/home/predragnikolic/.config/sublime-text/Packages/lsp_utils/st3/lsp_utils/_client_handler/abstract_plugin.py", line 120, in can_start
    message = cls.is_allowed_to_start(window, initiating_view, workspace_folders, configuration)
  File "/home/predragnikolic/.config/sublime-text/Installed Packages/LSP-volar.sublime-package/plugin.py", line 70, in is_allowed_to_start
    typescript_path = LspVolarPlugin.find_typescript_path(workspace_folders[0].path)
  File "/home/predragnikolic/.config/sublime-text/Installed Packages/LSP-volar.sublime-package/plugin.py", line 85, in find_typescript_path
    workspace_ts_path = subprocess.check_output(find_ts_server_command, universal_newlines=True, startupinfo=startupinfo)
  File "./python3.3/subprocess.py", line 576, in check_output
  File "./python3.3/subprocess.py", line 819, in __init__
  File "./python3.3/subprocess.py", line 1448, in _execute_child
PermissionError: [Errno 13] Permission denied
  1. Trying to close ST, and open it, and than enable the server will result in enabling only LSP-volar and not LSP-volar(HTML Server), but I expect LSP-volar(HTML Server) also to be started. There is a mesage in ST status bar, that LSP-volar(HTML Server) wasn't enabled.

I tired to debug this and to experiment with the code to fix Exception: Missing required "package.json" in Packages/LSP-volar/server/
because LspVolarPlugin.cleanup() will delete the folder in the Package Storage dir.
So I just tired this dirty solution to not delete the folder, but that still didn't fixed the issue, the same message appeared.

class LspVolarPlugin(NpmClientHandler):
    # ...

    # override cleanup to not delete the folder
    @classmethod
    def cleanup(cls) -> None:
        return None

Expected behavior:
When running Packgage Control: Disable Package I expect LSP-volar, LSP-volar(HTML Server) and LSP(Second Server)(if enabled with volar.vueserver.useSecondServer) to shut down, with no errors.

When running Packgage Control: Enable Package I expect LSP-volar, LSP-volar(HTML Server) and LSP(Second Server)(if enabled with volar.vueserver.useSecondServer) to start.

Other options that I considered

If there is not a nice way to fix this, I will simply remove the multi-server support for now.

for now I removed the multi server feature bb0ec95 from master

created a separate branch, with the bug, once when fixed will be merged back to master again.
https://github.com/sublimelsp/LSP-volar/tree/fix/make-multi-server-work-with-enable-disable-package

Pausing this topic.
Volar changed the way it starts multi-server, so I deleted the branch.
Maybe I will revisit multi-server support.
But maybe volar will implement that feature on the server so that clients do not have to reimplement that.