-
Notifications
You must be signed in to change notification settings - Fork 16
improved splitting: sort entries #59
improved splitting: sort entries #59
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job! You just forgot the nil check, it could throw an error.
lua/nvim-devdocs/build.lua
Outdated
end | ||
|
||
path_map[key] = tostring(count) | ||
file_path:write(markdown, "w") | ||
count = count + 1 | ||
end | ||
|
||
table.sort(index.entries, function(a, b) | ||
local index_a = sort_lookup[a.path] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
local index_a = sort_lookup[a.path] | |
local index_a = sort_lookup[a.path] or -1 |
lua/nvim-devdocs/build.lua
Outdated
end | ||
|
||
path_map[key] = tostring(count) | ||
file_path:write(markdown, "w") | ||
count = count + 1 | ||
end | ||
|
||
table.sort(index.entries, function(a, b) | ||
local index_a = sort_lookup[a.path] | ||
local index_b = sort_lookup[b.path] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
local index_b = sort_lookup[b.path] | |
local index_b = sort_lookup[b.path] or -1 |
lua/nvim-devdocs/operations.lua
Outdated
local split = vim.split(pattern, " ") | ||
local header = split[1] | ||
local top_header = header and header:sub(1, #header - 1) | ||
local next_pattern_lines = vim.split(next_pattern, "\n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
next_pattern
could be nil
lua/nvim-devdocs/operations.lua
Outdated
local header = split[1] | ||
local top_header = header and header:sub(1, #header - 1) | ||
local next_pattern_lines = vim.split(next_pattern, "\n") | ||
local next_search_pattern = create_pattern(next_pattern_lines[1]) -- only search the first line | ||
|
||
for _, line in ipairs(lines) do | ||
if found then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and
?
I now applied the review comments in a followup commit! |
Thanks! It's also backward compatible :) |
fixes #57
this seems to work well according to my testing.