Skip to content

feat: add fish-like inline auto suggestion - #1003

Merged
HalFrgrd merged 6 commits into
HalFrgrd:masterfrom
elseawhy:feature/ghost-text-suggestions
Sep 20, 2026
Merged

HalFrgrd merged 6 commits into
HalFrgrd:masterfrom
elseawhy:feature/ghost-text-suggestions

Conversation

@elseawhy

@elseawhy elseawhy commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1002

Quick demo:

Video_2026-09-17_00-20-49.mp4

This pr:

  • Replaced show_inline_history with auto_suggest_inline
  • auto_suggest_inline is enabled by default
  • User can disable auto-suggest but still get inline suggestion as long as auto-suggest-inline isnt disabled
  • Show suggestions for commands from bash-completion ( requires bash-completion to be installed )
  • e.g doing git a suggests dd even without history
  • Supports path completion
  • Caches suggestions while typing so screen doesn't flicker

Tldr:
Adds fish-like suggestion

  • Suggests history first
  • If no history, suggest command/file/flag as fallback

@elseawhy
elseawhy force-pushed the feature/ghost-text-suggestions branch from 60d2ea4 to 79afc1e Compare September 16, 2026 13:46
@elseawhy
elseawhy marked this pull request as draft September 16, 2026 14:05
@elseawhy
elseawhy force-pushed the feature/ghost-text-suggestions branch 8 times, most recently from 1eef855 to 1997444 Compare September 16, 2026 15:55
@elseawhy
elseawhy force-pushed the feature/ghost-text-suggestions branch from 1997444 to a001f4e Compare September 16, 2026 15:57
@elseawhy
elseawhy marked this pull request as ready for review September 16, 2026 16:03
@elseawhy

Copy link
Copy Markdown
Contributor Author

Should i keep show-inline-history ?

@HalFrgrd

Copy link
Copy Markdown
Owner

I like this idea too.

I've cleaned up the code and fixed some bugs. Namely, we should only run this when the cursor is at the end. I've added the idea of "promoting" the background tab completion result instead of rerunning tab completions when we press tab.

I want to keep mutual exclusivity of inline history suggestions, inline auto suggestion, popup auto suggestions.

@HalFrgrd

Copy link
Copy Markdown
Owner

Let me know what you think of the changes / altered behaviour!

@elseawhy

elseawhy commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor Author

Good ideas.. Im testing it right now and I found some bugs, one of them is aliased command related, am looking into it :)

Edit: Nevermind it is caused by another bash script that i sourced for bash completion...

@elseawhy

Copy link
Copy Markdown
Contributor Author

Found a bug where auto_started was leaking from old word to the new word.

How to reproduce:

  1. git log(space)(tab)(backspace)

expected behavior is that the space gets erased, what actually happens is the space did get erased but was immediately replaced as if backspace was never done

@elseawhy

elseawhy commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor Author
❯ git diff src/app/mod.rs 
diff --git a/src/app/mod.rs b/src/app/mod.rs
index 89ddf6a..4c218e9 100644
--- a/src/app/mod.rs
+++ b/src/app/mod.rs
@@ -2446,19 +2446,12 @@ impl<'a> App<'a> {
                 }
                 CompletionAction::Restart { carry_over } => {
                     self.dismissed_tab_completion_wuc = None;
-                    let previous_suggestions = self.take_active_suggestions();
+                    let previous_suggestions = self.take_active_suggestions().filter(|_| carry_over);
                     let was_auto_started = previous_suggestions
                         .as_ref()
-                        .map(|previous_active| previous_active.auto_started)
+                        .map(|p| p.auto_started)
                         .unwrap_or(true);
-                    self.start_tab_complete(
-                        was_auto_started,
-                        if carry_over {
-                            previous_suggestions
-                        } else {
-                            None
-                        },
-                    );
+                    self.start_tab_complete(was_auto_started, previous_suggestions);
                 }
             }
         }

Testing this right now :)

Edit: Seems to have fixed it, this should fix the leak and prevent tab completion from running a second time if we hit backspace

@elseawhy
elseawhy force-pushed the feature/ghost-text-suggestions branch from 9decd3c to b675dac Compare September 20, 2026 16:33
@elseawhy

elseawhy commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor Author

i saw that in commit 8b6f6e4 you reverted this

                    let prev = self.take_active_suggestions().filter(|_| carry_over);
                    self.start_tab_complete(prev.as_ref().is_none_or(|p| p.auto_started), prev);

was it because of the is_none_or ? cause i was like wait, i remember fixing this specific bug a couple days ago HAHA

@HalFrgrd

HalFrgrd commented Sep 20, 2026 •

Copy link
Copy Markdown
Owner

i saw that in commit 8b6f6e4 you reverted this

                    let prev = self.take_active_suggestions().filter(|_| carry_over);
                    self.start_tab_complete(prev.as_ref().is_none_or(|p| p.auto_started), prev);

was it because of the is_none_or ? cause i was like wait, i remember fixing this specific bug a couple days ago HAHA

Ah sorry, that was not meant to be changed. your solution was good

@elseawhy
elseawhy force-pushed the feature/ghost-text-suggestions branch from b675dac to ab11c1f Compare September 20, 2026 17:08
@elseawhy

Copy link
Copy Markdown
Contributor Author

Sweet
There, should be good now :)

@HalFrgrd
HalFrgrd merged commit 29e03d0 into HalFrgrd:master Sep 20, 2026
7 checks passed
@elseawhy
elseawhy deleted the feature/ghost-text-suggestions branch September 20, 2026 17:57
HalFrgrd pushed a commit that referenced this pull request Sep 20, 2026
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.

Ghost-text suggestion for commands, not just history [FEATURE REQUEST]

2 participants