Conversation
calculations. Co-authored-by: Vinicius Stock <vinistock@users.noreply.github.com> Co-authored-by: Vinicius Stock <vinistock@users.noreply.github.com>
How to use the Graphite Merge QueueAdd the label graphite-merge to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. |
Member
How to use the Graphite Merge QueueAdd the label graphite-merge to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
vinistock
approved these changes
Jun 4, 2025
ff2271a to
e4a012f
Compare
graphite-app bot
pushed a commit
that referenced
this pull request
Jul 15, 2025
### Motivation With the improvements to the position scanners (#3612 and #3583), we're now seeing some cases of invalid location being raised, despite no reports of any issues regarding the state of the documents. I think we're making a mistake by trying to apply document operations with higher priority than feature requests. For example, if we receive a request for completion and the user immediately edits the file, the server might process the edit before finishing the completion request and there are no guarantees that the new state of the document can satisfy that original request. I want to propose pushing text synchronization operations to the queue, so that they are processed in order and without locking, which I believe will improve the situation. ### Implementation I start pushing text synchronization operations to the work queue and removed many of the mutex locks that we originally had. Since requests are processed in order, there should not be a chance of a feature request being processed with an incorrect document state.
vinistock
added a commit
that referenced
this pull request
Jul 15, 2025
Remove excessive mutex synchronization (#3637) ### Motivation With the improvements to the position scanners (#3612 and #3583), we're now seeing some cases of invalid location being raised, despite no reports of any issues regarding the state of the documents. I think we're making a mistake by trying to apply document operations with higher priority than feature requests. For example, if we receive a request for completion and the user immediately edits the file, the server might process the edit before finishing the completion request and there are no guarantees that the new state of the document can satisfy that original request. I want to propose pushing text synchronization operations to the queue, so that they are processed in order and without locking, which I believe will improve the situation. ### Implementation I start pushing text synchronization operations to the work queue and removed many of the mutex locks that we originally had. Since requests are processed in order, there should not be a chance of a feature request being processed with an incorrect document state. Co-authored-by: vinistock <18742907+vinistock@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Motivation
Closes: #3494
Closes: #2446
This PR addresses an issue where UTF-8 encoded text uses incorrect offsets within the language server. The language server was calculating offsets using the number of code points, but UTF-8 code units match the number of bytes (as explained in the spec).
Implementation
To fix this issue, the
Scannerclass was updated to calculate offset by taking a byte slice of the current text up until a given position, and return the number of chars within the given slice. This number was then added to the offset provided by the new character, which results in a correct char offset.Automated Tests
Added some unit tests.
Manual Tests
Tested in neo-vim.