From bb0948817f28eea26d7b9a8f68760ba2bfc2f3e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Lehmann?= Date: Mon, 6 May 2024 07:08:06 +0200 Subject: [PATCH] use path-shash to produce a glob expression compatible with glob-match --- Cargo.lock | 7 +++++++ Cargo.toml | 1 + src/backend.rs | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 395953f..0ae617f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -230,6 +230,7 @@ dependencies = [ "fs_extra", "glob", "glob-match", + "path-slash", "ropey", "serde", "serde_json", @@ -516,6 +517,12 @@ dependencies = [ "windows-targets 0.52.5", ] +[[package]] +name = "path-slash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e91099d4268b0e11973f036e885d652fb0b21fedcf69738c627f94db6a44f42" + [[package]] name = "percent-encoding" version = "2.3.1" diff --git a/Cargo.toml b/Cargo.toml index b6316ea..c9ef237 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,6 +24,7 @@ clean-path = "0.2.1" dashmap = "5.5.3" glob = "0.3.1" glob-match = "0.2.1" +path-slash = "0.2.1" ropey = "1.6.1" serde = "1.0.200" thiserror = "1.0.59" diff --git a/src/backend.rs b/src/backend.rs index 17d5c7c..9543945 100644 --- a/src/backend.rs +++ b/src/backend.rs @@ -4,6 +4,7 @@ use std::time::Instant; use clean_path::Clean; use dashmap::DashMap; use glob_match::glob_match; +use path_slash::PathExt; use tower_lsp::lsp_types::request::{GotoDeclarationParams, GotoDeclarationResponse}; use tower_lsp::{jsonrpc::Result, lsp_types::*, Client, LanguageServer}; use tree_sitter::Parser; @@ -65,7 +66,7 @@ impl Backend { let path = path .parent() .ok_or_else(|| request_failed("can't compute the current Earthfile parent"))?; - let path = path.join(earthfile_ref).join("Earthfile").clean().to_string_lossy().to_string(); + let path = path.join(earthfile_ref).join("Earthfile").clean().to_slash_lossy().to_string(); Ok(self .docs .iter()