feat: Support Line Column in file pickers (#2791)
This implements a experimental interface for allowing prompts like this `file.txt:3:4`. It is already enabled on default for `find_files` and `git_files`. Be wary of breaking changes for the interface if you plan to manually enable it.
This commit is contained in:
committed by
GitHub
parent
87e92ea31b
commit
0bf09d05ab
@@ -78,3 +78,48 @@ describe("is_uri", function()
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
describe("separates file path location", function()
|
||||
local suites = {
|
||||
{
|
||||
input = "file.txt:12:4",
|
||||
file = "file.txt",
|
||||
row = 12,
|
||||
col = 4,
|
||||
},
|
||||
{
|
||||
input = "file.txt:12",
|
||||
file = "file.txt",
|
||||
row = 12,
|
||||
col = 0,
|
||||
},
|
||||
{
|
||||
input = "file:12:4",
|
||||
file = "file",
|
||||
row = 12,
|
||||
col = 4,
|
||||
},
|
||||
{
|
||||
input = "file:12:",
|
||||
file = "file",
|
||||
row = 12,
|
||||
col = 0,
|
||||
},
|
||||
{
|
||||
input = "file:",
|
||||
file = "file",
|
||||
row = 0,
|
||||
col = 0,
|
||||
},
|
||||
}
|
||||
|
||||
for _, suite in ipairs(suites) do
|
||||
it("separtates file path for " .. suite.input, function()
|
||||
local file, row, col = utils.__separate_file_path_location(suite.input)
|
||||
|
||||
assert.are.equal(file, suite.file)
|
||||
assert.are.equal(row, suite.row)
|
||||
assert.are.equal(col, suite.col)
|
||||
end)
|
||||
end
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user