Skip to content

Commit 10cbdb9

Browse files
committed
disable report progress for other client
1 parent 8b4b761 commit 10cbdb9

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

crates/emmylua_ls/src/context/config_manager.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,12 @@ impl ConfigManager {
5555
let config_update_token = self.config_update_token.clone();
5656
let client_config = self.client_config.clone();
5757
let status_bar = self.status_bar.clone();
58+
let client_id = client_config.client_id;
5859
tokio::spawn(async move {
5960
select! {
6061
_ = tokio::time::sleep(Duration::from_secs(2)) => {
6162
let emmyrc = load_emmy_config(Some(file_dir.clone()), client_config);
62-
init_analysis(analysis, client, &status_bar, workspace_folders, emmyrc).await;
63+
init_analysis(analysis, client, &status_bar, workspace_folders, emmyrc, client_id).await;
6364
// After completion, remove from HashMap
6465
let mut tokens = config_update_token.lock().await;
6566
tokens.take();

crates/emmylua_ls/src/handlers/initialized/mod.rs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
mod client_config;
2+
mod codestyle;
23
mod collect_files;
34
mod locale;
45
mod regsiter_file_watch;
5-
mod codestyle;
66

77
use std::{path::PathBuf, str::FromStr, sync::Arc};
88

99
use crate::{
10-
cmd_args::CmdArgs, context::{load_emmy_config, ClientProxy, ServerContextSnapshot, VsCodeStatusBar}, logger::init_logger
10+
cmd_args::CmdArgs,
11+
context::{load_emmy_config, ClientProxy, ServerContextSnapshot, VsCodeStatusBar},
12+
logger::init_logger,
1113
};
1214
use client_config::get_client_config;
1315
pub use client_config::ClientConfig;
@@ -62,6 +64,7 @@ pub async fn initialized_handler(
6264
&context.status_bar,
6365
workspace_folders,
6466
emmyrc,
67+
client_id,
6568
)
6669
.await;
6770

@@ -76,6 +79,7 @@ pub async fn init_analysis(
7679
status_bar: &VsCodeStatusBar,
7780
workspace_folders: Vec<PathBuf>,
7881
emmyrc: Arc<Emmyrc>,
82+
client_id: ClientId,
7983
// todo add cancel token
8084
) {
8185
let mut mut_analysis = analysis.write().await;
@@ -145,10 +149,13 @@ pub async fn init_analysis(
145149
let mut count = 0;
146150
while let Some(_) = rx.recv().await {
147151
count += 1;
148-
status_bar.report_progress(
149-
format!("diagnostic {}/{}", count, file_count).as_str(),
150-
0.75,
151-
);
152+
153+
if client_id.is_vscode() {
154+
status_bar.report_progress(
155+
format!("diagnostic {}/{}", count, file_count).as_str(),
156+
0.75,
157+
);
158+
}
152159
if count == file_count {
153160
break;
154161
}
@@ -182,7 +189,7 @@ fn get_workspace_folders(params: &InitializeParams) -> Vec<PathBuf> {
182189
workspace_folders
183190
}
184191

185-
#[derive(Debug, Clone, Copy)]
192+
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
186193
pub enum ClientId {
187194
VSCode,
188195
Intellij,

0 commit comments

Comments
 (0)