diff --git a/src/NoteWorkspace.ts b/src/NoteWorkspace.ts index 70c2b63..d89c952 100644 --- a/src/NoteWorkspace.ts +++ b/src/NoteWorkspace.ts @@ -68,7 +68,7 @@ export class NoteWorkspace { // This will allow us to potentially expose these as settings. static _rxTagNoAnchors = '\\#[\\w\\-\\_]+'; // used to match tags that appear within lines static _rxTagWithAnchors = '^\\#[\\w\\-\\_]+$'; // used to match entire words - static _rxWikiLink = '\\[\\[[^sep\\]]+(sep[^sep\\]]+)?\\]\\]'; // [[wiki-link-regex(|with potential pipe)?]] Note: "sep" will be replaced with pipedWikiLinksSeparator on compile + static _rxWikiLink = '\\[\\[[^sep\\]]*(sep[^sep\\]]*)?\\]\\]'; // [[wiki-link-regex(|with potential pipe)?]] Note: "sep" will be replaced with pipedWikiLinksSeparator on compile static _rxTitle = '(?<=^( {0,3}#[^\\S\\r\\n]+)).+'; static _rxMarkdownWordPattern = '([\\_\\w\\#\\.\\/\\\\]+)'; // had to add [".", "/", "\"] to get relative path completion working and ["#"] to get tag completion working static _rxFileExtensions = '\\.(md|markdown|mdx|fountain)$'; diff --git a/src/Ref.ts b/src/Ref.ts index 0d111e0..562f23b 100644 --- a/src/Ref.ts +++ b/src/Ref.ts @@ -1,4 +1,4 @@ -/* +/* A `Ref` is a match for: - a [[wiki-link]] @@ -80,17 +80,16 @@ export function getRefAt(document: vscode.TextDocument, position: vscode.Positio // keep the end let r = new vscode.Range(s, e); ref = document.getText(r); - if (ref) { - // Check for piped wiki-links - ref = NoteWorkspace.cleanPipedWikiLink(ref); - return { - type: RefType.WikiLink, - word: ref, // .replace(/^\[+/, ''), - hasExtension: refHasExtension(ref), - range: r, // range, - }; - } + // Check for piped wiki-links + ref = NoteWorkspace.cleanPipedWikiLink(ref); + + return { + type: RefType.WikiLink, + word: ref, // .replace(/^\[+/, ''), + hasExtension: refHasExtension(ref), + range: r, // range, + }; } return NULL_REF;