diff options
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(); |