Skip to content

Commit 8e9d25e

Browse files
committed
Extend dotnet completions documentation
.NET 10 introduces `dotnet completions script nushell`. I took the opportunity to try and update the dotnet completions, to test if it works and what works, but ultimately concluded that it's incomplete/unusable as is. I updated the README.md with my findings. I assume `dotnet complete` is currently missing and will be extended with `dotnet completions` completions eventually. I'm not sure whether the current extern export is preferable over an external completer configuration, but it seems plausibly preferable to me, because it doesn't mix with other external completer configurations and is used earlier in the completion chain before falling back to external completers. If that is the case, the dotnet command generates suboptimal completion configuration.
1 parent ff80927 commit 8e9d25e

File tree

1 file changed

+43
-3
lines changed

1 file changed

+43
-3
lines changed
Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# .NET CLI completions
22

33
Completions for the .NET CLI (`dotnet`), which comes with .NET SDK.
4+
45
.NET is, to quote the official documentation, an "open-source developer platform for building many different types of applications".
56

67
For more information, see
@@ -9,6 +10,45 @@ For more information, see
910
- [CLI documentation](https://learn.microsoft.com/en-us/dotnet/core/tools/),
1011
- [General dotnet documentation](https://learn.microsoft.com/en-us/dotnet/fundamentals/).
1112

12-
This plugin uses built-in `dotnet complete` command, which unfortunately does not provide comments for the completions.
13-
On the other hand, it is officially supported, and completions are always in sync with the installed .NET SDK.
14-
For hand-crafted completions, see ones generated from Fish: (../auto-generate/completions/dotnet.nu).
13+
## SDK dependency and Limitations
14+
15+
This plugin uses built-in `dotnet complete` command. Unfortunately, it does not cover all capabilities of Nushell, like completion comments.
16+
(See [capabilities](https://learn.microsoft.com/en-us/dotnet/core/tools/enable-tab-autocomplete#completion-capabilities).)
17+
18+
Despite being the official, native, integrated completion mechanism, `dotnet complete` may not cover all commands.
19+
For example, version 10.0.100 does not cover the new `dotnet completions` commands.
20+
21+
For hand-crafted completions, see other completions like the ones generated from Fish located in (../auto-generate/completions/dotnet.nu).
22+
23+
## .NET SDK 10 and `dotnet completions`
24+
25+
From the .NET SDK version 10 onwards, the `dotnet` CLI offers `dotnet completions script nushell` that generaltes a Nushell external completer configuration.
26+
Unfortunately, it is not directly pluggable, but more of a mix of generated forwarding completer and manual configuration integration guide:
27+
28+
```nushell
29+
# Add the following content to your config.nu file:
30+
31+
let external_completer = { |spans|
32+
{
33+
dotnet: { ||
34+
dotnet complete (
35+
$spans | skip 1 | str join " "
36+
) | lines
37+
}
38+
} | get $spans.0 | each { || do $in }
39+
}
40+
41+
# And then in the config record, find the completions section and add the
42+
# external_completer that was defined earlier to external:
43+
44+
let-env config = {
45+
# your options here
46+
completions: {
47+
# your options here
48+
external: {
49+
# your options here
50+
completer: $external_completer # add it here
51+
}
52+
}
53+
}
54+
```

0 commit comments

Comments
 (0)