Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LSP-vue.sublime-settings
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
24 changes: 23 additions & 1 deletion plugin.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 = [
Expand Down