diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-02-16 16:34:22 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-02-16 16:34:22 +0000 |
commit | c9672a0539a59b626619724092077f57c70e6ffe (patch) | |
tree | 77097454dc598a5e0a0b1d98b8c9645b9e213289 /crates/rust-analyzer/src/bin/main.rs | |
parent | f7b7a09f752caba21f2b21ccb8f74421a599d2c6 (diff) | |
parent | 3f09e3fba62839f26da2f27ce27a2335b1dca7ef (diff) |
Merge #7657
7657: utf8 r=matklad a=matklad
- Prepare for utf-8 offsets
- reduce code duplication in tests
- Make utf8 default, implement utf16 in terms of it
- Make it easy to add additional context for offset conversion
- Implement utf8 offsets
closes #7453
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/rust-analyzer/src/bin/main.rs')
-rw-r--r-- | crates/rust-analyzer/src/bin/main.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/crates/rust-analyzer/src/bin/main.rs b/crates/rust-analyzer/src/bin/main.rs index 93d0ad4ec..89482b952 100644 --- a/crates/rust-analyzer/src/bin/main.rs +++ b/crates/rust-analyzer/src/bin/main.rs | |||
@@ -8,7 +8,7 @@ use std::{convert::TryFrom, env, fs, path::PathBuf, process}; | |||
8 | 8 | ||
9 | use lsp_server::Connection; | 9 | use lsp_server::Connection; |
10 | use project_model::ProjectManifest; | 10 | use project_model::ProjectManifest; |
11 | use rust_analyzer::{cli, config::Config, from_json, Result}; | 11 | use rust_analyzer::{cli, config::Config, from_json, lsp_ext::supports_utf8, Result}; |
12 | use vfs::AbsPathBuf; | 12 | use vfs::AbsPathBuf; |
13 | 13 | ||
14 | #[cfg(all(feature = "mimalloc"))] | 14 | #[cfg(all(feature = "mimalloc"))] |
@@ -127,7 +127,11 @@ fn run_server() -> Result<()> { | |||
127 | name: String::from("rust-analyzer"), | 127 | name: String::from("rust-analyzer"), |
128 | version: Some(String::from(env!("REV"))), | 128 | version: Some(String::from(env!("REV"))), |
129 | }), | 129 | }), |
130 | offset_encoding: None, | 130 | offset_encoding: if supports_utf8(&initialize_params.capabilities) { |
131 | Some("utf-8".to_string()) | ||
132 | } else { | ||
133 | None | ||
134 | }, | ||
131 | }; | 135 | }; |
132 | 136 | ||
133 | let initialize_result = serde_json::to_value(initialize_result).unwrap(); | 137 | let initialize_result = serde_json::to_value(initialize_result).unwrap(); |