aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/application.rs3
-rw-r--r--helix-term/src/commands.rs10
-rw-r--r--helix-term/src/commands/dap.rs2
-rw-r--r--helix-term/src/commands/lsp.rs7
-rw-r--r--helix-term/src/commands/typed.rs16
-rw-r--r--helix-term/src/main.rs6
-rw-r--r--helix-term/src/ui/mod.rs4
-rw-r--r--helix-term/src/ui/picker.rs2
8 files changed, 25 insertions, 25 deletions
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs
index 1b0a06dd..290441b4 100644
--- a/helix-term/src/application.rs
+++ b/helix-term/src/application.rs
@@ -1,11 +1,12 @@
use arc_swap::{access::Map, ArcSwap};
use futures_util::Stream;
-use helix_core::{path::get_relative_path, pos_at_coords, syntax, Selection};
+use helix_core::{pos_at_coords, syntax, Selection};
use helix_lsp::{
lsp::{self, notification::Notification},
util::lsp_range_to_range,
LspProgressMap,
};
+use helix_stdx::path::get_relative_path;
use helix_view::{
align_view,
document::DocumentSavedEventResult,
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 937326f6..53783e4e 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -2169,7 +2169,7 @@ fn global_search(cx: &mut Context) {
type Data = Option<PathBuf>;
fn format(&self, current_path: &Self::Data) -> Row {
- let relative_path = helix_core::path::get_relative_path(&self.path)
+ let relative_path = helix_stdx::path::get_relative_path(&self.path)
.to_string_lossy()
.into_owned();
if current_path
@@ -2218,7 +2218,7 @@ fn global_search(cx: &mut Context) {
.case_smart(smart_case)
.build(regex.as_str())
{
- let search_root = helix_loader::current_working_dir();
+ let search_root = helix_stdx::env::current_working_dir();
if !search_root.exists() {
cx.editor
.set_error("Current working directory does not exist");
@@ -2731,7 +2731,7 @@ fn file_picker_in_current_buffer_directory(cx: &mut Context) {
}
fn file_picker_in_current_directory(cx: &mut Context) {
- let cwd = helix_loader::current_working_dir();
+ let cwd = helix_stdx::env::current_working_dir();
if !cwd.exists() {
cx.editor
.set_error("Current working directory does not exist");
@@ -2759,7 +2759,7 @@ fn buffer_picker(cx: &mut Context) {
let path = self
.path
.as_deref()
- .map(helix_core::path::get_relative_path);
+ .map(helix_stdx::path::get_relative_path);
let path = match path.as_deref().and_then(Path::to_str) {
Some(path) => path,
None => SCRATCH_BUFFER_NAME,
@@ -2826,7 +2826,7 @@ fn jumplist_picker(cx: &mut Context) {
let path = self
.path
.as_deref()
- .map(helix_core::path::get_relative_path);
+ .map(helix_stdx::path::get_relative_path);
let path = match path.as_deref().and_then(Path::to_str) {
Some(path) => path,
None => SCRATCH_BUFFER_NAME,
diff --git a/helix-term/src/commands/dap.rs b/helix-term/src/commands/dap.rs
index dec25cbd..d62b0a4e 100644
--- a/helix-term/src/commands/dap.rs
+++ b/helix-term/src/commands/dap.rs
@@ -217,7 +217,7 @@ pub fn dap_start_impl(
}
}
- args.insert("cwd", to_value(helix_loader::current_working_dir())?);
+ args.insert("cwd", to_value(helix_stdx::env::current_working_dir())?);
let args = to_value(args).unwrap();
diff --git a/helix-term/src/commands/lsp.rs b/helix-term/src/commands/lsp.rs
index 0096e6aa..051cdcd3 100644
--- a/helix-term/src/commands/lsp.rs
+++ b/helix-term/src/commands/lsp.rs
@@ -17,9 +17,8 @@ use tui::{
use super::{align_view, push_jump, Align, Context, Editor, Open};
-use helix_core::{
- path, syntax::LanguageServerFeature, text_annotations::InlineAnnotation, Selection,
-};
+use helix_core::{syntax::LanguageServerFeature, text_annotations::InlineAnnotation, Selection};
+use helix_stdx::path;
use helix_view::{
document::{DocumentInlayHints, DocumentInlayHintsId, Mode},
editor::Action,
@@ -1018,7 +1017,7 @@ fn goto_impl(
locations: Vec<lsp::Location>,
offset_encoding: OffsetEncoding,
) {
- let cwdir = helix_loader::current_working_dir();
+ let cwdir = helix_stdx::env::current_working_dir();
match locations.as_slice() {
[location] => {
diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs
index eb88e041..ee02a7d2 100644
--- a/helix-term/src/commands/typed.rs
+++ b/helix-term/src/commands/typed.rs
@@ -7,7 +7,7 @@ use super::*;
use helix_core::fuzzy::fuzzy_match;
use helix_core::indent::MAX_INDENT;
-use helix_core::{encoding, line_ending, path::get_canonicalized_path, shellwords::Shellwords};
+use helix_core::{encoding, line_ending, shellwords::Shellwords};
use helix_lsp::{OffsetEncoding, Url};
use helix_view::document::DEFAULT_LANGUAGE_NAME;
use helix_view::editor::{Action, CloseError, ConfigEvent};
@@ -111,7 +111,7 @@ fn open(cx: &mut compositor::Context, args: &[Cow<str>], event: PromptEvent) ->
ensure!(!args.is_empty(), "wrong argument count");
for arg in args {
let (path, pos) = args::parse_file(arg);
- let path = helix_core::path::expand_tilde(&path);
+ let path = helix_stdx::path::expand_tilde(&path);
// If the path is a directory, open a file picker on that directory and update the status
// message
if let Ok(true) = std::fs::canonicalize(&path).map(|p| p.is_dir()) {
@@ -1079,18 +1079,17 @@ fn change_current_directory(
return Ok(());
}
- let dir = helix_core::path::expand_tilde(
+ let dir = helix_stdx::path::expand_tilde(
args.first()
.context("target directory not provided")?
- .as_ref()
.as_ref(),
);
- helix_loader::set_current_working_dir(dir)?;
+ helix_stdx::env::set_current_working_dir(dir)?;
cx.editor.set_status(format!(
"Current working directory is now {}",
- helix_loader::current_working_dir().display()
+ helix_stdx::env::current_working_dir().display()
));
Ok(())
}
@@ -1104,7 +1103,7 @@ fn show_current_directory(
return Ok(());
}
- let cwd = helix_loader::current_working_dir();
+ let cwd = helix_stdx::env::current_working_dir();
let message = format!("Current working directory is {}", cwd.display());
if cwd.exists() {
@@ -2409,7 +2408,8 @@ fn move_buffer(
ensure!(args.len() == 1, format!(":move takes one argument"));
let doc = doc!(cx.editor);
- let new_path = get_canonicalized_path(&PathBuf::from(args.first().unwrap().to_string()));
+ let new_path =
+ helix_stdx::path::canonicalize(&PathBuf::from(args.first().unwrap().to_string()));
let old_path = doc
.path()
.ok_or_else(|| anyhow!("Scratch buffer cannot be moved. Use :write instead"))?
diff --git a/helix-term/src/main.rs b/helix-term/src/main.rs
index a62c54a4..132ee796 100644
--- a/helix-term/src/main.rs
+++ b/helix-term/src/main.rs
@@ -118,16 +118,16 @@ FLAGS:
// Before setting the working directory, resolve all the paths in args.files
for (path, _) in args.files.iter_mut() {
- *path = helix_core::path::get_canonicalized_path(path);
+ *path = helix_stdx::path::canonicalize(&path);
}
// NOTE: Set the working directory early so the correct configuration is loaded. Be aware that
// Application::new() depends on this logic so it must be updated if this changes.
if let Some(path) = &args.working_directory {
- helix_loader::set_current_working_dir(path)?;
+ helix_stdx::env::set_current_working_dir(path)?;
} else if let Some((path, _)) = args.files.first().filter(|p| p.0.is_dir()) {
// If the first file is a directory, it will be the working directory unless -w was specified
- helix_loader::set_current_working_dir(path)?;
+ helix_stdx::env::set_current_working_dir(path)?;
}
let config = match Config::load_default() {
diff --git a/helix-term/src/ui/mod.rs b/helix-term/src/ui/mod.rs
index 660bbfea..efa2473e 100644
--- a/helix-term/src/ui/mod.rs
+++ b/helix-term/src/ui/mod.rs
@@ -409,7 +409,7 @@ pub mod completers {
use std::path::Path;
let is_tilde = input == "~";
- let path = helix_core::path::expand_tilde(Path::new(input));
+ let path = helix_stdx::path::expand_tilde(Path::new(input));
let (dir, file_name) = if input.ends_with(std::path::MAIN_SEPARATOR) {
(path, None)
@@ -430,7 +430,7 @@ pub mod completers {
match path.parent() {
Some(path) if !path.as_os_str().is_empty() => path.to_path_buf(),
// Path::new("h")'s parent is Some("")...
- _ => helix_loader::current_working_dir(),
+ _ => helix_stdx::env::current_working_dir(),
}
};
diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs
index 08a367ba..4be5a11e 100644
--- a/helix-term/src/ui/picker.rs
+++ b/helix-term/src/ui/picker.rs
@@ -63,7 +63,7 @@ impl PathOrId {
fn get_canonicalized(self) -> Self {
use PathOrId::*;
match self {
- Path(path) => Path(helix_core::path::get_canonicalized_path(&path)),
+ Path(path) => Path(helix_stdx::path::canonicalize(path)),
Id(id) => Id(id),
}
}