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

Updated ensime bindings to better fit with spacemacs #600

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions contrib/lang/scala/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,78 @@ which require an initialization must be listed explicitly in the list.")
(kbd "n") 'forward-button
(kbd "N") 'backward-button)

(defun ensime-gen-and-reload()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a new function which generates an .ensime and reloads ensime, which is useful when the project changes. Sometimes it's also necessary to rm -r .ensime_cache in the project root to force ensime to notice changes to e.g. dependencies.

(interactive)
(progn
(sbt-command "gen-ensime")
(ensime-shutdown)
(ensime))
)

(evil-leader/set-key-for-mode 'scala-mode
"mg" 'ensime-edit-definition
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a temporary binding, but the function should be included in the bindings


"m." 'ensime-gen-and-reload
"m," 'ensime
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using , , and , . for ensime-server commands. Could probably be moved to some more mnemonic binding.

"mri" 'ensime-refactor-inline-local
"mrl" 'ensime-refactor-extract-local
"mrm" 'ensime-refactor-extract-method
"mro" 'ensime-refactor-organize-imports
"mrr" 'ensime-refactor-rename
"mrt" 'ensime-import-type-at-point

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not in the conventions for now but the refactoring is planned to be on SPC m R instead of SPC m r.

"mbS" 'ensime-stacktrace-switch
"mbT" 'ensime-sbt-do-test
"mbc" 'ensime-sbt-do-compile
"mbn" 'ensime-sbt-do-clean
"mbo" 'ensime-sbt-do-test-only
"mbp" 'ensime-sbt-do-package
"mbr" 'ensime-sbt-do-run
"mbs" 'ensime-sbt-switch
"mbt" 'ensime-sbt-do-test-quick

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like mb for sbt commands!

"mda" 'ensime-db-clear-all-breaks
"mdb" 'ensime-db-set-break
"mdc" 'ensime-db-continue
"mdd" 'ensime-db-start
"mdi" 'ensime-db-inspect-value-at-point
"mdl" 'ensime-db-list-locals
"mdn" 'ensime-db-next
"mdo" 'ensime-db-step-out
"mdq" 'ensime-db-quit
"mdr" 'ensime-db-run
"mds" 'ensime-db-step
"mdt" 'ensime-db-backtrace
"mdu" 'ensime-db-clear-break

"mti" 'ensime-goto-impl
"mtt" 'ensime-goto-test

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mt is reserved for tests.
At first sight these commands should go behind mg

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So ensime-goto-{test,impl} is used to jump between test and implementation files, so it's not a mismatch with spacemacs conventions if we want to keep them this way.

"mca" 'ensime-typecheck-all
"mcc" 'ensime-typecheck-current-file
"mce" 'ensime-show-all-errors-and-warnings
"mcr" 'ensime-reload-open-files

"mvR" 'ensime-inf-eval-region
"mv." 'ensime-expand-selection-command
"mvb" 'ensime-inf-eval-buffer
"mvd" 'ensime-show-doc-for-symbol-at-point
"mve" 'ensime-print-errors-at-point
"mvf" 'ensime-format-source
"mvi" 'ensime-inspect-type-at-point
"mvI" 'ensime-inspect-type-at-point-other-frame
"mvl" 'ensime-inf-load-file
"mvo" 'ensime-inspect-project-package
"mvp" 'ensime-inspect-package-at-point
"mvr" 'ensime-show-uses-of-symbol-at-point
"mvs" 'ensime-sbt-switch
"mvt" 'ensime-print-type-at-point
"mvu" 'ensime-undo-peek
"mvv" 'ensime-search
"mvx" 'ensime-scalex
"mvz" 'ensime-inf-switch
)

;; Don't use scala checker if ensime mode is active, since it provides
;; better error checking.
(eval-after-load 'flycheck
Expand Down