Skip to content

Commit f9fac02

Browse files
Use proper editor name
1 parent 1841192 commit f9fac02

File tree

3 files changed

+16
-15
lines changed

3 files changed

+16
-15
lines changed

crates/rust-analyzer/src/bin/main.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,10 @@ fn run_server() -> anyhow::Result<()> {
190190
}
191191
};
192192

193-
let mut is_visual_studio = false;
193+
let mut is_visual_studio_code = false;
194194
if let Some(client_info) = client_info {
195195
tracing::info!("Client '{}' {}", client_info.name, client_info.version.unwrap_or_default());
196-
is_visual_studio = client_info.name == "Visual Studio Code";
196+
is_visual_studio_code = client_info.name == "Visual Studio Code";
197197
}
198198

199199
let workspace_roots = workspace_folders
@@ -207,7 +207,7 @@ fn run_server() -> anyhow::Result<()> {
207207
})
208208
.filter(|workspaces| !workspaces.is_empty())
209209
.unwrap_or_else(|| vec![root_path.clone()]);
210-
let mut config = Config::new(root_path, capabilities, workspace_roots, is_visual_studio);
210+
let mut config = Config::new(root_path, capabilities, workspace_roots, is_visual_studio_code);
211211
if let Some(json) = initialization_options {
212212
if let Err(e) = config.update(json) {
213213
use lsp_types::{

crates/rust-analyzer/src/config.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ pub struct Config {
565565
data: ConfigData,
566566
detached_files: Vec<AbsPathBuf>,
567567
snippets: Vec<Snippet>,
568-
is_visual_studio: bool,
568+
is_visual_studio_code: bool,
569569
}
570570

571571
type ParallelCachePrimingNumThreads = u8;
@@ -761,7 +761,7 @@ impl Config {
761761
root_path: AbsPathBuf,
762762
caps: ClientCapabilities,
763763
workspace_roots: Vec<AbsPathBuf>,
764-
is_visual_studio: bool,
764+
is_visual_studio_code: bool,
765765
) -> Self {
766766
Config {
767767
caps,
@@ -771,7 +771,7 @@ impl Config {
771771
root_path,
772772
snippets: Default::default(),
773773
workspace_roots,
774-
is_visual_studio,
774+
is_visual_studio_code,
775775
}
776776
}
777777

@@ -1673,8 +1673,8 @@ impl Config {
16731673

16741674
// FIXME: VSCode seems to work wrong sometimes, see https://github.com/microsoft/vscode/issues/193124
16751675
// hence, distinguish it for now.
1676-
pub fn is_visual_studio(&self) -> bool {
1677-
self.is_visual_studio
1676+
pub fn is_visual_studio_code(&self) -> bool {
1677+
self.is_visual_studio_code
16781678
}
16791679
}
16801680
// Deserialization definitions

crates/rust-analyzer/src/lsp/to_proto.rs

+8-7
Original file line numberDiff line numberDiff line change
@@ -443,16 +443,17 @@ pub(crate) fn inlay_hint(
443443
file_id: FileId,
444444
inlay_hint: InlayHint,
445445
) -> Cancellable<lsp_types::InlayHint> {
446-
let is_visual_studio = snap.config.is_visual_studio();
446+
let is_visual_studio_code = snap.config.is_visual_studio_code();
447447
let needs_resolve = inlay_hint.needs_resolve;
448448
let (label, tooltip, mut something_to_resolve) =
449449
inlay_hint_label(snap, fields_to_resolve, needs_resolve, inlay_hint.label)?;
450-
let text_edits = if !is_visual_studio && needs_resolve && fields_to_resolve.resolve_text_edits {
451-
something_to_resolve |= inlay_hint.text_edit.is_some();
452-
None
453-
} else {
454-
inlay_hint.text_edit.map(|it| text_edit_vec(line_index, it))
455-
};
450+
let text_edits =
451+
if !is_visual_studio_code && needs_resolve && fields_to_resolve.resolve_text_edits {
452+
something_to_resolve |= inlay_hint.text_edit.is_some();
453+
None
454+
} else {
455+
inlay_hint.text_edit.map(|it| text_edit_vec(line_index, it))
456+
};
456457
let data = if needs_resolve && something_to_resolve {
457458
Some(to_value(lsp_ext::InlayHintResolveData { file_id: file_id.0 }).unwrap())
458459
} else {

0 commit comments

Comments
 (0)