summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lua/99/geo.lua10
-rw-r--r--lua/99/init.lua3
-rw-r--r--scratch/refresh.lua17
3 files changed, 15 insertions, 15 deletions
diff --git a/lua/99/geo.lua b/lua/99/geo.lua
index af95e30..8028ef7 100644
--- a/lua/99/geo.lua
+++ b/lua/99/geo.lua
@@ -191,6 +191,16 @@ function Range:new(buffer, start, end_)
}, self)
end
+function Range:from_visual_selection()
+ local buffer = vim.api.nvim_get_current_buf()
+ local start_pos = vim.fn.getpos("'<")
+ local end_pos = vim.fn.getpos("'>")
+ local start = Point:new(start_pos[2], start_pos[3])
+ local end_ = Point:new(end_pos[2], end_pos[3])
+
+ return Range:new(buffer, start, end_)
+end
+
---@param node _99.treesitter.TSNode
---@param buffer number
---@return _99.Range
diff --git a/lua/99/init.lua b/lua/99/init.lua
index 847beca..85ea25b 100644
--- a/lua/99/init.lua
+++ b/lua/99/init.lua
@@ -95,6 +95,9 @@ function _99.fill_in_function()
ops.fill_in_function(_99_state)
end
+function _99.visual()
+end
+
--- View all the logs that are currently cached. Cached log count is determined
--- by _99.Logger.Options that are passed in.
function _99.view_log()
diff --git a/scratch/refresh.lua b/scratch/refresh.lua
index 680dd0b..24e864b 100644
--- a/scratch/refresh.lua
+++ b/scratch/refresh.lua
@@ -1,18 +1,5 @@
R("99")
-function test_function()
- return 42
-end
+local Range = require("99.geo").Range
-function test_empty() end
-
-function test_body()
- local ts = require("99.editor.treesitter")
- local Point = require("99.geo").Point
- local Lang = require("99.language")
- local cursor = Point:from_cursor()
- local func = ts.containing_function(0, cursor)
-
-end
-
-test_body()
+local selection = Range:from_visual_selection()