We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Example:
I figured this is because regex returns offsets in bytes, not runes. Below is my quick fix for that, seems to work in VSCode, didn't test in Neovim.
diff --git a/internal/adapter/lsp/document.go b/internal/adapter/lsp/document.go index bf32d4f..954d93e 100644 --- a/internal/adapter/lsp/document.go +++ b/internal/adapter/lsp/document.go @@ -176,6 +176,15 @@ func (d *document) DocumentLinkAt(pos protocol.Position) (*documentLink, error) return nil, nil } +func toRuneMatch(s string, i int) int { + res := 0 + for j, _ := range s { + if j >= i { break } + res += 1 + } + return res + } + // DocumentLinks returns all the internal and external links found in the // document. func (d *document) DocumentLinks() ([]documentLink, error) { @@ -217,13 +226,13 @@ func (d *document) DocumentLinks() ([]documentLink, error) { if decodedHref, err := url.PathUnescape(href); err == nil { href = decodedHref } - appendLink(href, match[0], match[1], false, false) + appendLink(href, toRuneMatch(line, match[0]), toRuneMatch(line, match[1]), false, false) } for _, match := range wikiLinkRegex.FindAllStringSubmatchIndex(line, -1) { href := line[match[2]:match[3]] hasTitle := match[4] != -1 - appendLink(href, match[0], match[1], hasTitle, true) + appendLink(href, toRuneMatch(line, match[0]), toRuneMatch(line, match[1]), hasTitle, true) } }
The text was updated successfully, but these errors were encountered:
@zkbpkp Thank you for spotting this issue! I opened the PR #238 (branch issue-235), would you mind double-checking before I merge it? Thanks
issue-235
Sorry, something went wrong.
@mickael-menu thank you for responding so quickly! Just checked #238, this fixes the issue for me 👍
Successfully merging a pull request may close this issue.
Example:
I figured this is because regex returns offsets in bytes, not runes. Below is my quick fix for that, seems to work in VSCode, didn't test in Neovim.
The text was updated successfully, but these errors were encountered: