Fix parser: handle multi-line and edge case parsing#21
Fix parser: handle multi-line and edge case parsing#21JesseHerrick wants to merge 2 commits intomainfrom
Conversation
7645182 to
86c6500
Compare
86c6500 to
03cc708
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 03cc708. Configure here.
| } | ||
| // Any other statement means we've left the alias context | ||
| continue | ||
| } |
There was a problem hiding this comment.
Non-alias lines never break backward scan despite comment
Medium Severity
In ExtractAliasBlockParent, the backward scan at lines 204–211 has a comment saying "Any other statement means we've left the alias context" but the code just continues instead of returning ("", false). Both the blank-line branch and the non-blank non-alias branch do continue, so a non-alias statement (e.g., an import or assignment) between the alias block opener and the cursor won't stop the scan. The pre-check partially mitigates this for def/defp/defmodule, but other statements like import, require, or plain code won't break the backward scan, potentially causing a false positive match to an unrelated alias block further up.
Reviewed by Cursor Bugbot for commit 03cc708. Configure here.
| } | ||
|
|
||
| // looksLikeOptContinuation returns true if the trimmed line looks like a | ||
| // keyword list continuation (e.g. "name: \"foo\"", "permissions: :inherited"). |
There was a problem hiding this comment.
Stale dangling doc comment for removed function
Low Severity
There's an orphaned doc comment for looksLikeOptContinuation — a function that doesn't exist in this file. It appears the function was replaced by parser.LooksLikeKeywordOpt, but its doc comment was left behind as a floating comment block between ExtractUsesWithOpts and ParseKeywordModuleOpts.
Reviewed by Cursor Bugbot for commit 03cc708. Configure here.
|
Closing because #22 includes these changes but is a better fix. |


Fixes the issues raised in #19, but takes it a step further to fix all multi-line parsing issues. Also fixes issues with hover-docs and completions inside of a multi-line alias block.
Note
Medium Risk
Touches core parsing/indexing and LSP resolution paths (aliases/uses/hover/completion/definition), so regressions could affect navigation and symbol indexing across many files, though changes are well-covered by new regression tests.
Overview
Improves Elixir parsing robustness by joining continued lines and multi-line directives (backslash continuations, unclosed brackets, and trailing-comma
alias/use/import/requireforms) while preserving original line numbers, and adds stronger skipping of sigils/strings/interpolations/char literals to avoid false refs/defs and heredoc mis-detection.Enhances LSP behavior for multi-line alias brace blocks by detecting the parent module (
ExtractAliasBlockParent) and using it to resolve modules for hover/definition/references and to offer module-segment completions insidealias Parent.{ ... }; also avoids completions afterfunc()./var.where type info is unavailable. Adds support for parsing multi-lineuseopts, introduces a periodic background reindex, and bumpsIndexVersionto invalidate old indexes.Reviewed by Cursor Bugbot for commit 1ecda73. Bugbot is set up for automated code reviews on this repo. Configure here.