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

feat: support volar 1.0 #2181

Merged
merged 1 commit into from
Oct 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 4 additions & 5 deletions lua/lspconfig/server_configurations/volar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ local util = require 'lspconfig.util'

local function get_typescript_server_path(root_dir)
local project_root = util.find_node_modules_ancestor(root_dir)
return project_root and (util.path.join(project_root, 'node_modules', 'typescript', 'lib', 'tsserverlibrary.js'))
or ''
return project_root and (util.path.join(project_root, 'node_modules', 'typescript', 'lib')) or ''
end

-- https://github.com/johnsoncodehk/volar/blob/master/packages/shared/src/types.ts
local volar_init_options = {
typescript = {
serverPath = '',
tsdk = '',
},
languageFeatures = {
implementation = true,
Expand Down Expand Up @@ -63,9 +62,9 @@ return {
if
new_config.init_options
and new_config.init_options.typescript
and new_config.init_options.typescript.serverPath == ''
and new_config.init_options.typescript.tsdk == ''
then
new_config.init_options.typescript.serverPath = get_typescript_server_path(new_root_dir)
new_config.init_options.typescript.tsdk = get_typescript_server_path(new_root_dir)
end
end,
},
Expand Down