Skip to content
This repository was archived by the owner on Aug 30, 2025. It is now read-only.

Fix: Stutter when completing inside string interpolations#464

Merged
scohen merged 3 commits into
mainfrom
fix-completion-stutter
Nov 8, 2023
Merged

Fix: Stutter when completing inside string interpolations#464
scohen merged 3 commits into
mainfrom
fix-completion-stutter

Conversation

@scohen

@scohen scohen commented Nov 3, 2023

Copy link
Copy Markdown
Collaborator

When completing certain things in string interpolations, the prefix can't be processed by the tokenizer, so token_stream returns the EOL from the previous line. We used the length of the EOL as the length of the prefix, which was often not enough, so we'd get a stutter when applying the text edit if the prefix was longer than 2 characters.

The fix is to detect the EOL, and in that case, use Code.Fragment to parse the prefix.

Fixes #462

When completing certain things in string interpolations, the prefix
can't be processed by the tokenizer, so `token_stream` returns the EOL
from the previous line. We used the length of the EOL as the length of
the prefix, which was often not enough, so we'd get a stutter when
applying the text edit if the prefix was longer than 2 characters.

The fix is to detect the EOL, and in that case, use Code.Fragment to
parse the prefix.

Fixes #462
@scohen scohen added this to the 0.4.1 milestone Nov 3, 2023
Comment thread apps/server/lib/lexical/server/code_intelligence/completion/builder.ex Outdated
@scohen scohen force-pushed the fix-completion-stutter branch from fd89d02 to 7d11e71 Compare November 7, 2023 13:44

@scottming scottming left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I tried this branch, works very well

@zachallaun zachallaun left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good and works for me locally.

Comment thread apps/server/lib/lexical/server/code_intelligence/completion/builder.ex Outdated
@scohen scohen force-pushed the fix-completion-stutter branch from 7d11e71 to 225ce87 Compare November 8, 2023 16:05
@scohen scohen merged commit c73b0d0 into main Nov 8, 2023
@scohen scohen deleted the fix-completion-stutter branch November 8, 2023 16:09
scohen added a commit that referenced this pull request Nov 8, 2023
* Fix: Stutter when completing inside string interpolations

When completing certain things in string interpolations, the prefix
can't be processed by the tokenizer, so `token_stream` returns the EOL
from the previous line. We used the length of the EOL as the length of
the prefix, which was often not enough, so we'd get a stutter when
applying the text edit if the prefix was longer than 2 characters.

The fix is to detect the EOL, and in that case, use Code.Fragment to
parse the prefix.

Fixes #462
scohen added a commit that referenced this pull request Nov 9, 2023
scohen added a commit that referenced this pull request Nov 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

stutter when completing in strings (and other places)

3 participants