From 1ce91bc1715601abc63404cd6e9e7f04b36d3aa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Mon, 28 Sep 2020 16:19:03 +0800 Subject: =?UTF-8?q?=E7=94=B1=E5=AE=A2=E6=88=B7=E7=AB=AF=E5=AE=9E=E7=8E=B0?= =?UTF-8?q?=E5=A4=9A=E5=B7=A5=E4=BD=9C=E7=9B=AE=E5=BD=95=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script/core/code_action.lua | 6 ++++-- script/method/initialize.lua | 8 +++++--- script/method/workspace/executeCommand.lua | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/script/core/code_action.lua b/script/core/code_action.lua index c9203f29..3e8f7582 100644 --- a/script/core/code_action.lua +++ b/script/core/code_action.lua @@ -1,5 +1,7 @@ local lang = require 'language' local library = require 'core.library' +local client = require 'client' +local sp = require 'bee.subprocess' local function disableDiagnostic(lsp, uri, data, callback) callback { @@ -124,7 +126,7 @@ local function solveTrailingSpace(lsp, uri, data, callback) kind = 'quickfix', command = { title = lang.script.COMMAND_REMOVE_SPACE, - command = 'lua.removeSpace', + command = 'lua.removeSpace:' .. sp:get_id(), arguments = { { uri = uri, @@ -160,7 +162,7 @@ local function solveAmbiguity1(lsp, uri, data, callback) kind = 'quickfix', command = { title = lang.script.COMMAND_ADD_BRACKETS, - command = 'lua.solve', + command = 'lua.solve:' .. sp:get_id(), arguments = { { name = 'ambiguity-1', 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 -- cgit v1.2.3