Skip to content

Commit 1558355

Browse files
committed
refactor: Remove workspace_initialized flag
1 parent e98602a commit 1558355

File tree

3 files changed

+4
-22
lines changed

3 files changed

+4
-22
lines changed

crates/emmylua_ls/src/context/workspace_manager.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::collections::HashSet;
22
use std::path::Path;
3-
use std::sync::atomic::{AtomicBool, AtomicI64, AtomicU8, Ordering};
3+
use std::sync::atomic::{AtomicI64, AtomicU8, Ordering};
44
use std::{path::PathBuf, sync::Arc, time::Duration};
55

66
use super::{ClientProxy, FileDiagnostic, StatusBar};
@@ -26,7 +26,6 @@ pub struct WorkspaceManager {
2626
pub watcher: Option<notify::RecommendedWatcher>,
2727
pub current_open_files: HashSet<Uri>,
2828
pub match_file_pattern: WorkspaceFileMatcher,
29-
pub workspace_initialized: Arc<AtomicBool>,
3029
workspace_diagnostic_level: Arc<AtomicU8>,
3130
workspace_version: Arc<AtomicI64>,
3231
}
@@ -51,24 +50,13 @@ impl WorkspaceManager {
5150
watcher: None,
5251
current_open_files: HashSet::new(),
5352
match_file_pattern: WorkspaceFileMatcher::default(),
54-
workspace_initialized: Arc::new(AtomicBool::new(false)),
5553
workspace_diagnostic_level: Arc::new(AtomicU8::new(
5654
WorkspaceDiagnosticLevel::Fast.to_u8(),
5755
)),
5856
workspace_version: Arc::new(AtomicI64::new(0)),
5957
}
6058
}
6159

62-
pub fn is_workspace_initialized(&self) -> bool {
63-
self.workspace_initialized
64-
.load(std::sync::atomic::Ordering::SeqCst)
65-
}
66-
67-
pub fn set_workspace_initialized(&self) {
68-
self.workspace_initialized
69-
.store(true, std::sync::atomic::Ordering::SeqCst);
70-
}
71-
7260
pub fn get_workspace_diagnostic_level(&self) -> WorkspaceDiagnosticLevel {
7361
let value = self.workspace_diagnostic_level.load(Ordering::Acquire);
7462
WorkspaceDiagnosticLevel::from_u8(value)

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,13 @@ pub async fn on_did_change_configuration(
1212
log::info!("on_did_change_configuration: {}", pretty_json);
1313

1414
// Check initialization status and get client config
15-
let (is_initialized, client_id, supports_config_request) = {
15+
let (client_id, supports_config_request) = {
1616
let workspace_manager = context.workspace_manager().read().await;
17-
let is_initialized = workspace_manager.is_workspace_initialized();
1817
let client_id = workspace_manager.client_config.client_id;
1918
let supports_config_request = context.lsp_features().supports_config_request();
20-
(is_initialized, client_id, supports_config_request)
19+
(client_id, supports_config_request)
2120
};
2221

23-
if !is_initialized {
24-
return Some(());
25-
}
26-
2722
if client_id.is_vscode() {
2823
return Some(());
2924
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ pub async fn initialized_handler(
8383
let (include, exclude, exclude_dir) = calculate_include_and_exclude(&emmyrc);
8484
workspace_manager.match_file_pattern =
8585
WorkspaceFileMatcher::new(include, exclude, exclude_dir);
86-
workspace_manager.set_workspace_initialized();
87-
log::info!("workspace manager initialized");
86+
log::info!("workspace manager updated with client config and watch file patterns")
8887
}
8988

9089
init_analysis(

0 commit comments

Comments
 (0)