mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 13:06:08 +02:00
Make hints aware of the current directory (#10780)
This commit uses the new `CwdAwareHinter` in reedline. Closes #8883. # Description Currently, the history based hints show results from all directories, while most commands make sense only in the directory they were run in. This PR makes hints take the current directory into account. # User-Facing Changes Described above. I haven't yet added a config option for this, because I personally believe folks won't be against it once they try it out. We can add it if people complain, there's some time before the next release. Fish has this without a config option too. # Tests + Formatting If tests are needed, I'll need help as I'm not well versed with the codebase.
This commit is contained in:
@ -22,8 +22,8 @@ use nu_protocol::{
|
||||
};
|
||||
use nu_utils::utils::perf;
|
||||
use reedline::{
|
||||
CursorConfig, DefaultHinter, EditCommand, Emacs, FileBackedHistory, HistorySessionId, Reedline,
|
||||
SqliteBackedHistory, Vi,
|
||||
CursorConfig, CwdAwareHinter, EditCommand, Emacs, FileBackedHistory, HistorySessionId,
|
||||
Reedline, SqliteBackedHistory, Vi,
|
||||
};
|
||||
use std::{
|
||||
env::temp_dir,
|
||||
@ -302,7 +302,7 @@ pub fn evaluate_repl(
|
||||
line_editor.with_hinter(Box::new({
|
||||
// As of Nov 2022, "hints" color_config closures only get `null` passed in.
|
||||
let style = style_computer.compute("hints", &Value::nothing(Span::unknown()));
|
||||
DefaultHinter::default().with_style(style)
|
||||
CwdAwareHinter::default().with_style(style)
|
||||
}))
|
||||
} else {
|
||||
line_editor.disable_hints()
|
||||
|
Reference in New Issue
Block a user