diff options
author | Ruin0x11 <ipickering2@gmail.com> | 2020-05-25 19:16:45 -0700 |
---|---|---|
committer | Ruin0x11 <ipickering2@gmail.com> | 2020-05-25 19:25:36 -0700 |
commit | 9dc816f99f4a4329a3daff55a7199a8265a00c2c (patch) | |
tree | d400a9cb6f1a897913ff9fe56d7d0e83c45c078b /script/workspace.lua | |
parent | 0583236680b16588c52c7c98ac5a3f8a7071b868 (diff) | |
download | lua-language-server-9dc816f99f4a4329a3daff55a7199a8265a00c2c.zip |
Support multiple workspace folders
Diffstat (limited to 'script/workspace.lua')
-rw-r--r-- | script/workspace.lua | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/script/workspace.lua b/script/workspace.lua index f9b243ad..8d869d9a 100644 --- a/script/workspace.lua +++ b/script/workspace.lua @@ -42,6 +42,7 @@ local function similarity(a, b) return #ta end +--- @class Workspace local mt = {} mt.__index = mt @@ -60,9 +61,9 @@ function mt:listenLoadFile() local uri = uric.encode(path) self.files[name] = uri if mode == 'workspace' then - self.lsp:readText(uri, path, buf, self._currentScanCompiled) + self.lsp:readText(self, uri, path, buf, self._currentScanCompiled) elseif mode == 'library' then - self.lsp:readLibrary(uri, path, buf, self._currentScanCompiled) + self.lsp:readLibrary(self, uri, path, buf, self._currentScanCompiled) else error('Unknown mode:' .. tostring(mode)) end @@ -221,7 +222,7 @@ function mt:addFile(path) local name = getFileName(path) local uri = uric.encode(path) self.files[name] = uri - self.lsp:readText(uri, path) + self.lsp:readText(self, uri, path) end function mt:removeFile(path) @@ -368,6 +369,8 @@ function mt:convertPathAsRequire(filename, start) return list end +--- @param baseUri uri +--- @param input string function mt:matchPath(baseUri, input) local first = input:match '^[^%.]+' if not first then @@ -502,6 +505,9 @@ function mt:absolutePathByUri(uri) return fs.absolute(path) end +--- @param lsp LSP +--- @param name string +--- @return Workspace return function (lsp, name) local workspace = setmetatable({ lsp = lsp, |