Skip to content

fix: clamp the format range to the text in the editor service - #1345

Merged
dsherret merged 2 commits into
mainfrom
fix-editor-service-clamp-range
Oct 11, 2026
Merged

dsherret merged 2 commits into
mainfrom
fix-editor-service-clamp-range

Conversation

@dsherret

Copy link
Copy Markdown
Member

The editor service passed the format range an editor sent straight to the plugin without checking it against the text. Plugins index into the text with the range, so a range that ended past the end of the text or started after its end could make a plugin fail (ex. panic on an out of bounds slice).

Now the range is clamped to the text when the format message is read: the end is clamped to the length of the text and the start is clamped to the end. A range that covers the whole text once clamped is treated as formatting the whole text, the same as before for an exact one.

@dsherret
dsherret merged commit fd7a36d into main Oct 11, 2026
21 checks passed
@dsherret
dsherret deleted the fix-editor-service-clamp-range branch October 11, 2026 17:14
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.

1 participant