Skip to content

Commit

Permalink
Use relative glob patterns in DidChangeWatchedFilesRegistrationOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Veykril committed Mar 21, 2024
1 parent 23613a9 commit fe28e47
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions crates/rust-analyzer/src/reload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -436,16 +436,19 @@ impl GlobalState {
.flat_map(|ws| ws.to_roots())
.filter(|it| it.is_local)
.flat_map(|root| {
root.include.into_iter().flat_map(|it| {
[
format!("{it}/**/*.rs"),
format!("{it}/**/Cargo.toml"),
format!("{it}/**/Cargo.lock"),
]
})
root.include
.into_iter()
.flat_map(|it| [(it.clone(), "**/*.rs"), (it, "**/Cargo.{lock,toml}")])
})
.map(|glob_pattern| lsp_types::FileSystemWatcher {
glob_pattern: lsp_types::GlobPattern::String(glob_pattern),
.map(|(base, pat)| lsp_types::FileSystemWatcher {
glob_pattern: lsp_types::GlobPattern::Relative(
lsp_types::RelativePattern {
base_uri: lsp_types::OneOf::Right(
lsp_types::Url::from_file_path(base).unwrap(),
),
pattern: pat.to_owned(),
},
),
kind: None,
})
.collect(),
Expand Down

0 comments on commit fe28e47

Please sign in to comment.