summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changelog.md2
-rw-r--r--script/core/command/autoRequire.lua1
-rw-r--r--script/provider/diagnostic.lua6
-rw-r--r--script/provider/provider.lua31
4 files changed, 10 insertions, 30 deletions
diff --git a/changelog.md b/changelog.md
index 473a9da6..b359cf85 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,6 +1,8 @@
# changelog
## 2.3.0
+* `NEW` `VSCode`: click the status bar icon to operate:
+ * run workspace diagnostics
* `FIX` `debug.getuservalue` and `debug.setuservalue` should not exist in `Lua 5.1`
## 2.2.3
diff --git a/script/core/command/autoRequire.lua b/script/core/command/autoRequire.lua
index 89dc4376..68de069d 100644
--- a/script/core/command/autoRequire.lua
+++ b/script/core/command/autoRequire.lua
@@ -37,7 +37,6 @@ local function findInsertOffset(uri)
end
local function askAutoRequire(visiblePaths)
- -- TODO: translate
local selects = {}
local nameMap = {}
for _, visible in ipairs(visiblePaths) do
diff --git a/script/provider/diagnostic.lua b/script/provider/diagnostic.lua
index 7ded406d..3575afbb 100644
--- a/script/provider/diagnostic.lua
+++ b/script/provider/diagnostic.lua
@@ -301,8 +301,8 @@ local function askForDisable()
end
end
-function m.diagnosticsAll()
- if not config.get 'Lua.diagnostics.enable' then
+function m.diagnosticsAll(force)
+ if not force and not config.get 'Lua.diagnostics.enable' then
m.clearAll()
return
end
@@ -310,7 +310,7 @@ function m.diagnosticsAll()
return
end
local delay = config.get 'Lua.diagnostics.workspaceDelay' / 1000
- if delay < 0 then
+ if not force and delay < 0 then
return
end
await.close 'diagnosticsAll'
diff --git a/script/provider/provider.lua b/script/provider/provider.lua
index ad00a5b5..dd8bcc15 100644
--- a/script/provider/provider.lua
+++ b/script/provider/provider.lua
@@ -795,38 +795,17 @@ proto.on('$/didChangeVisibleRanges', function (params)
end)
proto.on('$/status/click', function ()
- do return end
+ -- TODO: translate
local titleDiagnostic = '进行工作区诊断'
- local titleRestart = '重启语言服务'
- local result = proto.awaitRequest('window/showMessageRequest', {
- type = define.MessageType.Info,
- message = '点击',
- actions = {
- {
- title = titleDiagnostic,
- },
- {
- title = titleRestart,
- },
- },
+ local result = client.awaitRequestMessage('Info', 'xxx', {
+ titleDiagnostic,
})
if not result then
return
end
- if result.title == titleDiagnostic then
+ if result == titleDiagnostic then
local diagnostic = require 'provider.diagnostic'
- diagnostic.diagnosticsAll()
- proto.notify('window/showMessage', {
- type = define.MessageType.Info,
- message = '诊断完成',
- })
- end
- if result.title == titleRestart then
- proto.notify('$/command', {
- command = 'extension.lua.doc',
- data = 'en-us/51/manual.html',
- })
- --os.exit(true)
+ diagnostic.diagnosticsAll(true)
end
end)