Skip to content

Revert #7779 (enables back subcommand completions)#8102

Merged
kubouch merged 2 commits intonushell:mainfrom
kubouch:revert-subcommand-completions
Feb 18, 2023
Merged

Revert #7779 (enables back subcommand completions)#8102
kubouch merged 2 commits intonushell:mainfrom
kubouch:revert-subcommand-completions

Conversation

@kubouch
Copy link
Contributor

@kubouch kubouch commented Feb 17, 2023

Description

Reverts the PR #7779 which breaks subcommand completions. The issues #7648 and #7754 thus still need fixing.

This reverts commit 8acced5.

User-Facing Changes

Enables subcommand completions.

Unfortunately, also brings back the completion panic if alias is shorter than the command name.

Tests + Formatting

Don't forget to add tests that cover your changes.

Make sure you've run and fixed any issues with these commands:

  • cargo fmt --all -- --check to check standard code formatting (cargo fmt --all applies these changes)
  • cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect to check that you're using the standard code style
  • cargo test --workspace to check that all tests pass

After Submitting

If your PR had any user-facing changes, update the documentation after the PR is merged, if necessary. This will help us keep the docs up to date.

…ias name is shorter than the alias command and the alias command is an external command. (nushell#7779)"

This reverts commit 8acced5.
@kubouch kubouch force-pushed the revert-subcommand-completions branch from 1dc5356 to f81e8ec Compare February 17, 2023 21:06
@kubouch
Copy link
Contributor Author

kubouch commented Feb 17, 2023

@Xoffio Unfortunately, the broken subcommand completions are a big hit in user experience that we thought it would be better to revert it. Your PR fixed the crash fine, though, it is a pity. Do you know what might have caused the subcommand completions to not work anymore?

@codecov
Copy link

codecov bot commented Feb 17, 2023

Codecov Report

Merging #8102 (f81e8ec) into main (daeb3e5) will increase coverage by 0.01%.
The diff coverage is 0.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #8102      +/-   ##
==========================================
+ Coverage   54.15%   54.17%   +0.01%     
==========================================
  Files         608      608              
  Lines       99131    99109      -22     
==========================================
+ Hits        53688    53689       +1     
+ Misses      45443    45420      -23     
Impacted Files Coverage Δ
...ates/nu-cli/src/completions/command_completions.rs 0.00% <0.00%> (ø)
crates/nu-cli/src/completions/completer.rs 0.00% <0.00%> (ø)
crates/nu-protocol/src/value/mod.rs 47.52% <0.00%> (+0.03%) ⬆️

@kubouch kubouch marked this pull request as draft February 18, 2023 14:45
@Xoffio
Copy link
Contributor

Xoffio commented Feb 18, 2023

@kubouch It is fine! I think the code related to auto completion is a bit messy. Correct me if I am wrong but I think we have like an array where all the auto completion is saved but also the aliases which makes it hard to know what we are dealing with from different sections of the code. Maybe I change the offset to avoid the crash but that might also avoid the auto completion? maybe...

@kubouch
Copy link
Contributor Author

kubouch commented Feb 18, 2023

Yes, I was just looking at the completions code and the aliases combined with manual span handling make it really messy.

I found that before your PR, the command completion created at this line

let mut completer = CommandCompletion::new(
returned correct subcommand completions (e.g. when typing config and pressing Tab). After your PR, the returned output was empty.

@kubouch kubouch marked this pull request as ready for review February 18, 2023 17:38
@kubouch kubouch added this pull request to the merge queue Feb 18, 2023
Merged via the queue into nushell:main with commit f3ee8b5 Feb 18, 2023
@kubouch kubouch deleted the revert-subcommand-completions branch February 18, 2023 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants