-
Notifications
You must be signed in to change notification settings - Fork 9
Attach parser to qf buffer to let text highlight at real time #41
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
xzbdmw
wants to merge
16
commits into
stevearc:master
Choose a base branch
from
xzbdmw:treesitter
base: master
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
16 commits
Select commit
Hold shift + click to select a range
fe1f5f5
treesitter
xzbdmw 290be69
merge the same line
xzbdmw 3fe3881
fix: use BufWipeout instead of QuickFixCmdPost
xzbdmw c96d184
fix: type anotations
xzbdmw d80e9db
fix: make cache local
xzbdmw 70af197
also load highlight from buffer
xzbdmw 5e9ed34
fix: EM_QUAD doesn't need a space
stevearc 1eb986b
change number[][][] to Range4[][]
xzbdmw a23b3b0
do not register callback when config.highlight.max_lines exceeds
xzbdmw bbd2840
cache filetype for each bufnr
xzbdmw 9a7fa03
remove empty_regions
xzbdmw ab48e85
Revert "remove empty_regions"
xzbdmw a38c08a
caculate regions count early
xzbdmw 81ecc67
HACK: manually perform an edit after parsing
xzbdmw 532b66e
Revert "fix: EM_QUAD doesn't need a space"
xzbdmw 260bfa4
conceal spaces
xzbdmw 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
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.
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.
What is
empty_regionsfor?Uh oh!
There was an error while loading. Please reload this page.
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.
empty_regionsis used to to clear the included regions and make sure a reparse with clean state will happen afterRefresh, if you modify the saved file and callRefreshon qf the previous highlight are still there:iShot_2025-02-16_09.58.15.mp4
Uh oh!
There was an error while loading. Please reload this page.
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.
Edit: this doesn't work, we have to manually include an empty region, multiple call to
vim.treesitter.get_parserwith the same argument returns the same parser.If we want to support
max_linesoption, thenempty_regionis not needed, because lines are computed using regions, it complicates the logic of when should we register the callback (vim.treesitter.get_parser) and when should not (vim.treesitter.languagetree.new), now I'm just creating a new parser each time attach is called.