Skip to content

Commit 1579ab6

Browse files
committed
Add optional solc arguments the proper flycheck way
1 parent c65c363 commit 1579ab6

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

solidity-mode.el

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,6 @@
4949
:type 'string
5050
:package-version '(solidity . "0.1.1"))
5151

52-
(defcustom solidity-solc-extra-args ""
53-
"Extra arguments to add to pass to the solidity compiler."
54-
:group 'solidity
55-
:type 'string
56-
:package-version '(solidity . "0.1.2"))
57-
5852
(defvar solidity-mode-map
5953
(let ((map (make-keymap)))
6054
(define-key map "\C-j" 'newline-and-indent)
@@ -63,7 +57,6 @@
6357

6458
(defvar solidity-checker t "The solidity flycheck syntax checker.")
6559
(defvar solidity-mode t "The solidity major mode.")
66-
(defvar flycheck-solidity-executable t "The solc executable used by flycheck.")
6760

6861
;;;###autoload
6962
(add-to-list 'auto-mode-alist '("\\.sol\\'" . solidity-mode))
@@ -451,13 +444,24 @@ Highlight the 1st result."
451444

452445
;;; --- interface with flycheck if existing ---
453446
(when (eval-when-compile (require 'flycheck nil 'noerror))
447+
(flycheck-def-option-var flycheck-solidity-addstd-contracts nil solidity-checker
448+
"Whether to add standard solidity contracts.
449+
450+
When non-nil, enable add also standard solidity contracts via
451+
`--add-std'."
452+
:type 'boolean
453+
:safe #'booleanp
454+
:package-version '(solidity-mode . "0.1.3"))
455+
454456
;; add dummy source-inplace definition to avoid errors
455457
(defvar source-inplace t)
456458
;; add a solidity mode callback to set the executable of solc for flycheck
457459
;; define solidity's flycheck syntax checker
458460
(flycheck-define-checker solidity-checker
459461
"A Solidity syntax checker using the solc compiler"
460-
:command ("/usr/bin/solc" source-inplace)
462+
:command ("solc"
463+
(option-flag "--add-std" flycheck-solidity-addstd-contracts)
464+
source-inplace)
461465
:error-patterns
462466
((error line-start (file-name) ":" line ":" column ":" " Error: " (message))
463467
(error line-start "Error: " (message))

0 commit comments

Comments
 (0)