company-solidity
is now fully integrated in solidity-mode
, and will be installed automatically alongside it when you install (or upgrade) that package, and will be enabled automatically for users who have company-mode
installed. Thus, you no longer need to, nor should you, install company-solidity
as a stand-alone package. This repo will continue to be hosted, but will no longer be updated going forward.
company-solidity
has now been updated to:
- pull completion targets from
solidity-mode
syntax highlighting keyword lists, for greater maintainability; and - add more completion targets which are new or were missing from previous versions (on top of the
solidity-mode
keyword lists).
Becuase of the first change above, company-solidity
now requires solidity-mode
.
This is a simple company-mode back-end for autocompletion for the Solidity programming langauge. It is intended to be used with solidity-mode.
Give completion suggestions for Solidity keywords, global variables, and address methods.
Smart. The completion suggestions are not context dependent.
company-mode
treats .
as the end of a word, and will cut off compeletion suggestions when you type a .
. So, when you've typed msg
you will get msg.sender
, msg.value
etc. as completion suggestions. However, as soon as you type msg.
, the suggestions will disappear.
First, install the package from MELPA with M-x package-install RET company-solidity RET
, then put the following in your init.el
:
(require 'company-solidity)
Alternatively, to install with use-package, put the following in your init.el
:
(use-package company-solidity
:ensure t
:after (company))
That's it. Now open up a file in solitidy-mode
and try it out!
Completion suggestions from the company-solidity
back-end will automatically appear when solidity-mode
is your major-mode
.
If you want autocomplete suggestions to include local variables, as well as Solidity keywords, add the following to your init.el
:
(add-hook 'solidity-mode-hook
(lambda ()
(set (make-local-variable 'company-backends)
(append '((company-solidity company-capf company-dabbrev-code))
company-backends))))