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

Fix processing of multibyte messages #4519

Merged
merged 2 commits into from
Nov 10, 2024
Merged

Conversation

JeremyWeed
Copy link
Contributor

  • Too many characters are read from back-to-back multibyte messages due to a conversion from byte-length to character length

  • Updated to immediately convert messages to unibyte when processing

* Too many characters are read from back-to-back multibyte messages due to a
conversion from byte-length to character length

* Updated to immediately convert messages to unibyte when processing
@JeremyWeed
Copy link
Contributor Author

Fixes #4250

lsp-mode.el Outdated
@@ -7041,8 +7041,8 @@ server. WORKSPACE is the active workspace."
leftovers body-length body chunk)
(lambda (_proc input)
(setf chunk (if (s-blank? leftovers)
input
(concat leftovers input)))
(encode-coding-string input 'utf-8-unix)
Copy link
Member

Choose a reason for hiding this comment

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

nit: using the 3rd parameters of nocopy might be better due to we don't have to duplicate the string.
Can you check if it still working okay with that?

@nvimtor
Copy link

nvimtor commented Nov 9, 2024

Any follow-ups? lsp-mode is unusable to me due to the error in process filter: Unable to find Content-Length header. error.

@JeremyWeed
Copy link
Contributor Author

Hi, sorry, lost track of this. Can confirm that using the third param of encode-coding-string does appear to speed it up locally, and that I've been running with this fix locally with no detectable issues for the past three months. Revised the pull request.

@nvimtor
Copy link

nvimtor commented Nov 10, 2024

@JeremyWeed same; I had forked your repository and rebased it with this one and seems like I have no issues anymore

@kiennq kiennq merged commit a49b386 into emacs-lsp:master Nov 10, 2024
11 of 13 checks passed
nvimtor pushed a commit to nvimtor/lsp-mode that referenced this pull request Nov 11, 2024
* Fix processing of multibyte messages

* Too many characters are read from back-to-back multibyte messages due to a
conversion from byte-length to character length

* Updated to immediately convert messages to unibyte when processing

* Update encoding logic to avoid copies

---------

Co-authored-by: weedjer <[email protected]>
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.

3 participants