sublimelsp / LSP-vue

Vue support for Sublime's LSP plugin
MIT License
29 stars 3 forks source link

Implement hybrid mode support #130

Open rchl opened 2 weeks ago

rchl commented 2 weeks ago

vue.hybridMode is a mode where LSP-vue works together with LSP-typescript (with Vue Typescript plugin enabled) where each handles different functionality within the vue file.

vue.hybridMode is currently disabled and not recommended because:

rchl commented 2 weeks ago

A current blocker is related to making the Vue Typescript plugin easy to set up with LSP-typescript.

Setting up Vue Typescript plugin basically means adding a configuration like this in project settings:

    "settings": {
        "LSP": {
            "LSP-vue": {
                "initializationOptions": {
                    "vue.hybridMode": true
                }
            },
            "LSP-typescript": {
                "initializationOptions": {
                    "plugins": [
                        {
                            "languages": ["vue"],
                            "location": "/Users/rafal/Library/Caches/Sublime Text/Package Storage/LSP-vue/20.18.0/server/node_modules",
                            "name": "@vue/typescript-plugin",
                        }
                    ],
                },
            },
        }
    },

The problem is the path to the plugin which is not know up-front (it's only known once the LSP-vue is initialized and also it's not ideal that it includes the node version since it means that this setup will break and will have to be updated once node version is updated.

I'd rather define some variable that would provide path to the LSP-vue node_modules but as said before, it's not that straightforward since that path is not known until server is initialized.

I was thinking of maybe copying the vue typescript plugin to a different location but that doesn't sound that great either IMO.

rchl commented 2 weeks ago

For the record (if someone wants to use hybrid mode before it's officially supported), to fix some issues with requests prioritization, it's recommended to also set those when enabling hybrid mode:

{
    "settings": {
        "LSP": {
            "LSP-vue": {
                "initializationOptions": {
                    "vue.hybridMode": true,
                },
                // Preferred for handling requests in Vue files over LSP-typescript.
                "priority_selector": "text.html.vue source.js, text.html.vue source.ts",
                "disabled_capabilities": {
                    "definitionProvider": true,
                    "referencesProvider": true,
                    "typeDefinitionProvider": true,
                },
            }
        }
    },
}