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

Improve yarn run completions #74

Closed
jods4 opened this issue Dec 18, 2016 · 4 comments
Closed

Improve yarn run completions #74

jods4 opened this issue Dec 18, 2016 · 4 comments
Assignees
Labels
enhancement Planned enhancement
Milestone

Comments

@jods4
Copy link

jods4 commented Dec 18, 2016

Unlike NPM, yarn run can run local modules in addition to project.json scripts.

I managed to do that locally with the following simple changes:

local bins = matchers.create_files_matcher('node_modules/.bin/*.')
-- ... skip some parser code
"run"..parser({bins, scripts}),

And this works, with 2 limitations that I am not sure how to fix:

  • I would like to color the scripts to make them more prominent. I tried to color_text the results but it didn't work.
  • it seems create_files_matcher returns . and ... create_dirs_matcher has some code to avoid that, it should probably be added to create_files_matcher as well.
@vladimir-kotikov
Copy link
Owner

@jods4, thanks for the suggestion! Could you take a look at the linked PR? I'm not actively using Cmder these days and i'm not a yarn user so I can't verify the changes right now

@jods4
Copy link
Author

jods4 commented Dec 18, 2016

@vladimir-kotikov This is exactly what I have here, works well for me!

Is it possible to colorize the completions?
If it is I would like to emphasize the scripts results in blue but I wasn't sure how to do it.

@vladimir-kotikov
Copy link
Owner

Nice, thanks for verification!

Is it possible to colorize the completions?

Unfortunately this is not possible because readline library that prints completions under the hood of clink cuts out all ANSI escape sequences.

To differentiate one options from another you might use clink.match_display_filter and add some additional symbols to selected completions (e.g. prepend ones corresponding to executables in .bin with > or *). See https://github.com/vladimir-kotikov/clink-completions/blob/master/git.lua#L158-L165 for example of this approach

@vladimir-kotikov
Copy link
Owner

Closing this for now. Please open a separate PR if you're going to update/improve the visual behavior for completions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Planned enhancement
Projects
None yet
Development

No branches or pull requests

2 participants