Skip to content

Commit fe28e47

Browse files
committed
Use relative glob patterns in DidChangeWatchedFilesRegistrationOptions
1 parent 23613a9 commit fe28e47

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

crates/rust-analyzer/src/reload.rs

+12-9
Original file line numberDiff line numberDiff line change
@@ -436,16 +436,19 @@ impl GlobalState {
436436
.flat_map(|ws| ws.to_roots())
437437
.filter(|it| it.is_local)
438438
.flat_map(|root| {
439-
root.include.into_iter().flat_map(|it| {
440-
[
441-
format!("{it}/**/*.rs"),
442-
format!("{it}/**/Cargo.toml"),
443-
format!("{it}/**/Cargo.lock"),
444-
]
445-
})
439+
root.include
440+
.into_iter()
441+
.flat_map(|it| [(it.clone(), "**/*.rs"), (it, "**/Cargo.{lock,toml}")])
446442
})
447-
.map(|glob_pattern| lsp_types::FileSystemWatcher {
448-
glob_pattern: lsp_types::GlobPattern::String(glob_pattern),
443+
.map(|(base, pat)| lsp_types::FileSystemWatcher {
444+
glob_pattern: lsp_types::GlobPattern::Relative(
445+
lsp_types::RelativePattern {
446+
base_uri: lsp_types::OneOf::Right(
447+
lsp_types::Url::from_file_path(base).unwrap(),
448+
),
449+
pattern: pat.to_owned(),
450+
},
451+
),
449452
kind: None,
450453
})
451454
.collect(),

0 commit comments

Comments
 (0)