Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for method documentation search #233

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions lua/scnvim/help.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ M.on_open = action.new(function(err, uri, pattern)
local is_open = vim.fn.win_gotoid(win_id) == 1
local expr = string.format('edit %s', uri)
if pattern then
expr = string.format('edit +/%s %s', pattern, uri)
local subject = vim.fn.fnamemodify(uri, ':t:r')
expr = string.format('edit +/^\\\\(%s\\\\)\\\\?%s %s', subject, pattern, uri)
end
if is_open then
vim.cmd(expr)
Expand Down Expand Up @@ -112,14 +113,12 @@ local function open_from_quickfix(index)
local item = list[index]
if item then
local uri = vim.fn.bufname(item.bufnr)
local subject = vim.fn.fnamemodify(uri, ':t:r')
if uv.fs_stat(uri) then
M.on_open(nil, uri, item.pattern)
M.on_open(nil, uri, item.text)
else
local cmd = string.format('SCNvim.getFileNameFromUri("%s")', uri)
sclang.eval(cmd, function(subject)
render_help_file(subject, function(result)
M.on_open(nil, result, item.pattern)
end)
render_help_file(subject, function(result)
M.on_open(nil, result, item.text)
end)
end
end
Expand Down Expand Up @@ -169,7 +168,6 @@ local function find_methods(name, target_dir)
table.insert(results, {
filename = destpath,
text = string.format('.%s', name),
pattern = string.format('^\\.%s', name),
davidgranstrom marked this conversation as resolved.
Show resolved Hide resolved
})
end
end
Expand Down
Loading