diff options
| -rw-r--r-- | init.lua | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -1250,7 +1250,10 @@ local function find_root_uri(ls, file_path) end local function ls_start(ls, init_options) - ls.fd = vis:communicate(ls.name, 'exec ' .. ls.cmd) + ls.fd = vis:communicate(ls.name, 'exec ' .. ls.conf.cmd) + + -- detect the workspace root + ls.rootUri = vis.win.file and find_root_uri(ls, vis.win.file.path) -- register the response handler vis.events.subscribe(vis.events.PROCESS_RESPONSE, function(name, event, code, msg) @@ -1280,7 +1283,7 @@ local function ls_start(ls, init_options) local params = { processId = vis_pid, clientInfo = {name = lspc.name, version = lspc.version}, - rootUri = (vis.win.file and find_root_uri(ls, vis.win.file.path)) or lspc.json.null, + rootUri = ls.rootUri or lspc.json.null, capabilities = lspc.client_capabilites, } @@ -1294,10 +1297,8 @@ end function LanguageServer.new(ls_conf) local ls = { name = ls_conf.name, - cmd = ls_conf.cmd, - settings = ls_conf.settings, - roots = ls_conf.roots, - formatting_options = ls_conf.formatting_options, + conf = ls_conf, + initialized = false, id = 0, inflight = {}, @@ -1605,7 +1606,7 @@ vis:command_register('lspc-format', function(argv, _, win) local params = { textDocument = {uri = path_to_uri(win.file.path)}, - options = ls.formatting_options, + options = ls.conf.formatting_options, } if params.options == nil then params.options = { |
