summaryrefslogtreecommitdiff
path: root/script/method
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-09-28 16:19:03 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-09-28 16:19:03 +0800
commit1ce91bc1715601abc63404cd6e9e7f04b36d3aa7 (patch)
tree364104f32de48def773f96ce05bf0a64134202bd /script/method
parent8c35c44a9b25f104430936cb68f4daece468ec8a (diff)
downloadlua-language-server-1ce91bc1715601abc63404cd6e9e7f04b36d3aa7.zip
由客户端实现多工作目录支持
Diffstat (limited to 'script/method')
-rw-r--r--script/method/initialize.lua8
-rw-r--r--script/method/workspace/executeCommand.lua2
2 files changed, 6 insertions, 4 deletions
diff --git a/script/method/initialize.lua b/script/method/initialize.lua
index d11ed5e6..fe2888c8 100644
--- a/script/method/initialize.lua
+++ b/script/method/initialize.lua
@@ -2,6 +2,7 @@ local workspace = require 'workspace'
local nonil = require 'without-check-nil'
local client = require 'client'
local json = require 'json'
+local sp = require 'bee.subprocess'
local function allWords()
local str = [[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.:('"[,#*@| ]]
@@ -20,10 +21,11 @@ return function (lsp, params)
lsp.client = params
client.init(params)
log.info(table.dump(params))
+ log.debug('ProcessID', sp.get_id())
if params.workspaceFolders and params.workspaceFolders ~= json.null then
for _, folder in ipairs(params.workspaceFolders) do
- lsp:addWorkspace(folder.name, folder.uri)
+ --lsp:addWorkspace(folder.name, folder.uri)
end
elseif params.rootUri and params.rootUri ~= json.null then
lsp:addWorkspace('root', params.rootUri)
@@ -61,8 +63,8 @@ return function (lsp, params)
},
executeCommandProvider = {
commands = {
- 'lua.removeSpace',
- 'lua.solve',
+ 'lua.removeSpace:' .. sp.get_id(),
+ 'lua.solve:' .. sp.get_id(),
},
},
}
diff --git a/script/method/workspace/executeCommand.lua b/script/method/workspace/executeCommand.lua
index 57ca281d..2ad449e9 100644
--- a/script/method/workspace/executeCommand.lua
+++ b/script/method/workspace/executeCommand.lua
@@ -173,7 +173,7 @@ end
--- @param lsp LSP
--- @param params table
return function (lsp, params)
- local name = params.command
+ local name = params.command:gsub(':.+', '')
if not command[name] then
return
end