Small Open improvements

This commit is contained in:
Krzosa Karol
2024-08-04 14:49:02 +02:00
parent e3c1bcb56e
commit 7fc071154f
6 changed files with 58 additions and 18 deletions

View File

@@ -315,9 +315,26 @@ function GenericTextFileRule(_s)
return {kind = "text", file_path = file_path, line = line, col = col}
end
Rules = {}
Rules[#Rules + 1] = GenericTextFileRule
-- Rules[#Rules + 2] = RuleFindExistingBuffer
function MatchAgainstIncludes(s)
line, col, s = ExtractLineAndColumn(s)
include_paths = {
"C:/Work/text_editor/src",
"C:/Work/text_editor/src/text_editor",
}
for i = 1,#include_paths do
file_path = include_paths[i] .. '/' .. s
if FileExists(file_path) then
return {kind = "text", file_path = file_path, line = line, col = col}
end
end
return nil
end
Rules = {
GenericTextFileRule,
MatchAgainstIncludes,
}
function ApplyRules(s)
for i = #Rules,1,-1 do