Skip to content

Commit

Permalink
feat: support volar 1.0 (#2181)
Browse files Browse the repository at this point in the history
  • Loading branch information
adalessa authored Oct 9, 2022
1 parent 9d4b8d3 commit 87c8c7b
Showing 1 changed file with 4 additions and 5 deletions.
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

0 comments on commit 87c8c7b

Please sign in to comment.