summaryrefslogtreecommitdiff
path: root/script/core/view/psi-select.lua
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/core/view/psi-select.lua
parentd9fe11277e76caa2bf38292efe2df68ec1d43d10 (diff)
downloadlua-language-server-18142ab126123c33a8aaa4cf77cc84f267271885.zip
提交psi viewer
Diffstat (limited to 'script/core/view/psi-select.lua')
-rw-r--r--script/core/view/psi-select.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/script/core/view/psi-select.lua b/script/core/view/psi-select.lua
new file mode 100644
index 00000000..b6733aa5
--- /dev/null
+++ b/script/core/view/psi-select.lua
@@ -0,0 +1,13 @@
+local files = require("files")
+local guide = require("parser.guide")
+local converter = require("proto.converter")
+
+return function(uri, position)
+ local state = files.getState(uri)
+ if not state then
+ return
+ end
+
+ local pos = converter.unpackPosition(uri, position)
+ return { data = guide.positionToOffset(state, pos) }
+end