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

Support completion candidates that are shorter than the input #750

Merged
merged 1 commit into from
Dec 5, 2023

Conversation

gwenn
Copy link
Collaborator

@gwenn gwenn commented Dec 2, 2023

Fix #748

@sharkdp
Copy link

sharkdp commented Dec 4, 2023

This works great — thank you very much!

I had to patch rustyline-derive in order for this branch to compile (not sure if this is the right fix though):

diff --git a/rustyline-derive/src/lib.rs b/rustyline-derive/src/lib.rs
index 5f57060..c25e616 100644
--- a/rustyline-derive/src/lib.rs
+++ b/rustyline-derive/src/lib.rs
@@ -126,8 +126,8 @@ pub fn highlighter_macro_derive(input: TokenStream) -> TokenStream {
                     ::rustyline::highlight::Highlighter::highlight_candidate(&self.#field_name_or_index, candidate, completion)
                 }
 
-                fn highlight_char(&self, line: &str, pos: usize) -> bool {
-                    ::rustyline::highlight::Highlighter::highlight_char(&self.#field_name_or_index, line, pos)
+                fn highlight_char(&self, line: &str, pos: usize, forced: bool) -> bool {
+                    ::rustyline::highlight::Highlighter::highlight_char(&self.#field_name_or_index, line, pos, forced)
                 }
             }
         }

@gwenn
Copy link
Collaborator Author

gwenn commented Dec 4, 2023

I had to patch rustyline-derive in order for this branch to compile (not sure if this is the right fix though):

Indeed, I don't understand why there is no error when examples are compiled !
Currently, there is no check / usage of get_field_by_attr(&input.data, "Highlighter")

@gwenn gwenn merged commit 5ac1ad2 into kkawakam:master Dec 5, 2023
2 checks passed
@gwenn gwenn deleted the complete_symbol branch December 5, 2023 17:49
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.

CompletionType::List does not support completion candidates that are shorter than the input
2 participants