-
Notifications
You must be signed in to change notification settings - Fork 202
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 autocompletion for zsh to be more context-aware for #356 #438
Improve autocompletion for zsh to be more context-aware for #356 #438
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great 👍 Thanks for taking the time to get this working!
etc/zsh/_bloop
Outdated
|
||
_arguments $results | ||
_project_or_flags() { | ||
local project_bound_cmd=( clean compile run test console ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to get the list of commands that take a project from bloop autocomplete
too? 😄
@jvican yep, done (much better now that Scala handles that). Not very happy with how the filter-map combo look, but seems to be the most seamless way to write this. Any suggestions to make it look better? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My only suggestion is that we compute https://github.com/scalacenter/bloop/pull/438/files#diff-76ca9fb9d1dc844f02765b2cf8ff9e42R220 in a val, given that it's static information that doesn't depend on the request 😄. Otherwise looks great to me!
Fixes #356. |
@rberenguel Btw, just a tip: you can use "Fixes #ticket-number" to tell GitHub to close the ticket when this PR is merge. |
…s were to change during runtime!
Oh thanks @jvican (btw had a facepalm with the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one small nitpick. Thanks a lot for the fix @rberenguel !
@@ -213,9 +214,15 @@ object Interpreter { | |||
} | |||
} | |||
|
|||
private val projectBound = CommandsMessages.messages.filter { | |||
case (name, CommandMessages(args, _)) => args.exists(_.name == "project") | |||
}.map(_._1).mkString(" ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The filter-map combo can be replaced with collect
:
private val projectBound = CommandsMessages.messages.filter {
case (name, CommandMessages(args, _)) if args.exists(_.name == "projects") => name
}.mkString(" ")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Duhemm ! I knew there was to be something in the library to do this in one go
Any idea what might be up with the Windows test? |
Yeah 😄, I think that's the perfect place.
It's an spurious error, we just restarted the build 👍 |
Moved the list of project commands to Commands. Next one to tackle will be adding (scala) tests for autocompletion :) |
Awesome, merging 😄 |
Fixes #356.