Add language layer for Protocol Buffers.
This commit is contained in:
parent
12eacab665
commit
b08faa730e
23
layers/+lang/protobuf/README.org
Normal file
23
layers/+lang/protobuf/README.org
Normal file
|
@ -0,0 +1,23 @@
|
|||
#+TITLE: Protocol Buffers layer
|
||||
#+HTML_HEAD_EXTRA: <link rel="stylesheet" type="text/css" href="../../../css/readtheorg.css" />
|
||||
|
||||
* Table of Contents :TOC_4_org:noexport:
|
||||
- [[Description][Description]]
|
||||
- [[Features][Features]]
|
||||
- [[Install][Install]]
|
||||
|
||||
* Description
|
||||
Highlighting and syntax checking for [[https://developers.google.com/protocol-buffers/][Protocol Buffer]] files.
|
||||
|
||||
Uses Google's [[https://github.com/google/protobuf/blob/master/editors/protobuf-mode.el][protobuf-mode]] with [[https://github.com/edvorg/flycheck-protobuf][flycheck-protobuf]].
|
||||
|
||||
* Features
|
||||
+ Syntax Highlighting
|
||||
+ Syntax checking using Flycheck (=protoc= compiler must be available)
|
||||
+ Correct Indentation and commenting
|
||||
+ Quickly browse file contents using =M-x helm-imenu= and =M-x imenu=.
|
||||
|
||||
* Install
|
||||
To use this configuration layer, add it to your =~/.spacemacs=. You will need to
|
||||
add =protobuf= to the existing =dotspacemacs-configuration-layers= list in this
|
||||
file.
|
36
layers/+lang/protobuf/packages.el
Normal file
36
layers/+lang/protobuf/packages.el
Normal file
|
@ -0,0 +1,36 @@
|
|||
;;; packages.el --- Protocol Buffers Layer packages File for Spacemacs
|
||||
;;
|
||||
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
|
||||
;;
|
||||
;; Author: Amol Mandhane <https://github.com/amol-mandhane>
|
||||
;; URL: https://github.com/syl20bnr/spacemacs
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
;;
|
||||
;;; License: GPLv3
|
||||
|
||||
(setq protobuf-packages
|
||||
'(
|
||||
protobuf-mode
|
||||
flycheck-protobuf
|
||||
))
|
||||
|
||||
(defun protobuf/init-protobuf-mode ()
|
||||
(use-package protobuf-mode
|
||||
:init (progn
|
||||
(defun spacemacs//setup-protobuf-imenu ()
|
||||
"Setup imenu regex for protocol buffers."
|
||||
(setq imenu-generic-expression '((nil "^[[:space:]]*\\(message\\|service\\|enum\\)[[:space:]]+\\([[:alnum:]]+\\)"
|
||||
2))))
|
||||
(add-hook 'protobuf-mode-hook 'spacemacs//setup-protobuf-imenu))))
|
||||
|
||||
(defun protobuf/init-flycheck-protobuf ()
|
||||
(use-package flycheck-protobuf))
|
||||
|
||||
(when (configuration-layer/package-usedp 'flycheck)
|
||||
(defun protobuf/post-init-flycheck-protobuf ()
|
||||
(with-eval-after-load 'flycheck-protobuf
|
||||
(require 'flycheck)
|
||||
(require 'flycheck-protobuf)
|
||||
(add-to-list 'flycheck-checkers 'protobuf-protoc-reporter
|
||||
t))))
|
Loading…
Reference in a new issue