Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

lsp: Fix Code Lenses jank #1420

Merged
merged 1 commit into from
Feb 25, 2025
Merged

Conversation

charlieegan3
Copy link
Member

Previously, when editing a line, if parse errors come and go as you edit, the Code Lenses will toggle on and off as the parse error list is updated.

Now, only if the line count is different from the last successful parse, will the Code Lenses be disabled.

This means that a line can be typed while it contains errors, and code lenses will now come and go.

Screen.Recording.2025-02-25.at.15.44.36.mov

Previously, when editing a line, if parse errors come and go as you
edit, the Code Lenses will toggle on and off as the parse error list is
updated.

Now, only if the line count is different from the last successful parse,
will the Code Lenses be disabled.

This means that a line can be typed while it contains errors, and code
lenses will now come and go.

Signed-off-by: Charlie Egan <charlie@styra.com>
Copy link
Member

@anderseknert anderseknert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥳

@@ -47,6 +47,10 @@ type Cache struct {
// to be used for hover hints.
keywordLocationsFile *concurrent.Map[string, map[uint][]types.KeywordLocation]

// when a file is successfully parsed, the number of lines in the file is stored
// here. This is used to gracefully fail when exiting unparsable files.
successfulParseLineCounts *concurrent.Map[string, int]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Smart!

@anderseknert anderseknert merged commit 4fd08cb into StyraInc:main Feb 25, 2025
5 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants