Skip to content

Implemented single character insertion and deletion#199

Open
johnfav03 wants to merge 3 commits intomainfrom
single-char-insert-delete
Open

Implemented single character insertion and deletion#199
johnfav03 wants to merge 3 commits intomainfrom
single-char-insert-delete

Conversation

@johnfav03
Copy link
Contributor

No description provided.

@johnfav03 johnfav03 requested a review from gabritto February 25, 2026 01:01
Copy link
Member

@gabritto gabritto left a comment

Choose a reason for hiding this comment

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

Code looks ok to me, but I left some suggestions for consideration. Excited to try this out!

else if (serverCharacter > 0) {
// Delete previous character
documentVersion++;
await notify("textDocument/didChange", {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should try to bit somewhat smarter about deletion in order to get closer to scenarios where someone is halfway through typing/editing code? e.g. delete the rest of the line, delete ending parentheses/braces, etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea! I'll add a case for deleting the rest of the line, and I'll increase the probability of deletion if the character is a brace/dot/similar punctuation


// Single character mutations (insertion/deletion)
const mutationRoll = prng.random();
if (mutationRoll < standardProb) {
Copy link
Member

Choose a reason for hiding this comment

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

Should we also try to undo all the changes we accumulated from time to time? I imagine we want to keep a balance between testing valid and invalid code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants