浏览代码

feat(dotnet): update completion script (#12028)

Jasmin 1 年之前
父节点
当前提交
48ccc7b36d
共有 1 个文件被更改,包括 7 次插入15 次删除
  1. 7 15
      plugins/dotnet/dotnet.plugin.zsh

+ 7 - 15
plugins/dotnet/dotnet.plugin.zsh

@@ -1,22 +1,14 @@
 # This scripts is copied from (MIT License):
 # This scripts is copied from (MIT License):
-# https://github.com/dotnet/toolset/blob/master/scripts/register-completions.zsh
+# https://raw.githubusercontent.com/dotnet/sdk/main/scripts/register-completions.zsh
 
 
-_dotnet_zsh_complete() 
-{
-  local completions=("$(dotnet complete "$words")")
-
-  # If the completion list is empty, just continue with filename selection
-  if [ -z "$completions" ]
-  then
-    _arguments '*::arguments: _normal'
-    return
-  fi
-
-  # This is not a variable assignment, don't remove spaces!
-  _values = "${(ps:\n:)completions}"
+#compdef dotnet
+_dotnet_completion() {
+  local -a completions=("${(@f)$(dotnet complete "${words}")}")
+  compadd -a completions
+  _files
 }
 }
 
 
-compdef _dotnet_zsh_complete dotnet
+compdef _dotnet_completion dotnet
 
 
 # Aliases bellow are here for backwards compatibility
 # Aliases bellow are here for backwards compatibility
 # added by Shaun Tabone (https://github.com/xontab) 
 # added by Shaun Tabone (https://github.com/xontab)