-
Notifications
You must be signed in to change notification settings - Fork 71
autocomplete: allow completion based on name/detail of exisiting results for parameter #165
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -410,7 +410,7 @@ func (t *autoCompleter) Do(line []rune, pos int) (options [][]rune, offset int) | |||||||
| return argOptions[i].Value < argOptions[j].Value | ||||||||
| }) | ||||||||
| for _, item := range argOptions { | ||||||||
| if strings.HasPrefix(item.Value, argInput) { | ||||||||
| if strings.HasPrefix(item.Value, argInput) || (len(item.Detail) > 0 && strings.HasPrefix(item.Detail, argInput)) { | ||||||||
| filteredOptions = append(filteredOptions, item) | ||||||||
| } | ||||||||
| } | ||||||||
|
|
@@ -421,12 +421,14 @@ func (t *autoCompleter) Do(line []rune, pos int) (options [][]rune, offset int) | |||||||
| } | ||||||||
| for _, item := range filteredOptions { | ||||||||
| option := item.Value + " " | ||||||||
| if len(filteredOptions) > 1 && len(item.Detail) > 0 { | ||||||||
| if len(filteredOptions) > 0 && len(item.Detail) > 0 { | ||||||||
| option += fmt.Sprintf("(%v)", item.Detail) | ||||||||
| } | ||||||||
| if strings.HasPrefix(option, argInput) { | ||||||||
| options = append(options, []rune(option[len(argInput):])) | ||||||||
| offset = len(argInput) | ||||||||
| } else if len(item.Detail) > 0 && strings.HasPrefix(item.Detail, argInput) { | ||||||||
shwstppr marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||
| options = append(options, []rune(option)) | ||||||||
|
||||||||
| options = append(options, []rune(option)) | |
| options = append(options, []rune(option)) | |
| offset = 0 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The condition change from
> 1to> 0means details will now always be shown when they exist, even for single options. This could clutter the display unnecessarily. Consider if this change aligns with the intended UX behavior.