Merge branch 'add-go-extention' into 'master'
add first draft of golang extention for fg42 See merge request FG42/FG42!9
This commit is contained in:
commit
f075bc78d9
|
@ -31,6 +31,7 @@
|
|||
'clojure
|
||||
'haskell
|
||||
'php
|
||||
'go
|
||||
'common-lisp
|
||||
'python
|
||||
'arduino
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
;;; GoExtention --- Enable Golang support in FG42
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
(require 'fpkg)
|
||||
(require 'fg42/extension)
|
||||
(require 'extensions/go/init)
|
||||
|
||||
;; dependencies
|
||||
|
||||
(depends-on 'go-mode)
|
||||
(depends-on 'go-add-tags)
|
||||
(depends-on 'go-stacktracer)
|
||||
(depends-on 'go-eldoc)
|
||||
(depends-on 'gotest)
|
||||
(depends-on 'exec-path-from-shell)
|
||||
|
||||
|
||||
(extension go
|
||||
:version 0.0.1
|
||||
:on-initialize extensions/go-initialize
|
||||
:docs "lib/extensions/go/readme.org")
|
||||
(provide 'extensions/go)
|
||||
;;; go.el ends here
|
|
@ -0,0 +1,33 @@
|
|||
;;; go-init --- The entry point for golang extension
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
|
||||
(defun fg42-go-hook ()
|
||||
;; move to action
|
||||
"Set's up emacs hooks and turn necessary modes on."
|
||||
(lsp)
|
||||
(with-ability yas
|
||||
(yas-minor-mode-on))
|
||||
(add-hook 'before-save-hook #'lsp-format-buffer t t)
|
||||
(add-hook 'before-save-hook #'lsp-organize-imports t t)
|
||||
(add-hook 'go-mode-hook 'go-eldoc-setup)
|
||||
(local-set-key (kbd "M-.") #'godef-jump)
|
||||
(local-set-key (kbd "M-*") 'pop-tag-mark))
|
||||
|
||||
|
||||
|
||||
(defun go-path ()
|
||||
"Gets gopath from OS env."
|
||||
(exec-path-from-shell-copy-env "GOPATH"))
|
||||
(defun go-path-binary ()
|
||||
"Gets Go binaries path."
|
||||
(concat (go-path) "/bin"))
|
||||
|
||||
(defun extensions/go-initialize ()
|
||||
"Initialize Golang extension."
|
||||
(exec-path-from-shell-initialize)
|
||||
(add-to-list 'exec-path (go-path-binary))
|
||||
(add-hook 'go-mode-hook 'fg42-go-hook))
|
||||
|
||||
(provide 'extensions/go/init)
|
||||
;;; init ends here.
|
|
@ -0,0 +1,8 @@
|
|||
;;; Compiled snippets and support files for `go-mode'
|
||||
;;; Snippet definitions:
|
||||
;;;
|
||||
(yas-define-snippets 'go-mode
|
||||
'(("err" "if err != nil {\n\n}\n" "err_check" nil nil nil "/home/amirreza/.fg42/lib/snippets/go-mode/err_check" nil nil)))
|
||||
|
||||
|
||||
;;; Do not edit! File generated at Sun Feb 23 22:37:27 2020
|
|
@ -0,0 +1,8 @@
|
|||
# name: err_check
|
||||
# key: err
|
||||
# contributor: amirrezaask <raskarpour@gmail.com>
|
||||
# --
|
||||
|
||||
if err != nil {
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
;;; Compiled snippets and support files for `js-mode'
|
||||
;;; Snippet definitions:
|
||||
;;;
|
||||
(yas-define-snippets 'js-mode
|
||||
'(("resource" "{\n \"name\": \"$1\",\n \"fields\": [\n $0\n ],\n \"no_filter\": ${2:$$(yas-choose-value '(\"true\" \"false\"))},\n \"title-field\": \"$3\"\n}\n" "resource"
|
||||
(featurep 'flymake-json)
|
||||
nil nil "/home/amirreza/.fg42/lib/snippets/js-mode/resource" nil nil)
|
||||
("in" "{\n \"name\": \"$1\",\n \"type\": \"in\",\n \"bulk\": ${2:$$(yas-choose-value '(\"true\" \"false\"))},\n \"to\": [\n $0\n ]\n},\n" "in"
|
||||
(featurep 'flymake-json)
|
||||
nil nil "/home/amirreza/.fg42/lib/snippets/js-mode/in" nil nil)
|
||||
("hm" "{\n \"name\": \"$1\",\n \"type\": \"has_many\",\n \"bulk\": ${2:$$(yas-choose-value '(\"true\" \"false\"))},\n \"to\": \"${1:$(pluralize-string yas-text)}\"\n},\n $0" "has_many"
|
||||
(featurep 'flymake-json)
|
||||
nil nil "/home/amirreza/.fg42/lib/snippets/js-mode/has_many" nil nil)
|
||||
("ff" "{\n \"name\": \"$1\",\n \"type\": \"${2:$$(yas-choose-value '(\"string\" \"integer\" \"datetime\" \"float\" \"image\" \"in\" \"belongs_to\" \"has_many\"))}\",\n \"bulk\": ${3:$$(yas-choose-value '(\"true\" \"false\"))}\n},\n $0" "field"
|
||||
(featurep 'flymake-json)
|
||||
nil nil "/home/amirreza/.fg42/lib/snippets/js-mode/field" nil nil)
|
||||
("bt" "{\n \"name\": \"$1\",\n \"type\": \"belongs_to\",\n \"bulk\": ${2:$$(yas-choose-value '(\"true\" \"false\"))},\n \"to\": \"${1:$(pluralize-string yas-text)}\"\n},\n $0" "belongs_to"
|
||||
(featurep 'flymake-json)
|
||||
nil nil "/home/amirreza/.fg42/lib/snippets/js-mode/belongs_to" nil nil)))
|
||||
|
||||
|
||||
;;; Do not edit! File generated at Sun Feb 23 22:37:27 2020
|
|
@ -0,0 +1,2 @@
|
|||
;;; Compiled snippets and support files for `web-mode'
|
||||
;;; Do not edit! File generated at Sun Feb 23 22:37:27 2020
|
Loading…
Reference in New Issue