fix(lsp): resolve wikilinks that include the .wiki file extension

`[[page.wiki]]` should resolve identically to `[[page]]`. The index
keyed by stem, so links with the explicit extension fell through to
the broken-link diagnostic and to-page navigation failed. Strip the
configured extension before every page lookup (resolve, definition,
backlinks, classify_link, classify_outgoing) and stop appending the
extension in synthesise_page_uri when it's already present.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-26 22:00:03 -03:00
parent 6ae642dbee
commit 2aec51274e
4 changed files with 69 additions and 16 deletions
+4 -2
View File
@@ -166,7 +166,8 @@ pub fn classify_link(
match link.target.kind {
LinkKind::Wiki => {
let path = link.target.path.as_deref()?;
let page = index.page_by_name(path);
let normalized = index.strip_link_extension(path);
let page = index.page_by_name(normalized);
match page {
None => Some(BrokenLinkKind::MissingPage(path.to_string())),
Some(page) => {
@@ -227,7 +228,8 @@ pub fn classify_outgoing(
match link.kind {
LinkKind::Wiki => {
let path = link.target_page.as_deref()?;
match index.page_by_name(path) {
let normalized = index.strip_link_extension(path);
match index.page_by_name(normalized) {
None => Some(BrokenLinkKind::MissingPage(path.to_string())),
Some(page) => {
if let Some(anchor) = &link.anchor {