Live data from Hacker News

How LSP could have been better

matklad.github.io

1–10 of 229 posts

Re: How LSP could have been better

#4
Does anyone know why LSP uses UTF-16 for encoding columns? It seems like everyone agrees it is a bad choice, so I'm curious about the original reasoning. Are there any benefits at all to using UTF-16, or was it something to do with Microsoft legacy code?

Re: How LSP could have been better

#6
post #2

What the hell is LSP?

If you click the "Why LSP?" link in the first sentence of the article, or type "lsp" into Google, you'll get your answer:

> The Language Server Protocol (LSP) defines the protocol used between an editor or IDE and a language server that provides language features like auto complete, go to definition, find all references etc.

Re: How LSP could have been better

#7
Recently I stumbled upon this issue:

https://github.com/joaotavora/eglot/discussions/1127

I don't know enough about emacs and LSP to see the full picture, but it seems that both eglot's and corfu's maintainers, assumably very competent programmers, can't find a solution for this.

I only skimmed the thread. My understanding is that LSP dumps a long list of completion candidates at once and they can't decide a cache strategy that works well with existing code...? If someone who know more about this please enlighten us.

Re: How LSP could have been better

#8
post #4

Does anyone know why LSP uses UTF-16 for encoding columns? It seems like everyone agrees it is a bad choice, so I'm curious about the original reasoning. Are there any benefits at all to using UTF-16, or was it something to do with Microsoft legacy code?

JavaScript uses UTF-16 for everything is why, and LSP is a TypeScript-first protocol.

Re: How LSP could have been better

#10
post #4

Does anyone know why LSP uses UTF-16 for encoding columns? It seems like everyone agrees it is a bad choice, so I'm curious about the original reasoning. Are there any benefits at all to using UTF-16, or was it something to do with Microsoft legacy code?

There was a lengthy discussion on this [1]. UTF-16 was used because it was convenient: it's what Microsoft API's and JavaScript already use (the latter being the language VS Code is written in).

[1] https://github.com/microsoft/language-server-protocol/issues...

Post reply on HN