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

Return only commands when completing help command's argument #973

Merged
merged 1 commit into from
Jul 5, 2024

Conversation

st0012
Copy link
Member

@st0012 st0012 commented Jun 17, 2024

The command only takes command names as arguments, so we should only return command names as candidates.

This will help users find a command faster as completion will be another useful hint too.

@st0012 st0012 added the enhancement New feature or request label Jun 17, 2024
lib/irb/completion.rb Outdated Show resolved Hide resolved
@st0012 st0012 self-assigned this Jun 17, 2024
@@ -33,6 +33,8 @@ def defined? do
yield
]

HELP_COMMAND_PREPOSING = /\Ahelp\s+/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think each command can have a completion and colorization for command arguments (as an internal api).
Do you think we should do it now or not or maybe later?
I'm thinking of something like this

if command? && argument_part?
  # pass completor so that command can fallback to completor if the arg part is a ruby code
  return command_instance._internal_complete(command_arg, completor)
end

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, we should first finish completion support for signature arguments too, like show_source and edit's, before designing any public API. This is to make sure we know what we want and don't want to expose. I also don't see too strong of a demand for such feature yet, so I think we can wait a bit.

The command only takes command names as arguments, so we should only
return command names as candidates.

This will help users find a command faster as completion will be
another useful hint too.
@st0012 st0012 force-pushed the improve-help-command-arg-completion branch from 0eb9376 to 22b016b Compare July 4, 2024 16:42
@st0012 st0012 requested a review from tompng July 4, 2024 16:45
@tompng tompng merged commit 7b6557c into master Jul 5, 2024
59 checks passed
@tompng tompng deleted the improve-help-command-arg-completion branch July 5, 2024 17:25
matzbot pushed a commit to ruby/ruby that referenced this pull request Jul 5, 2024
argument
(ruby/irb#973)

The command only takes command names as arguments, so we should only
return command names as candidates.

This will help users find a command faster as completion will be
another useful hint too.

ruby/irb@7b6557cc24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

2 participants