GithubHelp home page GithubHelp logo

ethereum / emacs-solidity Goto Github PK

View Code? Open in Web Editor NEW
205.0 28.0 65.0 166 KB

The official solidity-mode for EMACS

License: GNU General Public License v3.0

Emacs Lisp 100.00%
emacs-lisp solidity emacs-mode emacs ethereum

emacs-solidity's Introduction

Emacs Solidity Mode

https://img.shields.io/badge/License-GPL%20v3-blue.svg http://melpa.org/packages/solidity-mode-badge.svg

A simple language mode for the Solidity language. It is a constant work in progress as the language itself also progresses. For information about Solidity check the Tutorial and the Features wiki pages.

Installation

You can simply load the file in your emacs but the recommended way to install it is either via el-get or MELPA.

El-get

If you don’t know how to use el-get you can find more information on its webpage. First install el-get and then (in emacs), press Alt+x (this is in emacs notation written as M-x ) and then type el-get-install. This will prompt you for a package, type solidity-mode and hit enter, this should install all you need.

Melpa

You can also obtain solidity-mode from Melpa as can be seen here.

  1. Install melpa and make sure emacs is started with it.
  2. Press Alt+x (this is in emacs notation written as M-x ) and then type package-refresh-contents.
  3. Press Alt+x and then type package-install. This will prompt you for a package.
  4. type solidity-mode and hit enter, this should install all you need.

Configuration

By default solidity-mode associates itself with any files ending in .sol.

If using el-get then you should have a specific package initializing lisp file. If not then you can put these anywhere in your init.el.

Generic configuration

Regardless of where you installed solidity mode from, you need to require the package:

(require 'solidity-mode)

(append that line to your ~/.emacs file)

You can also set the way the comments are inserted by emacs with commands like comment-region. The default is /* .. */ and you can turn it to using // instead by putting the following into your emacs config:

(setq solidity-comment-style 'slash)
;; or
(setq solidity-comment-style 'star) ;; this is the default

Keymap

You can modify the default keybindings of the solidity mode keymap by adding a new key combination for each command you want to change. For example

(define-key solidity-mode-map (kbd "C-c C-g") 'solidity-estimate-gas-at-point)

Interface with linters

Provide path to solc binary

The solc binary is assumed to be part of the PATH. Wherever that is not the case you would have to manually set the location of the binary like below:

(setq solidity-solc-path "/home/lefteris/ew/cpp-ethereum/build/solc/solc")

Note: This better be set before requiring solidity mode.

Provide path to solium binary

The solium binary is assumed to be part of the user’s PATH. If this is not the case then set its location like below:

(setq solidity-solium-path "/home/lefteris/.npm-global/bin/solium")

[Optional] Flycheck interface

Solidity mode can also interface with flycheck if you have it. Make sure to download and install the flycheck package. Then configure it to either work on all modes or enable it only for solidity mode.

Flycheck can interface with solc and/or with solium. We only support integration with solium >= v0.2.0

You have to specifically set the path to both executables and activate the checker integration by setting the following:

To activate flycheck you need the solidity-flycheck package and to add this in your emacs file:

(require 'solidity-flycheck)

To activate solc checker

(setq solidity-flycheck-solc-checker-active t)

To activate solium checker

(setq solidity-flycheck-solium-checker-active t)

Keep in mind that you need to provide the path to either solc or solium unless emacs can already find it in your environment’s PATH. Even if you can call it from the command line it does not mean that EMACS can see it as emacs may be started by systemd at which point PATH is not fully populated.

Configuring solc checker

You can configure flycheck’s solc invocation with the following arguments

std contracts

By default this is false. If you want to include the standard contracts just add the following to your emacs init file

(setq flycheck-solidity-solc-addstd-contracts t)

Configuring solium checker

You can configure flycheck’s solium incocation with the following arguments

solium RC file

By default solium looks at the current directory of the file you are editing in order to find .soliumrc.json. Having this file is required. But you can point to an external configuration file by putting the following anywhere in your emacs init file.

(setq flycheck-solidity-solium-soliumrcfile "/home/path/to/common/.soliumrc.json")

Chaining both checkers

If you enable both checkers then their results are chained. The variable solidity-flycheck-chaining-error-level controls how they are chained. Its value can be either t, error, warning or info and that controls the maximum error level of the solc checker after which solium will not run. If t is given solium will always run. The default is warning, so if anything over than a warning is found in solc solium will not run.

[Optional] Autocompletion

To achieve solidity autcompletion you will need the company-solidity package, a simple company-mode back-end for Solidity. To use it make sure that company-mode is installed and then:

(require 'company-solidity)

What it does

Give completion suggestions for Solidity keywords, global variables, and address methods.

What it isn’t

Smart. The completion suggestions are not context dependent.

Something to watch out for

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.

Local Variables

If you want autocomplete suggestions to include local variables, in addition to 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))))

Commands

Gas estimate of function under point

You can get an estimate of the function under the cursor, by placing the curson on top of the function name and typing C-c C-g.

This will call solidity-estimate-gas-at-point and provide a max gas estimate, if possible, for the function.

Features

  • Syntax highlighting
  • Autocompletion
  • Indentation
  • On the fly syntax checking with flycheck
  • Gas estimation for function under point

emacs-solidity's People

Contributors

andresilva avatar clarkhenry avatar coventry avatar durantschoon avatar favadi avatar fiddlemath avatar hrkrshnn avatar juergenhoetzel avatar kevinji avatar landakram avatar layerex avatar lefterisjp avatar purcell avatar rowanthorpe avatar scbuergel avatar syohex avatar taquangtrung avatar tmythicator avatar tsuu32 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

emacs-solidity's Issues

wrong indentation after a parenthesis

When I have a function test( and press enter, I would expect the next line to start under the n, like this:

function test(
  some code

Instead, it does this:

function test(
              some code         

I found an answer on stack overflow that suggests to do the following:

(add-hook 'solidity-mode-hook
    (lambda ()
      (c-set-offset 'arglist-intro '+)
      (c-set-offset 'arglist-close 0)))

It worked for me.

Installation error: "/usr/bin/solc"' is a malformed function

/usr/bin/solc exists but it seems that there something wrong related that prevents the installation from finishing.

Leaving directory `/home/victor/.emacs.d/elpa/solidity-mode-20160426.31'

Compiling file /home/victor/.emacs.d/elpa/solidity-mode-20160426.31/solidity-mode-pkg.el at Fri Apr 29 13:21:06 2016
Entering directory `/home/victor/.emacs.d/elpa/solidity-mode-20160426.31/'

Compiling file /home/victor/.emacs.d/elpa/solidity-mode-20160426.31/solidity-mode.el at Fri Apr 29 13:21:06 2016
solidity-mode.el:383:1:Warning: `"/usr/bin/solc"' is a malformed function
solidity-mode.el:383:1:Warning: `(error line-start (file-name) ":" line ":"
    column ":" " Error: " (message))' is a malformed function
solidity-mode.el:386:28:Warning: reference to free variable `solidity'
solidity-mode.el:388:31:Warning: reference to free variable `source-inplace'
solidity-mode.el:391:12:Warning: reference to free variable `solidity-mode'
solidity-mode.el:393:17:Warning: reference to free variable
    `flycheck-checkers'
solidity-mode.el:393:17:Warning: assignment to free variable
    `flycheck-checkers'
solidity-mode.el:395:30:Warning: assignment to free variable
    `flycheck-solidity-executable'

In end of data:
solidity-mode.el:399:1:Warning: the function `flycheck-define-checker' is not
    known to be defined.

Compiling no file at Fri Apr 29 13:24:20 2016

emacs 24.5
Spacemacs 0.105.19
solc 0.3.2-81ae2a78

Create a test suite

For a package that's actually used by many users it's unthinkable we got no tests here.

Create a test suite for the package and slowly add tests in it.

No syntax checker detected by Flycheck

Hi, I have set all the required configuration properties in my ~/.spacemacs, but when I run flycheck-verify-setup on a Solidity file, the output is:

Syntax checkers for buffer Foo.sol in solidity-mode:

There are no syntax checkers for this buffer!

Flycheck Mode is enabled. Use SPC u C-c ! x to enable disabled checkers.

--------------------

Flycheck version: 32snapshot (package: 20190108.351)
Emacs version:    26.1
System:           x86_64-pc-linux-gnu
Window system:    nil

This seems to be a different problem than solc not being found - it's rather the checker itself that's not found by flycheck.

I'm using Spacemacs develop [email protected] and have recently updated all packages.

Flycheck not working: checker automatically disabled

I have solc in /usr/bin/solc, but the flycheck checker doesn't seem to find it. I ran flycheck-verify-setup and this is what I got:

  solidity-checker (disabled)
    - may enable: Automatically disabled!
    - predicate:  t
    - executable: Not found

I tried setting the solc location manually but that did not work. Any idea of what the problem could be?

unrecognised option '--add-std' error after upgrading solc to 0.4.24

I recently upgraded to solc version 0.4.24, and I have started getting the following error:

Suspicious state from syntax checker solidity-checker: Flycheck checker solidity-checker returned non-zero exit code 1, but its output contained no errors: unrecognised option '--add-std'

This option was removed in version 0.4.22 of Solidity.
I found the following references regarding how other tools are affected. But I'm not sure if there is a fix/workaround for emacs-solidity

References :
ethereum/solidity#3984
ethereum/solidity#3695

Solution seems to be "upgrade go-ethereum", but how does that help a "linter" functionality of emacs-solidity ?

el-get-install can't install the package, Ubuntu 20.04

The document says:

El-get

If you don’t know how to use el-get you can find more information on its webpage. First install el-get and then (in emacs), press Alt+x (this is in emacs notation written as M-x ) and then type el-get-install. This will prompt you for a package, type solidity-mode and hit enter, this should install all you need.

What happened to me is

  1. press Alt+x
  2. type el-get-install. It prompts: "Intsall Package:"
  3. type solidity-mode. It prompts: "No Match"

Attempted

I tried to run el-get-list-packages and the result is a long list that does not contain solidity-mode


This may be an el-get issue but would be great if the instruction can help users avoid this issue.

swiper/solidity-mode incompatibility

Using solidity-mode version 0.1.9, I'm sometimes (maybe 20% of the time) getting the error “No match 4 in highlight (4 font-lock-variable-name-face)” when I call swiper. It's intermittent, so it's hard to narrow down to a straightforward reproduction. Someone else is having the same problem in solidity-mode buffers. Here is the traceback, in case it's useful:

Debugger entered--Lisp error: (error "No match 4 in highlight (4 font-lock-variable-name-face)")
  signal(error ("No match 4 in highlight (4 font-lock-variable-name-face)"))
  error("No match %d in highlight %S" 4 (4 font-lock-variable-name-face))
  font-lock-apply-highlight((4 font-lock-variable-name-face))
  (if (numberp (car (car highlights))) (font-lock-apply-highlight (car highlights)) (set-marker pos (point)) (font-lock-fontify-anchored-keywords (car highlights) end) (if (< (point) pos) (goto-char pos)))
  (while highlights (if (numberp (car (car highlights))) (font-lock-apply-highlight (car highlights)) (set-marker pos (point)) (font-lock-fontify-anchored-keywords (car highlights) end) (if (< (point) pos) (goto-char pos))) (setq highlights (cdr highlights)))
  (while (and (< (point) end) (if (stringp matcher) (re-search-forward matcher end t) (funcall matcher end)) (or (> (point) (match-beginning 0)) (progn (forward-char 1) t))) (if (and font-lock-multiline (>= (point) (save-excursion (goto-char (match-beginning 0)) (forward-line 1) (point)))) (progn (put-text-property (if (= (point) (save-excursion (goto-char ...) (forward-line 1) (point))) (1- (point)) (match-beginning 0)) (point) (quote font-lock-multiline) t))) (setq highlights (cdr keyword)) (while highlights (if (numberp (car (car highlights))) (font-lock-apply-highlight (car highlights)) (set-marker pos (point)) (font-lock-fontify-anchored-keywords (car highlights) end) (if (< (point) pos) (goto-char pos))) (setq highlights (cdr highlights))))
  (while keywords (if loudly (message "Fontifying %s... (regexps..%s)" bufname (make-string (setq count (1+ count)) 46))) (setq keyword (car keywords) matcher (car keyword)) (goto-char start) (while (and (< (point) end) (if (stringp matcher) (re-search-forward matcher end t) (funcall matcher end)) (or (> (point) (match-beginning 0)) (progn (forward-char 1) t))) (if (and font-lock-multiline (>= (point) (save-excursion (goto-char (match-beginning 0)) (forward-line 1) (point)))) (progn (put-text-property (if (= (point) (save-excursion ... ... ...)) (1- (point)) (match-beginning 0)) (point) (quote font-lock-multiline) t))) (setq highlights (cdr keyword)) (while highlights (if (numberp (car (car highlights))) (font-lock-apply-highlight (car highlights)) (set-marker pos (point)) (font-lock-fontify-anchored-keywords (car highlights) end) (if (< (point) pos) (goto-char pos))) (setq highlights (cdr highlights)))) (setq keywords (cdr keywords)))
  (let ((case-fold-search font-lock-keywords-case-fold-search) (keywords (cdr (cdr font-lock-keywords))) (bufname (buffer-name)) (count 0) (pos (make-marker)) keyword matcher highlights) (while keywords (if loudly (message "Fontifying %s... (regexps..%s)" bufname (make-string (setq count (1+ count)) 46))) (setq keyword (car keywords) matcher (car keyword)) (goto-char start) (while (and (< (point) end) (if (stringp matcher) (re-search-forward matcher end t) (funcall matcher end)) (or (> (point) (match-beginning 0)) (progn (forward-char 1) t))) (if (and font-lock-multiline (>= (point) (save-excursion (goto-char ...) (forward-line 1) (point)))) (progn (put-text-property (if (= ... ...) (1- ...) (match-beginning 0)) (point) (quote font-lock-multiline) t))) (setq highlights (cdr keyword)) (while highlights (if (numberp (car (car highlights))) (font-lock-apply-highlight (car highlights)) (set-marker pos (point)) (font-lock-fontify-anchored-keywords (car highlights) end) (if (< (point) pos) (goto-char pos))) (setq highlights (cdr highlights)))) (setq keywords (cdr keywords))) (set-marker pos nil))
  font-lock-fontify-keywords-region(7692 13007 nil)
  font-lock-default-fontify-region(7692 13007 nil)
  c-font-lock-fontify-region(7725 13007 nil)
  font-lock-fontify-region(7725 13007)
  #f(compiled-function (fun) #<bytecode 0x4074159>)(font-lock-fontify-region)
  run-hook-wrapped(#f(compiled-function (fun) #<bytecode 0x4074159>) font-lock-fontify-region)
  jit-lock--run-functions(7725 13007)
  jit-lock-fontify-now(1 13007)
  font-lock-ensure()
  swiper-font-lock-ensure()
  swiper--candidates()
  swiper()
  funcall-interactively(swiper)
  call-interactively(swiper nil nil)
  command-execute(swiper)

zeppelin-solidity imports flycheck errors

im having trouble to cleanly import contracts from zeppelin-solidity library.

following the instructions from Getting Started in
https://github.com/OpenZeppelin/zeppelin-solidity

the code compiles and run correctly, but flymake flags the import as an error.

import "zeppelin-solidity/contracts/ownership/Ownable.sol";

this is the error message:
Source "zeppelin-solidity/contracts/ownership/Ownable.sol" not found: Unknow exception in read callback (solidity-checker)

Does not work

I have add following lines into my .emacs file but emacs-solidity does not work.

(require 'solidity-mode)
(require 'solidity-flycheck)
(setq solidity-solium-path "/Users/avatar/.npm-packages/lib/node_modules/solium/bin/solium.js")
(setq solidity-solc-path "/Users/avatar/.npm-packages/lib/node_modules/solc/solcjs")
(setq solidity-flycheck-solc-checker-active t)
(setq solidity-flycheck-solium-checker-active t)

`remove-if-not` function definition is void

I'm getting an error that the remove-if-not function is void on startup, and flycheck doesn't work for Solidity.

If I update this to cl-remove-if-not, then the error warning message on startup doesn't show, and flycheck works for Solidity fine.

Constructor body idents too many levels

When using a constructor with many arguments, such that each argument should drop to its own line, the body of the constructor has too many levels of indentation.

The same is not true of a function having the same arguments. That is, functions still format the body correctly, regardless of the style of the function declaration.

The following code demonstrates the issue with the style/format of the constructor:

// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";


contract SolidityModeExample {

    IERC20 public tokenA;
    IERC20 public tokenB;
    IERC20 public tokenC;
    IERC20 public tokenD;

    /// @dev The body of this constructor is indented too far, by 8 spaces
    constructor (
        address _tokenA,
        address _tokenB,
        address _tokenC,
        address _tokenD
    )
        public
            {
                tokenA = IERC20(_tokenA);
                tokenB = IERC20(_tokenB);
                tokenC = IERC20(_tokenC);
                tokenD = IERC20(_tokenD);
            }

    /// @dev The body of this function is indented correctly
    function updateTokens (
        address _tokenA,
        address _tokenB,
        address _tokenC,
        address _tokenD
    )
        public
    {
        tokenA = IERC20(_tokenA);
        tokenB = IERC20(_tokenB);
        tokenC = IERC20(_tokenC);
        tokenD = IERC20(_tokenD);
    }
}

Error: Symbol’s value as variable is void: company-backends

Trying to use company-solidity, I'm getting the following error: Symbol’s value as variable is void: company-backends

My config is:

;;; package --- Solidity mode
;;; Commentary:
;;; Code:

(require-package 'solidity-mode)
(require-package 'solidity-flycheck)
(require-package 'company-solidity)

(...)

(add-hook 'solidity-mode-hook
          (lambda ()
            (set (make-local-variable 'company-backends)
                 (append '((company-solidity company-capf company-dabbrev-code))
                         company-backends))))

(provide 'init-solidity)

;;; init-solidity.el ends here

I'm using emacs 25.2.2 on a Debian based distribution.

Default indentation doesn't look right to me

Version: elpa/solidity-mode-20221119.1735

Default formatting:

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

// test
contract Test {
    // test
        function test () public {
    }

        // bar
        function bar () public {
    }

        // foo
        function foo () public {
    }
}

I don't have any special configuration.

melpa instruction needs more details

The following is the output of install-package followed by solidity-mode

Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...done
Loading /etc/emacs/site-start.d/50el-get.el (source)...done
Loading display-line-numbers...done
For information about GNU Emacs and the GNU system, type C-h C-a.
Saving file /home/a/.emacs...
Wrote /home/a/.emacs [2 times]
Contacting host: melpa.org:443
package-install-from-archive: https://melpa.org/packages/solidity-mode-20200529.1924.tar: Not found

solc `--old-reporter` flag removed in solc 0.8.0

I'm receiving this error message:

Suspicious state from syntax checker solidity-checker: Flycheck checker solidity-checker returned 1, but its output contained no errors: unrecognised option '--old-reporter'

It was removed here: ethereum/solidity#10167

Not sure how to reconcile solidity-checker with the new output.

solidity-flycheck requires el package to be included in source, otherwise does not work

Hello. I spent some time to set it up. And isolated the error till found what happens in the code.

Versions installed from Melpa with "package" system.

solidity-flycheck: Commit: 5f6ef3156fadae5af6f381d674d20535529a20e4
flyicheck:     Version: 20210708.1337
Commit: 21d52264aa80bfa4ede94c59e37a20fb6d033b0c
solidity-mode: Commit: Commit: 5f6ef3156fadae5af6f381d674d20535529a20e4

.emacs init file

(require 'package)
(package-initialize) ;; You might already have this line
(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(package-selected-packages
   '(solidity-flycheck solidity-mode))
 )

(setq solidity-flycheck-solc-checker-active t)
(setq solidity-solc-path "/home/user/.local/bin/solc")

(add-hook 'solidity-mode-hook
          '(lambda()
             (require 'solidity-flycheck)
             (flycheck-mode +1)
             (flycheck-verify-setup)
             ))
```

then run console command emacs -nw Contract.sol emacs starts but
displays the error: File mode specification error: (void-function
remove-if-not)

I made some research and found that this is the function from the cl
package. Then I added the line (require 'cl) on the top of
solidity-flycheck.el and everything now works.

Please Make Source Code Available

Heya.

I code in Emacs, and I did write modes for lll and (old) Serpent. I'd like to not re-invent the wheel if there's an existing Solidity mode. Is it ready for use yet?

Thanks.

Indent code error

After install solidity mode, press tab to indent code, it's not working and show follow error message:

Error evaluating offset + for defun-block-intro: Got invalid value tab-width

Using c-c c-o (c-set-offset) to set defun-block-intro to a number other than '+', it's working.

Indentation After Structs

Thank you for solidity-mode!

When using it to automatically indent code, the indentation of lines after the closing curly brace of a struct is increased by one level until after closing another declaration:

image

c-mode seems to be expecting a semicolon after the closing curly brace of the struct, but Solidity doesn't require one (and complains if one is provided, although doing so fixed the indentation).

I'm not quite sure how to address this, modifying c-offsets-alist for class-close (the syntactic type returned by C-c C-s) affects the indentation of the curly brace, not the lines that follow it.

I addressed similar issues with my desired indentation for events and other constructs with closing parentheses on a new line using:

            (add-to-list 'c-offsets-alist
                         '(arglist-close . c-lineup-close-paren))

parent mode is c-mode in `define-derived-mode`

I think this is problematic.

I use

(add-hook 'c-mode-hook #'irony-mode)

in init file, so solidity-mode enable irony-mode (undesirable).

Solidity-mode should be

(define-derived-mode solidity-mode prog-mode "solidity"

?

company-solidity.el not included in melpa package

solidity-mode 20180912.2154 on melpa does not include company-solidity.el, and loading solidity-mode ends with an error "File mode specification error: (file-missing Cannot open load file No such file or directory company-solidity)".

Unable to make `solidity-flycheck-solc` work

I am unable to make solidity-flycheck-solc work. I am not sure what I am doing wrong.

$ solc --version
solc, the solidity compiler commandline interface
Version: 0.6.0+commit.26b70077.Darwin.appleclang
$ which solc
/usr/local/bin/solc

I have following setup in .emacs file:

(require 'flycheck)
(setq solidity-solc-path "/usr/local/bin/solc")
(require 'solidity-flycheck)
(require 'solidity-mode)
(setq flycheck-solidity-solc-addstd-contracts t)
(setq solidity-flycheck-solc-checker-active t)

(custom-set-variables
 '(package-selected-packages
   (quote
    (solidity-flycheck solidity-mode use-package flymake-python-pyflakes flycheck undo-tree jedi dumb-jump))))

(add-hook 'after-init-hook #'global-flycheck-mode)

=> flycheck-verify-setup and this is what I got:

Syntax checkers for buffer eBlocBroker.sol in solidity-mode:

There are no syntax checkers for this buffer!

Flycheck Mode is enabled.  Use C-u C-c ! x to enable disabled
checkers.

--------------------

Flycheck version: 31
Emacs version:    26.3
System:           x86_64-apple-darwin19.0.0
Window system:    nil

Gracefully indenting structs and assembly blocks.

Currently, the package expects a semicolon after a struct declaration, and also expects semicolons in assembly blocks.

For example

struct s {
    uint x;
}
// emacs expects semicolon here
// so automatically does an extra indent here
function f() {
    assembly {
        sstore(0, 0)
       // emacs expects a semicolon in the line before, so automatically makes an extra indent here again.
    }
}

I assume the struct issue is somehow related to c-mode or cc-mode that solidity-mode derives from.

I had a look at https://www.gnu.org/software/emacs/manual/html_mono/ccmode.html. Unfortunately, I can't find an obvious fix.

Any idea how this can be fixed?

Flycheck Gets Stuck at Import

I'm running into the same issue described here. Flycheck never gets past the import. The solution is to call solc with a remapping like:

@openzeppelin/=$(pwd)/node_modules/@openzeppelin/

How can this be achieved?

Change Solc to solcjs

I'm having issues with flycheck and I believe it's because solc is not solc-js as a command. Not sure if it used to be solc or not I can't remember.

Proper Integration with Irony Mode

I'm using irony-mode one of emacs plugin for C/C++ mode. Here are some lines from my emacs init file that hooks C/C++ mode with irony-mode.

(use-package irony                                                              
  :init                                                                         
  (add-hook 'c++-mode-hook 'irony-mode)                                         
  (add-hook 'c-mode-hook 'irony-mode) 
  ...)

When I open .sol file with emacs, I get these error messages.

Warning (irony): Major mode is unknown to Irony, see `irony-supported-major-mod\
es'.                                                                            
Warning (irony): Major mode is unknown to Irony, see `irony-supported-major-mod\
es'.   

How can I fix this without disabling the original hooks?

Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.