diff --git a/init.example.el b/init.example.el index 6ad2287c4..55a4953fc 100644 --- a/init.example.el +++ b/init.example.el @@ -103,6 +103,7 @@ ;rust ; Fe2O3.unwrap().unwrap().unwrap().unwrap() ;scala ; java, but good sh ; she sells (ba|z)sh shells on the C xor + ;solidity ; do you need a blockchain? No. ;swift ; who asked for emoji variables? ;web ; the tubes diff --git a/modules/lang/solidity/README.org b/modules/lang/solidity/README.org new file mode 100644 index 000000000..69214de12 --- /dev/null +++ b/modules/lang/solidity/README.org @@ -0,0 +1,47 @@ +#+TITLE: :lang solidity + +This module adds [[https://github.com/ethereum/solidity][Solidity]] support through [[https://github.com/ethereum/emacs-solidity][solidity-mode]] + ++ Syntax-checking (~flycheck~) ++ Code completion (~[[https://github.com/ssmolkin1/company-solidity][company-solidity]]~) ++ Gas estimation (~C-c C-g~) + +* Table of Contents :TOC: +- [[Module Flags][Module Flags]] +- [[Prerequisites][Prerequisites]] + - [[Solc][Solc]] + - [[Solium][Solium]] +- [[TODO][TODO]] + +* Module Flags +This module provides no flags. + +* Prerequisites +This module requires one or both linters for syntax checking: + ++ [[https://github.com/ethereum/solc-js][Solc]] ++ [[http://solium.readthedocs.io/en/latest/user-guide.html#installation][Solium]] + +If both are enabled *Solc* is run first, then *Solium* if *Solc* catches no +errors. + +** Solc +#+BEGIN_SRC sh +npm install -g solc +#+END_SRC + +** Solium +#+BEGIN_SRC sh +npm install -g solium +#+END_SRC + +By default *solium* looks for ~.soliumrc.json~ in the project directory, but you +can set it to your own ~.soliumrc.json~ with this in your private doom +~config.el~ + +#+BEGIN_SRC emacs-lisp +(setq flycheck-solidity-solium-soliumrcfile "~/.soliumrc.json") +#+END_SRC + +* TODO ++ Snippets diff --git a/modules/lang/solidity/config.el b/modules/lang/solidity/config.el new file mode 100644 index 000000000..653cdc6a0 --- /dev/null +++ b/modules/lang/solidity/config.el @@ -0,0 +1,25 @@ +;;; lang/solidity/config.el -*- lexical-binding: t; -*- + +;; +;; Plugins +;; + +;; `solidity-mode' +(setq solidity-comment-style 'slash + solidity-flycheck-solc-checker-active t + solidity-flycheck-solium-checker-active t) + + +(def-package! solidity-flycheck ; included with solidity-mode + :when (featurep! :feature syntax-checker) + :after solidity-mode + :init (add-hook 'solidity-mode-hook #'flycheck-mode) + :config (setq flycheck-solidity-solc-addstd-contracts t) + + +(def-package! company-solidity + :when (featurep! :completion company) + :after solidity-mode + :config + (setq company-backends (delq 'company-solidity company-backends)) + (set! :company-backends 'solidity-mode 'company-solidity)) diff --git a/modules/lang/solidity/doctor.el b/modules/lang/solidity/doctor.el new file mode 100644 index 000000000..146d640ee --- /dev/null +++ b/modules/lang/solidity/doctor.el @@ -0,0 +1,8 @@ +;; -*- lexical-binding: t; no-byte-compile: t; -*- +;;; lang/solidity/doctor.el + +(when (require 'solidity-common nil t) + (unless (executable-find solidity-solc-path) + (warn! "Solc isn't installed.")) + (unless (executable-find solidity-solium-path) + (warn! "Solium isn't installed."))) diff --git a/modules/lang/solidity/packages.el b/modules/lang/solidity/packages.el new file mode 100644 index 000000000..fa8c36556 --- /dev/null +++ b/modules/lang/solidity/packages.el @@ -0,0 +1,4 @@ +;; -*- no-byte-compile: t; -*- +;;; lang/solidity/packages.el + +(package! solidity-mode)