mirror of
https://github.com/nushell/nushell.git
synced 2025-08-14 02:09:04 +02:00
fix(completion): DotNuCompletion
now completes nu scripts in const $NU_LIB_DIRS
(#14955)
# Description For nu scripts completion with command `use`/`overlay use`/`source-env`, it now supports `nu --include-path`. Also fixes some irrelevant clippy complaints. # User-Facing Changes # Tests + Formatting # After Submitting
This commit is contained in:
@ -282,7 +282,7 @@ fn try_find_id_in_use(
|
||||
id: Option<&Id>,
|
||||
) -> Option<(Id, Span)> {
|
||||
let call_name = working_set.get_span_contents(call.head);
|
||||
if call_name != b"use" && call_name != b"hide" {
|
||||
if call_name != b"use" && call_name != b"export use" && call_name != b"hide" {
|
||||
return None;
|
||||
}
|
||||
// TODO: for keyword `hide`, the decl/var is already hidden in working_set,
|
||||
@ -318,7 +318,7 @@ fn try_find_id_in_use(
|
||||
if let Some(pos) = location {
|
||||
// first argument of `use` should always be module name
|
||||
// while it is optional in `hide`
|
||||
if span.contains(*pos) && call_name == b"use" {
|
||||
if span.contains(*pos) && call_name != b"hide" {
|
||||
return get_matched_module_id(working_set, span, id);
|
||||
}
|
||||
}
|
||||
@ -338,7 +338,7 @@ fn try_find_id_in_use(
|
||||
})
|
||||
};
|
||||
|
||||
let arguments = if call_name == b"use" {
|
||||
let arguments = if call_name != b"hide" {
|
||||
call.arguments.get(1..)?
|
||||
} else {
|
||||
call.arguments.as_slice()
|
||||
|
Reference in New Issue
Block a user