feat: add fuzzy file reference autocomplete in editor#282
Conversation
Update editor.js to support @./ file reference completions: - Expand trigger regex to include path characters (. / -) - Use textEdit.newText from LSP for proper snippet insertion - Add validFor pattern to keep completion open during path typing - Map FILE completion kind for recipe references Bump cooklang-language-server to 0.2.1 which adds fuzzy matching for recipe file references.
PR Review: feat: add fuzzy file reference autocomplete in editorOverall this is a clean, focused change. The implementation is straightforward and the commit messages are well-written. A few items worth discussing: Bug: Regex escape issue in trigger patternFile: const match = textBefore.match(/[@#~]([a-zA-Z0-9_.\\/\-]*)$/);Inside a character class const match = textBefore.match(/[@#~]([a-zA-Z0-9_./\-]*)$/);Inconsistency:
|
Remove unnecessary backslash escapes from character classes and drop the inconsistent space from validFor pattern.
Code ReviewOverall this is a clean, focused change that correctly implements fuzzy file reference autocomplete. The scope is tight and the logic is sound. A few things worth discussing: Potential Bug:
|
Summary
@./file reference autocomplete in the web editor by expanding the trigger regex to include path characterstextEdit.newTextfor proper snippet insertion of recipe referencesvalidForpattern so CodeMirror keeps the completion popup open while typing path characters, using its built-in fuzzy matchercooklang-language-serverto 0.2.1 which adds server-side fuzzy matching for recipe file referencesTest plan
@./and verify the autocomplete dropdown shows all recipe files@./pan) and verify results narrow down with fuzzy matching{}brackets