-
Notifications
You must be signed in to change notification settings - Fork 18k
x/tools/gopls: consider a -utf8 flag to talk UTF8 offsets #38274
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
Comments
While I am sympathetic, I don't think this is the right answer. |
Thanks @ianthehat. I'm very aware this proposal is not without its downsides! So appreciate the discussion.
Agreed. The most recent motivation has been the work to add fuzzy-finder driver symbol searching to This same overhead applies to diagnostics returned by LSP (although the numbers there are generally far less). It also makes it much harder to write a "plain old LSP client" for things like scripting (cc @findleyr).
Under what conditions do you see this as being "inevitable"? Do many people have two editors running against the same LSP? Would it not be the case that for those people who are not using For those people who are using remote, you could also automatically add the result of the Whilst it would always be possible for people to find edge cases, it feels like it would be entirely possible to prevent foot-gun incidents entirely if people use the forwarder to connect to
This is a good point. I struggle imagine that I'm the first person ever to bring this up. |
I'd add refererence of microsoft/language-server-protocol#376 |
@mattn thanks, I had not seen that one, very relevant @myitcv I expect in the future that everyone will be using |
I think we should close this issue in favor of microsoft/language-server-protocol#376. Like Ian said, we won't make any changes like this unless they are supported in the protocol. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
For editors like Vim that natively speak the encoding of the files they are editing (e.g. UTF8 for Go files), there is an overhead in translating to/from UT8/UTF16. This same cost applies on the
gopls
side.Whilst exploring the addition of the workspace symbol method to
govim
this became particularly apparent. In the approach laid out in that linked issue, a child instance ofgovim
can ask questions of a parent (the instance being used within an editor session). For example, the child can ask the parent to return the results of a call to thegopls.Symbol
method. However, because the[]SymbolInformation
results fromgopls
are in terms of UTF16 code points, all the responses have to be re-evaluated against the contents of buffers in Vim or files on disk (if those files are not open). This places yet another unnecessary processing cost on the client.If instead
gopls
had a-utf8
flag that instead talked UTF8 offsets then all of this overhead, on both sides, would be entirely obviated.This being a flag it would be entirely opt-in and so have no effect on existing integrations like VSCode.
cc @stamblerre @findleyr
FYI @leitzler @bhcleek
The text was updated successfully, but these errors were encountered: