Closed farhaven closed 1 year ago
I'm not sure how I'd like that feature turned on by default and it'd also change the current behavior which might come as a surprise to the users. Maybe it should be a new flag (-E?).
I've submitted a PR that addresses this request, if only to have some actual code to talk about. I've done what you suggested: kept the old -e
behaviour (almost) as it is at the moment (except that the "no completion" text is now also printed to stdout instead of stderr, it was just a bit easier to juggle text output this way), and a new flag -E
triggers this new kind of completion.
When using
L comp -e
, if there is more than one match for the pattern under the cursor, the matches are printed out. It'd be nice to have the first match inserted and selected so that it can be easily removed again.I'd find this useful especially for Go code using generated protobuf packages, because those often have multiple matches for patterns where the first match is almost always the right thing since the generated code contains a
GetFoo
function for every fieldFoo
, so that runningL comp -e
on(with
|
being the cursor position)yields suggestions like
Does this make sense? If so, I think I can prepare a PR.