You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is big difference between custom completions that can be specified in a command's signature, and the "global" external completer (`$env.config.completions.external.completer`).
449
+
450
+
The former is added to individual parameters, while the latter provides completions for all arguments of (external) commands.
451
+
452
+
This makes using custom commands that wrap external commands awkward. The global external completer won't provide completions for the wrapper command and adding completions to that command uses a completely different API. It would be nice to be able to use the external completer's API for custom completions, or use the external completer for wrapper commands...
453
+
454
+
#### `@complete external`
455
+
456
+
Now it's possible to explicitly enable the global external completer for `extern` and custom command `def`initions:
457
+
458
+
```nushell
459
+
@complete external
460
+
def --wrapped jc [...args] {
461
+
^jc ...$args | from json
462
+
}
463
+
```
464
+
465
+
#### `@complete <completer>`
466
+
467
+
Instead of using the external completer, command-wide custom completers can be used for specific commands:
### Add `$nu.is-lsp` to help with printing in lsp mode ([#16635])
423
537
When nushell is launched with the `--lsp` flag, nushell will set `$nu.is-lsp` to true so that users can programmatically know when nushell is in LSP mode.
424
538
@@ -594,31 +708,6 @@ The `str length` command now has a `--chars` flag to allow you to count characte
594
708
5
595
709
```
596
710
597
-
### Simple syntax for simple completions ([#16789])
598
-
599
-
Custom completions are powerful, able to provide dynamic completions based on what's written on the command line so far.
600
-
601
-
But you don't always need that power. In fact, for most cases a simple static list of options is enough.
602
-
603
-
To make it simpler and more concise to meet this need, this release adds a new way to define completions for command parameters:
604
-
```ansi:no-line-numbers
605
-
[1;36mdef[0m [32mgo[0m [1;32m[
606
-
direction: string@[ left up right down ]
607
-
][0m [1;32m{[0m[1;32m
608
-
[0m[35m$direction[0m[1;32m
609
-
[0m[1;32m}[0m
610
-
```
611
-
612
-
Completions can be provided as a list of strings inline in the command signature, or stored in a `const` variable and used like that.
When you run `each` over a list (or stream), it can only return a single item for each input. When we need to create multiple values from a single input, we can just return a list in the closure and run the output through `flatten`.
There is big difference between custom completions that can be specified in a command's signature, and the "global" external completer (`$env.config.completions.external.completer`).
688
-
689
-
The former is added to individual parameters, while the latter provides completions for all arguments of (external) commands.
690
-
691
-
This makes using custom commands that wrap external commands awkward. The global external completer won't provide completions for the wrapper command and adding completions to that command uses a completely different API. It would be nice to be able to use the external completer's API for custom completions, or use the external completer for wrapper commands...
692
-
693
-
#### `@complete external`
694
-
695
-
Now it's possible to explicitly enable the global external completer for `extern` and custom command `def`initions:
696
-
697
-
```nushell
698
-
@complete external
699
-
def --wrapped jc [...args] {
700
-
^jc ...$args | from json
701
-
}
702
-
```
703
-
704
-
#### `@complete <completer>`
705
-
706
-
Instead of using the external completer, command-wide custom completers can be used for specific commands:
### Aliases are now expanded before being sent to external completers ([#16640])
925
+
926
+
Before this change, when an external completer was invoked for an alias, the first argument sent to the completer would be the alias itself instead of the aliased command.
927
+
928
+
For example, with an alias defined as `alias gl = git log`, typing `gl branch_name` and pressing `TAB` would send the arguments `gl`, `log`, `branch_name` to the external completer.
929
+
930
+
After this change, the alias is expanded and the arguments sent to the external completer will be `git`, `log`, `branch_name`.
931
+
925
932
### Discard `path add` input ([#16606])
926
933
Previously `path add` (from `std/util`) could fail if it was fed `any` input.
927
934
```ansi:no-line-numbers
@@ -946,14 +953,6 @@ Now any input to `path add` will be discarded. It's still possible to pass it wi
946
953
[a b c] | each {|p| $env.HOME | path join $p } | path add $in
947
954
```
948
955
949
-
### Aliases are now expanded before being sent to external completers ([#16640])
950
-
951
-
Before this change, when an external completer was invoked for an alias, the first argument sent to the completer would be the alias itself instead of the aliased command.
952
-
953
-
For example, with an alias defined as `alias gl = git log`, typing `gl branch_name` and pressing `TAB` would send the arguments `gl`, `log`, `branch_name` to the external completer.
954
-
955
-
After this change, the alias is expanded and the arguments sent to the external completer will be `git`, `log`, `branch_name`.
956
-
957
956
### Fixed IR evaluation error caused by redirecting output of branched blocks ([#16676])
958
957
959
958
The following commands will no longer raise ir-eval errors:
0 commit comments