diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2025-01-26 22:26:53 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-11-30 10:18:47 +0100 |
| commit | 36c7ed2b678f352c9938da3188ad3f689cd1a7bb (patch) | |
| tree | b9fbcc52a55272a1a75dd4d70b502071cdaa0a67 | |
| parent | cb27da578ca75e651c033381d9d830f1d0db6e2f (diff) | |
| download | vis-lspc-36c7ed2b678f352c9938da3188ad3f689cd1a7bb.tar.gz vis-lspc-36c7ed2b678f352c9938da3188ad3f689cd1a7bb.zip | |
add language server configuration to its object table
| -rw-r--r-- | init.lua | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -1280,7 +1280,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) @@ -1310,7 +1313,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, } @@ -1324,10 +1327,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 = {}, @@ -1635,7 +1636,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 = { |
