928983da47
This commit defines: - spacemacs-default-jump-handlers: a list of functions that can jump to definition in ALL modes. - spacemacs-jump-handlers-MODE: a list of functions that can jump to definition in MODE. - spacemacs-jump-handlers: a buffer-local list of functions that can jump to definition. This is made up of the values of the two previous variables whenever a given major mode is activated. - spacemacs/jump-to-definition: a function that tries each function in spacemacs-jump-handlers in order, and stops when one of them takes us somewhere new. - spacemacs|define-jump-handlers: a macro that * defines spacemacs-jump-handlers-MODE, possibly filled with initial functions * defines a function that is added to the hook of the given MODE * binds “SPC m g g” of that MODE to spacemacs/jump-to-definition This is an attempt to harmonize all the different approaches to jumping. Specifically, - Existing intelligent jump packages that work for only a single mode should go to the beginning of spacemacs-jump-handlers-MODE. E.g. anaconda for python, ensime for scala, etc. - Packages like gtags that work for several modes (but potentially not all) and which is dumber than the intelligent jumpers should go the the END of spacemacs-jump-handlers-MODE. - Packages like dumb-jump that work for all modes should go to spacemacs-default-jump-handlers. In all cases the order of the jump handlers in each list should be from most to least intelligent. Fixes #6619
79 lines
2.3 KiB
EmacsLisp
79 lines
2.3 KiB
EmacsLisp
;;; packages.el --- F# Layer packages File for Spacemacs
|
|
;;
|
|
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
|
|
;;
|
|
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
;;
|
|
;; This file is not part of GNU Emacs.
|
|
;;
|
|
;;; License: GPLv3
|
|
|
|
(setq fsharp-packages
|
|
'(
|
|
fsharp-mode
|
|
ggtags
|
|
helm-gtags
|
|
))
|
|
|
|
(defun fsharp/init-fsharp-mode ()
|
|
(use-package fsharp-mode
|
|
:defer t
|
|
:init
|
|
(progn
|
|
(setq fsharp-doc-idle-delay .2)
|
|
(spacemacs/register-repl 'fsharp-mode 'fsharp-show-subshell "F#")
|
|
(spacemacs|define-jump-handlers fsharp-mode fsharp-ac/gotodefn-at-point))
|
|
:config
|
|
(progn
|
|
|
|
(defun spacemacs/fsharp-load-buffer-file-focus ()
|
|
"Send the current buffer to REPL and switch to the REPL in
|
|
`insert state'."
|
|
(interactive)
|
|
(fsharp-load-buffer-file)
|
|
(switch-to-buffer-other-window inferior-fsharp-buffer-name)
|
|
(evil-insert-state))
|
|
|
|
(defun spacemacs/fsharp-eval-phrase-focus ()
|
|
"Send the current phrase to REPL and switch to the REPL in
|
|
`insert state'."
|
|
(interactive)
|
|
(fsharp-eval-phrase)
|
|
(switch-to-buffer-other-window inferior-fsharp-buffer-name)
|
|
(evil-insert-state))
|
|
|
|
(defun spacemacs/fsharp-eval-region-focus (start end)
|
|
"Send the current phrase to REPL and switch to the REPL in
|
|
`insert state'."
|
|
(interactive "r")
|
|
(fsharp-eval-region start end)
|
|
(switch-to-buffer-other-window inferior-fsharp-buffer-name)
|
|
(evil-insert-state))
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'fsharp-mode
|
|
;; Compile
|
|
"cc" 'compile
|
|
|
|
"fa" 'fsharp-find-alternate-file
|
|
|
|
"ht" 'fsharp-ac/show-tooltip-at-point
|
|
|
|
"'" 'fsharp-show-subshell
|
|
"sb" 'fsharp-load-buffer-file
|
|
"sB" 'spacemacs/fsharp-load-buffer-file-focus
|
|
"si" 'fsharp-show-subshell
|
|
"sp" 'fsharp-eval-phrase
|
|
"sP" 'spacemacs/fsharp-eval-phrase-focus
|
|
"sr" 'fsharp-eval-region
|
|
"sR" 'spacemacs/fsharp-eval-region-focus
|
|
"ss" 'fsharp-show-subshell
|
|
|
|
"xf" 'fsharp-run-executable-file))))
|
|
|
|
(defun fsharp/post-init-ggtags ()
|
|
(add-hook 'fsharp-mode-hook #'spacemacs/ggtags-mode-enable))
|
|
|
|
(defun fsharp/post-init-helm-gtags ()
|
|
(spacemacs/helm-gtags-define-keys-for-mode 'fsharp-mode))
|