-
Notifications
You must be signed in to change notification settings - Fork 58
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: DocumentInputStream does not handle surrogate pairs correctly #1069
Conversation
70598c7
to
2a657d9
Compare
this(chars::charAt, chars::length, charset, bufferSize); | ||
} | ||
|
||
public CharsInputStream(final CharsSupplier chars, final IntSupplier charsLength) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is unused, should we remove it?
org.eclipse.lsp4e/src/org/eclipse/lsp4e/internal/DocumentInputStream.java
Show resolved
Hide resolved
795c624
to
de41da2
Compare
org.eclipse.lsp4e/src/org/eclipse/lsp4e/internal/CharsInputStream.java
Outdated
Show resolved
Hide resolved
org.eclipse.lsp4e/src/org/eclipse/lsp4e/internal/CharsInputStream.java
Outdated
Show resolved
Hide resolved
} | ||
|
||
try { | ||
charBuffer.clear(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we not do the charBuffer.clear
rather at the end of the method in a finally
block so that we do not hold data that will never be used until the next call to refill?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the charBuffer contains a fixed size char[] array. I don't see any advantage clearing the buffer at the end. I prefer clearing the buffer just before I start refilling and using it.
@sebthom , I do not have more comments. |
de41da2
to
14d95d4
Compare
@rubenporras oh man, you are thorough! |
This PR replaces the current DocumentInputStream implementation which does not handle high/low surrogate character pairs.