Skip to content

Commit

Permalink
fix: fix lsp watcher. remove feature, wait for kcl mod metadata to …
Browse files Browse the repository at this point in the history
…read only

Signed-off-by: he1pa <[email protected]>
  • Loading branch information
He1pa committed Dec 12, 2024
1 parent 580c0c2 commit 693f9f9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
19 changes: 12 additions & 7 deletions kclvm/tools/src/LSP/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,18 @@ impl LanguageServerState {
for event in self.fs_event_watcher._receiver.try_iter() {
if let Ok(e) = event {
match e.kind {
notify::EventKind::Modify(_) => {
let paths = e.paths;
let kcl_config_file: Vec<PathBuf> = filter_kcl_config_file(&paths);
if !kcl_config_file.is_empty() {
return Some(Event::FileWatcher(FileWatcherEvent::ChangedConfigFile(
kcl_config_file,
)));
notify::EventKind::Modify(kind) => {
if let notify::event::ModifyKind::Data(data_change) = kind {
if let notify::event::DataChange::Content = data_change {
let paths = e.paths;
let kcl_config_file: Vec<PathBuf> = filter_kcl_config_file(&paths);
if !kcl_config_file.is_empty() {
// TODO: wait for fix `kcl mod metadata` to read only. Otherwise it will lead to an infinite loop
// return Some(Event::FileWatcher(
// FileWatcherEvent::ChangedConfigFile(kcl_config_file),
// ));
}
}
}
}
notify::EventKind::Remove(remove_kind) => {
Expand Down
3 changes: 2 additions & 1 deletion kclvm/tools/src/LSP/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1527,7 +1527,8 @@ fn complete_import_external_file_e2e_test() {
}
}

#[test]
// TODO: wait for fix `kcl mod metadata` to read only. Otherwise it will lead to an infinite loop
// #[test]
fn mod_file_watcher_test() {
let path = PathBuf::from(".")
.join("src")
Expand Down

0 comments on commit 693f9f9

Please sign in to comment.