From df592f17c0537a3e04830bab6985ae8f4801eb94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D1=80=D0=B5=D0=B4=D1=80=D0=B0=D0=B3=20=D0=9D=D0=B8?= =?UTF-8?q?=D0=BA=D0=BE=D0=BB=D0=B8=D1=9B?= Date: Mon, 17 Feb 2025 14:26:29 +0100 Subject: [PATCH 1/2] support vue hybrid mode --- plugin.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/plugin.py b/plugin.py index 4f59f14..76921fd 100644 --- a/plugin.py +++ b/plugin.py @@ -1,8 +1,8 @@ from __future__ import annotations from LSP.plugin import ClientConfig from LSP.plugin import WorkspaceFolder -from LSP.plugin.core.typing import Any, Callable, List, Optional, Mapping from LSP.plugin.core.protocol import Location +from LSP.plugin.core.typing import Any, Callable, List, Optional, Mapping from LSP.plugin.locationpicker import LocationPicker from lsp_utils import NpmClientHandler import os @@ -45,6 +45,28 @@ def is_allowed_to_start( return 'Could not resolve location of TypeScript package' configuration.init_options.set('typescript.tsdk', typescript_lib_path) + @classmethod + def on_pre_start( + cls, + window: sublime.Window, + initiating_view: sublime.View, + workspace_folders: list[WorkspaceFolder], + configuration: ClientConfig, + ) -> str | None: + cls._support_vue_hybrid_mode(configuration) + + @classmethod + def _support_vue_hybrid_mode(cls, configuration: ClientConfig) -> None: + vue_hybrid_mode = bool(configuration.init_options.get('vue.hybridMode')) + if not vue_hybrid_mode: + return + configuration.disabled_capabilities.update({ + "definitionProvider": True, + "referencesProvider": True, + "typeDefinitionProvider": True, + }) + configuration.priority_selector = "text.html.vue source.js, text.html.vue source.ts" + @classmethod def find_typescript_lib_path(cls, workspace_folder: str) -> Optional[str]: module_paths = [ From 5f4f3da4b896af2ca2ef5745821f90f651a5a1c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D1=80=D0=B5=D0=B4=D1=80=D0=B0=D0=B3=20=D0=9D=D0=B8?= =?UTF-8?q?=D0=BA=D0=BE=D0=BB=D0=B8=D1=9B?= Date: Mon, 17 Feb 2025 14:45:50 +0100 Subject: [PATCH 2/2] update comment --- LSP-vue.sublime-settings | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LSP-vue.sublime-settings b/LSP-vue.sublime-settings index 11252ce..ecbd3db 100644 --- a/LSP-vue.sublime-settings +++ b/LSP-vue.sublime-settings @@ -1,9 +1,9 @@ { "initializationOptions": { - // DON'T use this option until known issues are ironed out - https://github.com/sublimelsp/LSP-vue/issues/130. // When `true`, the Vue Language Server handles the CSS/HTML sections and partially the SCRIPT section but for // the JS/TS-specific functionality it relies on the `LSP-typescript` server with `@vue/typescript-plugin` TS // plugin enabled. When set to `false`, the Vue Language Server handles everything itself. + // Changing "vue.hybridMode" requires a restart of Sublime Text "vue.hybridMode": false, }, "settings": {