summaryrefslogtreecommitdiff
path: root/script/provider
diff options
context:
space:
mode:
authorCppCXY <812125110@qq.com>2022-09-28 19:29:52 +0800
committerCppCXY <812125110@qq.com>2022-09-28 19:29:52 +0800
commit18142ab126123c33a8aaa4cf77cc84f267271885 (patch)
treec6088b0b26f5cd83ce6a84fa7e83e55ae194b6f3 /script/provider
parentd9fe11277e76caa2bf38292efe2df68ec1d43d10 (diff)
downloadlua-language-server-18142ab126123c33a8aaa4cf77cc84f267271885.zip
提交psi viewer
Diffstat (limited to 'script/provider')
-rw-r--r--script/provider/provider.lua31
1 files changed, 31 insertions, 0 deletions
diff --git a/script/provider/provider.lua b/script/provider/provider.lua
index 823abae5..3ab5bb19 100644
--- a/script/provider/provider.lua
+++ b/script/provider/provider.lua
@@ -1400,6 +1400,37 @@ m.register '$/api/report' {
end
}
+m.register '$/psi/view' {
+ ---@async
+ function (params)
+ local uri = files.getRealUri(params.uri)
+ workspace.awaitReady(uri)
+ local _ <close> = progress.create(uri, lang.script.WINDOW_PROCESSING_TYPE_FORMATTING, 0.5)
+ if not files.exists(uri) then
+ return nil
+ end
+ local core = require 'core.view.psi-view'
+ local result = core(uri)
+ return result
+ end
+}
+
+m.register '$/psi/select' {
+ ---@async
+ function(params)
+ local uri = files.getRealUri(params.uri)
+ workspace.awaitReady(uri)
+ local _<close> = progress.create(uri, lang.script.WINDOW_PROCESSING_TYPE_FORMATTING, 0.5)
+ if not files.exists(uri) then
+ return nil
+ end
+ local core = require 'core.view.psi-select'
+ local result = core(uri, params.position)
+ return result
+ end
+}
+
+
local function refreshStatusBar()
local valid = config.get(nil, 'Lua.window.statusBar')
for _, scp in ipairs(workspace.folders) do