summaryrefslogtreecommitdiff
path: root/script/core/view/psi-select.lua
diff options
context:
space:
mode:
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