mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-11 10:41:28 -10:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
216fb0a826 |
No files matched your search
@@ -2451,6 +2451,10 @@ impl LspManager {
|
||||
.flat_map(|(paths, change)| paths.iter().map(move |p| (p, change)));
|
||||
let watchers = run.watchers.read();
|
||||
let changes: Vec<(&PathBuf, Change)> = if watchers.is_empty() {
|
||||
// Dart watches the filesystem itself and rejects this unregistered notification.
|
||||
if s.name == "dart" {
|
||||
continue;
|
||||
}
|
||||
let languages = s.languages();
|
||||
all.filter(|(p, change)| {
|
||||
p.starts_with(&s.root) && languages.contains(&self.languages.detect(p, None)) && send(p, *change)
|
||||
|
||||
@@ -395,6 +395,45 @@ fn change(range: Range, text: &str) -> AppliedChange {
|
||||
AppliedChange { range, text: text.into() }
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn dart_file_watching_requires_an_explicit_registration() {
|
||||
for (language, extension, name, fallback) in
|
||||
[("dart", "dart", "dart", false), ("dart", "dart", "alternative-dart", true), ("java", "java", "jdtls", true)]
|
||||
{
|
||||
let h = harness_for(language, extension, &[(name, incremental_caps())], &[]);
|
||||
let (doc, _) = h.open(&format!("open.{extension}"), "x");
|
||||
h.wait_status(name, ServerStatus::Ready).await;
|
||||
let s = h.launcher.state(name);
|
||||
let path = h.root.join(format!("closed.{extension}"));
|
||||
let notify = || h.mgr.watched_files_changed(&[], std::slice::from_ref(&path), &[], &[]);
|
||||
notify();
|
||||
h.mgr.hover(doc, Pos::new(0, 0), Default::default()).await.unwrap();
|
||||
assert_eq!(s.notified("workspace/didChangeWatchedFiles").len(), usize::from(fallback), "{name}");
|
||||
s.peer()
|
||||
.request::<_, Value>(
|
||||
"client/registerCapability",
|
||||
json!({ "registrations": [{ "id": "watch", "method": "workspace/didChangeWatchedFiles", "registerOptions": { "watchers": [{ "globPattern": "**/*" }] } }] }),
|
||||
None,
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
notify();
|
||||
eventually(|| s.notified("workspace/didChangeWatchedFiles").len() == usize::from(fallback) + 1).await;
|
||||
s.peer()
|
||||
.request::<_, Value>(
|
||||
"client/unregisterCapability",
|
||||
json!({ "unregisterations": [{ "id": "watch", "method": "workspace/didChangeWatchedFiles" }] }),
|
||||
None,
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
notify();
|
||||
h.mgr.hover(doc, Pos::new(0, 0), Default::default()).await.unwrap();
|
||||
assert_eq!(s.notified("workspace/didChangeWatchedFiles").len(), usize::from(fallback) * 2 + 1, "{name}");
|
||||
h.mgr.shutdown_all().await;
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------ tests
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
|
||||
Reference in new issue
Block a user