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 autocompletion for zsh to be more context-aware for #356 #438

Merged
merged 6 commits into from
Apr 16, 2018

Conversation

rberenguel
Copy link
Contributor

@rberenguel rberenguel commented Apr 13, 2018

Fixes #356.

Copy link
Contributor

@jvican jvican left a 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 )
Copy link
Contributor

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 jvican added enhancement cli ergonomics Any change that affects developer ergonomics and the easiness of use of bloop. labels Apr 14, 2018
@rberenguel
Copy link
Contributor Author

@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?

Copy link
Contributor

@jvican jvican left a 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!

@jvican
Copy link
Contributor

jvican commented Apr 14, 2018

Fixes #356.

@jvican
Copy link
Contributor

jvican commented Apr 14, 2018

@rberenguel Btw, just a tip: you can use "Fixes #ticket-number" to tell GitHub to close the ticket when this PR is merge.

@rberenguel
Copy link
Contributor Author

Oh thanks @jvican (btw had a facepalm with the put in a val :D ) Do you think it would make sense to actually place it in Commands.scala?

Copy link
Collaborator

@Duhemm Duhemm left a 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(" ")
Copy link
Collaborator

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(" ")

Copy link
Contributor Author

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

@rberenguel
Copy link
Contributor Author

Any idea what might be up with the Windows test? bloop.nailgun.BasicNailgunSpec has failed twice in Windows (last two commits) but passes fine in Linux

@jvican
Copy link
Contributor

jvican commented Apr 15, 2018

Oh thanks @jvican (btw had a facepalm with the put in a val :D ) Do you think it would make sense to actually place it in Commands.scala?

Yeah 😄, I think that's the perfect place.

Any idea what might be up with the Windows test? bloop.nailgun.BasicNailgunSpec has failed twice in Windows (last two commits) but passes fine in Linux

It's an spurious error, we just restarted the build 👍

@rberenguel
Copy link
Contributor Author

Moved the list of project commands to Commands. Next one to tackle will be adding (scala) tests for autocompletion :)

@jvican
Copy link
Contributor

jvican commented Apr 16, 2018

Awesome, merging 😄

@jvican jvican merged commit 55e47d5 into scalacenter:master Apr 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli enhancement ergonomics Any change that affects developer ergonomics and the easiness of use of bloop.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants