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(lsp): ignore diagnostic check within code blocks #399

Merged
merged 10 commits into from
Apr 6, 2024
Prev Previous commit
Next Next commit
chore(lsp): cleanup commented out code, add new comment
  • Loading branch information
Rahlir committed Apr 2, 2024
commit 2bf9b5ddd073a533243563029f5b9befc1396ccc
29 changes: 1 addition & 28 deletions internal/adapter/lsp/document.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,41 +197,14 @@ func (d *document) DocumentLinkAt(pos protocol.Position) (*documentLink, error)
return nil, nil
}

// Recursive function to check whether a link is within inline code block.
Rahlir marked this conversation as resolved.
Show resolved Hide resolved
func linkWithinInlineCode(strBuffer string, linkStart, linkEnd int, insideInline bool) bool {
if backtickId := strings.Index(strBuffer, "`"); backtickId > 0 && backtickId < linkEnd {
Rahlir marked this conversation as resolved.
Show resolved Hide resolved
return linkWithinInlineCode(strBuffer[backtickId+1:],
linkStart-backtickId-1, linkEnd-backtickId-1, !insideInline)
} else {
return insideInline
}

// backtickStart += cursorPos
// if insideInline {
// if backtickStart >= end {
// return true
// }
// return linkWithinInlineCode(line[backtickStart+1:], start-backtickStart-1, end-backtickStart-1, false)
// } else if backtickStart < start {
// return linkWithinInlineCode(line[backtickStart+1:], start-backtickStart-1, end-backtickStart-1, !insideInline)
// }

// if backtickStart < start {
// backtickEnd := strings.Index(line[backtickStart+1:], "`")
// if backtickEnd >= 0 {
// backtickEnd += backtickStart + 1
// if backtickEnd >= end {
// return true
// } else {
// return linkWithinInlineCode(line[backtickEnd+1:], start-backtickEnd-1, end-backtickEnd-1, false)
// }
// } else {
// return true
// }
// }
// return false
//} else {
// return insideInline
//}
}

// DocumentLinks returns all the internal and external links found in the
Expand Down