Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Autocomplete Support #1243

Open
JKamsker opened this issue Jun 15, 2023 · 4 comments
Open

[Feature Request] Autocomplete Support #1243

JKamsker opened this issue Jun 15, 2023 · 4 comments

Comments

@JKamsker
Copy link

JKamsker commented Jun 15, 2023

Is your feature request related to a problem? Please describe.

I'm always frustrated when using the spectre.console library in C# because it lacks autocomplete support. Without autocomplete, it becomes challenging and time-consuming to enter commands, arguments, and their values accurately. I have tried implementing autocomplete on my own for my project, but unfortunately, I was unsuccessful.

Describe alternatives you've considered

I have explored various alternatives in order to implement autocomplete functionality for my project. One approach I tried was to write the autocomplete feature from scratch, but unfortunately, my attempts were unsuccessful. Building a reliable and efficient autocomplete feature requires a considerable amount of time and effort.

As an alternative, I looked for existing libraries or frameworks that provide autocomplete functionality. However, my search did not yield any suitable options. Despite my efforts, I was unable to find a library that specifically addresses my requirements.

Considering the challenges I encountered and the lack of suitable alternatives, I believe it would be highly beneficial to have the autocomplete feature integrated into the spectre.console library as a built-in feature. This would not only save time and effort but also ensure a reliable and efficient implementation of the desired functionality.

Describe the solution you'd like

I would like the spectre.console library to have built-in autocomplete support similar to the "winget complete" command in the Windows Package Manager (winget) tool.

The autocomplete feature should provide:

  • Context-sensitive suggestions: The autocomplete feature should provide context-sensitive suggestions for command names, argument names, and argument values based on the current command line state.
  • Support for automatic and user-extensible completions: It should support both automatically generated completions and user-extensible completions, allowing developers to define and register dynamic completions at runtime.
  • Straightforward integration: The autocomplete functionality should be seamlessly integrated into the spectre.console library, providing a simple API or command that developers can use to enable and customize it within their applications.

For example:

RegisterAutocompleteCommand("spectre", (wordToComplete, commandAst, cursorPosition) =>
{
    // Autocomplete logic goes here
    // Return a list of completions based on the provided parameters
});

Additional context

Here is a sample call of the "winget complete" command for reference:

winget complete --word "c" --commandline "winget c" --position 7

Expected result:

config
complete

Please upvote 👍 this issue if you are interested in it.

@nils-a
Copy link
Contributor

nils-a commented Jun 25, 2023

Possible duplicate of #267

@JKamsker
Copy link
Author

Implemented in #1260

@patriksvensson
Copy link
Contributor

@JKamsker We keep issues open until the corresponding PR has been merged 😃

@Kissaki
Copy link
Contributor

Kissaki commented Jun 23, 2024

Nushell can use value + description for auto-completion - listing not only the options but also describing them. It would be nice if command descriptions could be used too (they can already be described with attributes for the help text), and maybe even any suggestions (static and dynamic suggestions).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress 👨‍💻
Development

No branches or pull requests

4 participants