Skip to content

Commit

Permalink
fix path issue
Browse files Browse the repository at this point in the history
  • Loading branch information
CppCXY committed Feb 7, 2025
1 parent 792dbb3 commit 2dbdcd6
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions crates/emmylua_code_analysis/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ mod config_loader;
mod configs;
mod flatten_config;

use std::{collections::HashSet, path::{Path, PathBuf}};
use std::{
collections::HashSet,
path::{Path, PathBuf},
};

use crate::{semantic::LuaInferConfig, FileId};
pub use config_loader::load_configs;
Expand Down Expand Up @@ -104,6 +107,10 @@ impl Emmyrc {

fn pre_process_path(path: &str, workspace: &Path) -> String {
let mut path = path.to_string();
path = replace_env_var(&path);
// ${workspaceFolder} == {workspaceFolder}
path = path.replace("$", "");
path = replace_placeholders(&path, workspace.to_str().unwrap());

if path.starts_with('~') {
let home_dir = dirs::home_dir().unwrap();
Expand All @@ -116,10 +123,6 @@ fn pre_process_path(path: &str, workspace: &Path) -> String {
path = workspace.join(&path).to_string_lossy().to_string();
}

path = replace_env_var(&path);
// ${workspaceFolder} == {workspaceFolder}
path = path.replace("$", "");
path = replace_placeholders(&path, workspace.to_str().unwrap());
path
}

Expand Down

0 comments on commit 2dbdcd6

Please sign in to comment.