-
Notifications
You must be signed in to change notification settings - Fork 13
Replace line-based parser with tokenizer and walker #22
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
Open
JesseHerrick
wants to merge
25
commits into
main
Choose a base branch
from
feat-tokenizer
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
03cc708
Fix parser: handle multi-line and edge case parsing
JesseHerrick 1ecda73
Handle more edge-cases
JesseHerrick cb03bb0
Replace line-based parser with tokenizer and walker
JesseHerrick 3bea731
Handle transitive use lookups using the tokenizer
JesseHerrick b1149a1
Rewrite LSP extraction functions to use tokenizer; fix delegate chain…
JesseHerrick e4dd9ae
Remove now-dead code
JesseHerrick 5dc449c
Fix Keyword.fetch! use scenario
JesseHerrick 7ede6cc
Fix off-by-one bug
JesseHerrick 694039a
Fix tokenizer scope and inline-def walking in LSP parsing
JesseHerrick a4e3595
Fix processModuleDef scope tracking for split-line do and inline do: …
JesseHerrick 0aa0f17
Fix infinite loop in multi-alias brace scanning on unexpected tokens
JesseHerrick 5c91c82
Merge remote-tracking branch 'origin/main' into feat-tokenizer
JesseHerrick 6d2686e
Fix `require` with `as:` not registering aliases for go-to-definition
JesseHerrick 55be4e8
Remove dead code: TokDo followed by TokColon check
JesseHerrick d4a6e2c
Fix tokenizer losing line count on escaped newlines in strings/heredocs
JesseHerrick 9eb3926
Tokenize all the things!
JesseHerrick 7b90104
Fix bugbot reported issues
JesseHerrick e7c0dfc
Refactor token-walk parsing with shared helpers
JesseHerrick 39ea46d
Fix moduledoc sigil parsing and attribute definition matching.
JesseHerrick 3eb476d
Fix no-paren call context misclassifying Elixir keywords.
JesseHerrick be7551a
Fix performance and quality issues
JesseHerrick 38959c3
Add regression tests for alias parsing edge cases
JesseHerrick ce1086b
Tighten alias-block and same-line alias/require regression tests
JesseHerrick 2547e12
Fix Bugbot issues: off-by-one loop, code duplication, and defprotocol…
JesseHerrick 24c125c
Even more bug fixes
JesseHerrick File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Token cache may not be invalidated on document update
High Severity
Three new fields (
tokens,tokSrc,lineStarts) were added to thecachedDocstruct, andGetTokens/GetTokensFulllazily populate them (checkingdoc.tokens == nil). However, theSet()method is not in the diff, meaning it was not updated. IfSet()mutates the existingcachedDocin-place (resetting onlytext,tree, andsrc), the stale token cache will persist, causing all token-based operations (hover, completion, go-to-definition, alias extraction) to use outdated tokens after a file edit. This would only be safe ifSet()replaces the entire*cachedDocpointer.Additional Locations (1)
internal/lsp/documents.go#L100-L114Reviewed by Cursor Bugbot for commit 24c125c. Configure here.