Skip to content

dotnet-suggest: ZSH shim  #1618

Closed
Closed

Description

@JohnnyWombwell

Hi, is there an example of a dotnet-suggest z-shell shim script somewhere?

I would have expected to find an example somewhere but my google skills are failing me :|

Activity

  1. baronfel commented on Feb 6, 2022

    @baronfel
    Member

    There's an example here on the Microsoft docs, but it is fairly basic completion.

    With the move towards supporting more rich completions in beta2, we'd like to look into more zsh integrations that show descriptions for tab-completions. Does this sound like something that's useful for you? Do you have any particular CLI tools that have good completions in zsh that you'd prefer?

  2. added
    Area-Completions
    on Feb 6, 2022
  3. JohnnyWombwell commented on Feb 6, 2022

    @JohnnyWombwell
    ContributorAuthor

    Sorry, I was referring to a shim for the dotnet-suggest global tool. So the equivalent of this bash shim https://github.com/dotnet/cli/blob/master/scripts/register-completions.bash

  4. JohnnyWombwell commented on Feb 11, 2022

    @JohnnyWombwell
    ContributorAuthor

    @baronfel, to answer your questions, yes, more descriptive autocompletions would be something we'd use. Anything that helps our users discover the features they need (or didn't know they needed 😄) is welcome.

    In terms of other applications that have useful completion functionality, just the obvious ones really, git and docker do a very nice job in this regard (and our users, devs, are familiar with this model).

  5. JohnnyWombwell commented on Feb 11, 2022

    @JohnnyWombwell
    ContributorAuthor

    So, I'm no authority on zsh completions but this seems to do the job. (obviously, it's an adaptation of the existing bash shim).

    _dotnet_suggest_complete()
    {
        local fullpath=`which ${words[1]}`
        local position line
        read -nl position
        position=$(($position-1))
        read -l line
        line=$(echo "${line}" | sed s/\"/'\\\"'/g)
        local completions=`dotnet-suggest get --executable "$fullpath" --position ${position} -- "${line}"`
        reply=( "${(ps:\n:)completions}" )
    }
    
    compctl -K _dotnet_suggest_complete + -f `dotnet-suggest list`
  6. jonsequitur commented on Feb 13, 2022

    @jonsequitur
    Contributor

    Would you be interested in submitting a PR, @JohnnyWombwell?

  7. JohnnyWombwell commented on Feb 14, 2022

    @JohnnyWombwell
    ContributorAuthor

    Yeah sure, I'd be happy to.

    I'm away on vacation until the end of the month so will get back to it in March.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-Completionsgood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions