Skip to content

Commit

Permalink
Feature/multiple encodings handled (#88)
Browse files Browse the repository at this point in the history
* feat: support added for multiple encodings
Actually, the only supported encoding was UTF-8.
In cases where the editor sends updates encoded in UTF-16,
the mirror of the user's workspace goes out of sync, leading to a server crash.

Furthermore, UTF-16 is the default and mandatory encoding for the protocol,
and servers must support it.

Therefore, it is imperative to ensure its support.

Now, to avoid any unnecessary conversion, the server negotiates the encoding
with the client during the initialization phase.
This allows the server to choose its preferred encoding in cases where it is available.

See: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocuments

* style: format added code using rustfmt

* feat: cargo clippy warnings fixed

* test: add some unit tests for the new `apply_content_change` function

* feat: review comments fixed
Use of the `document::PositionEncodingKind` enum everywhere it's
possible and TryFrom implemented on it.

Also, LspError are not used anymore.

* feat: review comments fixed, mostly style.
  • Loading branch information
jeremyelalouf authored Mar 7, 2024
1 parent 386ed53 commit 078d4c7
Show file tree
Hide file tree
Showing 3 changed files with 482 additions and 80 deletions.
Loading

0 comments on commit 078d4c7

Please sign in to comment.