Skip to content
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

Add functions to convert selection ranges #2

Merged
merged 1 commit into from
Jun 7, 2024
Merged

Conversation

remcohaszing
Copy link
Owner

LSP selection ranges define their parent selection range using the parent property. Monaco editor on the other hand, defines this ancestry as an array. This means that a singular Monaco editor selection range can’t be represented in LSP.

This deprecates the functions fromSelectionRange and toSelectionRange in favor the plural variants fromSelectionRanges and toSelectionRanges.

LSP selection ranges define their parent selection range using the
`parent` property. Monaco editor on the other hand, defines this
ancestry as an array. This means that a singular Monaco editor selection
range can’t be represented in LSP.

This deprecates the functions `fromSelectionRange` and
`toSelectionRange` in favor the plural variants `fromSelectionRanges`
and `toSelectionRanges`.
}

return result
}
Copy link
Owner Author

@remcohaszing remcohaszing Jun 7, 2024

Choose a reason for hiding this comment

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

@johnsoncodehk would you like to review this? I think it’s ok, but I would appreciate a second opinion, mostly to make sure I didn’t get the order wrong.

The toSelectionRanges implementation is based on https://github.com/microsoft/monaco-editor/blob/v0.49.0/src/language/common/lspLanguageFeatures.ts#L1015-L1022. The fromSelectionRanges implementation does the inverse.

@johnsoncodehk
Copy link
Sponsor Contributor

LGTM! It would be nice to be consistent with upstream.

@remcohaszing remcohaszing merged commit e9d1b46 into main Jun 7, 2024
7 checks passed
@remcohaszing remcohaszing deleted the selection-ranges branch June 7, 2024 17:12
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