From 18142ab126123c33a8aaa4cf77cc84f267271885 Mon Sep 17 00:00:00 2001 From: CppCXY <812125110@qq.com> Date: Wed, 28 Sep 2022 19:29:52 +0800 Subject: =?UTF-8?q?=E6=8F=90=E4=BA=A4psi=20viewer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script/provider/provider.lua | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'script/provider') 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 _ = 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 _ = 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 -- cgit v1.2.3