diff options
| author | git-bruh <prathamIN@proton.me> | 2024-04-08 00:43:44 +0530 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-01-09 20:08:06 +0100 |
| commit | 386ccd3213adc34ab9e56bb1b99160672771f064 (patch) | |
| tree | 6dae4c11356f77ac10acc421d1038b37482874e3 /init.lua | |
| parent | f486814e083431d6170fc644338e19220f7f81d5 (diff) | |
| download | vis-lspc-386ccd3213adc34ab9e56bb1b99160672771f064.tar.gz vis-lspc-386ccd3213adc34ab9e56bb1b99160672771f064.zip | |
*: pass rootUri
Diffstat (limited to 'init.lua')
| -rw-r--r-- | init.lua | 24 |
1 files changed, 23 insertions, 1 deletions
@@ -1228,6 +1228,27 @@ local function ls_shutdown(ls) ls:call_method('shutdown') end +local function get_root_path(ls, file_path) + local globs = '' + + if ls.roots then + for _, glob in ipairs(ls.roots) do + globs = globs .. glob .. '\n' + end + end + + globs = globs .. '.git\n.hg\n' + + local status, out = vis:pipe(globs, source_path .. '/tools/find-root "' .. file_path .. '"') + + if status ~= 0 then + return nil + end + + -- Skip trailing newline + return out:sub(1, #out - 1) +end + local function ls_start(ls, init_options) ls.fd = vis:communicate(ls.name, 'exec ' .. ls.cmd) @@ -1259,7 +1280,7 @@ local function ls_start(ls, init_options) local params = { processId = vis_pid, clientInfo = {name = lspc.name, version = lspc.version}, - rootUri = lspc.json.null, + rootUri = (vis.win.file and path_to_uri(get_root_path(ls, vis.win.file.path))) or lspc.json.null, capabilities = lspc.client_capabilites, } @@ -1281,6 +1302,7 @@ local function new_ls(ls_conf) inflight = {}, parser = parser.new(), capabilities = {}, + roots = ls_conf.roots, -- exported methods of a language server send_notification = ls_send_notification, |
