mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
Fix relative glob patterns not working for language servers (#9179)
If a language server would send us a glob pattern like `**/*.rb` or `**/{package.json}` we'd end up ignoring it and never sending the language server any notifications, because we try to `strip_prefix` the projects absolute path from the pattern, BUT if that path is not in the pattern, we'd return `None`. This change fixes that. Release Notes: - Fixed language server glob patterns for file watching being ignored if they were relative patterns. Co-authored-by: Bennet <bennetbo@gmx.de> Co-authored-by: Remco <djsmits12@gmail.com>
This commit is contained in:
parent
b2981f4baa
commit
fe70a2646f
@ -3900,9 +3900,12 @@ impl Project {
|
|||||||
let glob_is_inside_worktree = worktree.update(cx, |tree, _| {
|
let glob_is_inside_worktree = worktree.update(cx, |tree, _| {
|
||||||
if let Some(abs_path) = tree.abs_path().to_str() {
|
if let Some(abs_path) = tree.abs_path().to_str() {
|
||||||
let relative_glob_pattern = match &watcher.glob_pattern {
|
let relative_glob_pattern = match &watcher.glob_pattern {
|
||||||
lsp::GlobPattern::String(s) => s
|
lsp::GlobPattern::String(s) => Some(
|
||||||
.strip_prefix(abs_path)
|
s.strip_prefix(abs_path)
|
||||||
.and_then(|s| s.strip_prefix(std::path::MAIN_SEPARATOR)),
|
.unwrap_or(s)
|
||||||
|
.strip_prefix(std::path::MAIN_SEPARATOR)
|
||||||
|
.unwrap_or(s),
|
||||||
|
),
|
||||||
lsp::GlobPattern::Relative(rp) => {
|
lsp::GlobPattern::Relative(rp) => {
|
||||||
let base_uri = match &rp.base_uri {
|
let base_uri = match &rp.base_uri {
|
||||||
lsp::OneOf::Left(workspace_folder) => &workspace_folder.uri,
|
lsp::OneOf::Left(workspace_folder) => &workspace_folder.uri,
|
||||||
|
Loading…
Reference in New Issue
Block a user