Solidity language server for coc.nvim

Overview

coc-solidity npm-badge

coc.nvim extension for solidity. Language server provided by solidity-ls.

imageimageimage

solidity-ls has no tolerance. Means that some features will only work if sources are no syntax error.

For example:

// should not work
msg.
   ^

// should work
msg.;
   ^

Features

  • completion
    • local variables, state variables, functions image image
    • contracts image
    • globally variables and it's members image image
    • struct members image
    • external contract functions image
  • diagnostics image image
  • hover documention image image
  • references image
  • formatting (by prettier-plugin-solidity)
  • rename
  • signature help (basic implementation)
  • go to references
  • go to definition

Install

:CocInstall coc-solidity

Todo

  • code actions
  • semantic tokens
Comments
  • Server fails to run and crashes until won't restart

    Server fails to run and crashes until won't restart

    I'm on arch and I am trying to get coc-solidity to work with nvim.

    I have installed the regular arch binaries for solc: yay -S solidity whereis solc /usr/bin/solc

    Upon running a solidity file I get the error: The "solidity" server crashed 4 times in 3 minutes. The server will not be restarted

    My :CocCommand workspace.showOutput

    node:events:505
          throw er; // Unhandled 'error' event
          ^
    
    Error: write EPIPE
        at afterWriteDispatched (node:internal/stream_base_commons:160:15)
        at writeGeneric (node:internal/stream_base_commons:151:3)
        at Socket._writeGeneric (node:net:817:11)
        at Socket._write (node:net:829:8)
        at writeOrBuffer (node:internal/streams/writable:389:12)
        at _write (node:internal/streams/writable:330:10)
        at Socket.Writable.write (node:internal/streams/writable:334:10)
        at /home/doom/.config/coc/extensions/node_modules/coc-solidity/node_modules/solidity-ls/dist/index.js:78:17
        at new Promise (<anonymous>)
        at compile (/home/doom/.config/coc/extensions/node_modules/coc-solidity/node_modules/solidity-ls/dist/index.js:43:10)
    Emitted 'error' event on Socket instance at:
        at emitErrorNT (node:internal/streams/destroy:157:8)
        at emitErrorCloseNT (node:internal/streams/destroy:122:3)
        at processTicksAndRejections (node:internal/process/task_queues:83:21) {
      errno: -32,
      code: 'EPIPE',
      syscall: 'write'
    }
    

    I have tried without the arch package for solidity as well by directly downloading from the sources linked to in the README.md. Once I do that I simply recieve: [coc.nvim] spawn solc ENOENT

    I have tried setting up my CocConfig with this to point to the directly downloaded binary:

    {
        "languageserver": {
            "solidity": {
                "command": "~/Downloads/solc-static-linux",
                "args": [ "--lsp" ],
                "trace.server": "verbose",
                "rootPatterns": [".git/"],
                "filetypes": ["solidity", "sol"]
            }
        }
    }
    

    I got that suggestion for: https://dev.to/christianparpart/builtin-solidity-language-server-267n Syntax errors show up but nothing from coc-solidity

    Any suggestions?

    opened by ekr990011 6
  • Doesn't work

    Doesn't work

    after installing the plugin, when I open a contract the server crashes - and :CocCommand workspace.showOutput shows:

    SyntaxError: Unexpected end of JSON input
        at JSON.parse (<anonymous>)
        at Socket.<anonymous> (/Users/dakom/.config/coc/extensions/node_modules/coc-solidity/node_modules/solidity-ls/dist/index.js:30872:50)
        at Socket.emit (node:events:402:35)
        at endReadableNT (node:internal/streams/readable:1343:12)
        at processTicksAndRejections (node:internal/process/task_queues:83:21)
    [Info  - 12:09:36] Connection to server got closed. Server will restart.
    undefined:1
    
    opened by dakom 5
  • How I configure compiler version?

    How I configure compiler version?

    image

    Probably just a simple question but how can I resolve these errors? Since there is a no tolerance policy I can't use the plugin if the compiler is not configured to the right version

    opened by 0xrin1 4
  • new upgrade breaks solidity (remappings)

    new upgrade breaks solidity (remappings)

    I was using:

    "solidity.remappings": [ "@openzeppelin=./dependencies/openzeppelin-contracts-4.4.2", "@chainlink=./dependencies/[email protected]" ],

    Without that, the LSP dont start (using brownie here).

    Can you add this back?

    OS: Mac OS

    image

    The LSP is not working at all

    opened by TortoiseHive 4
  • definition and reference not found

    definition and reference not found

    Hey, when I press gd or gr on any solidity file, I get [coc.nvim] definition not found or [coc.nvim] reference not found, even if the definition or reference is in the same file. Gd and gr works on my other language servers like rust. Any idea what the problem could be? Thanks

    opened by nathan-barry 3
  • Allow remapping for outside project folder

    Allow remapping for outside project folder

    i trying to remap for brownie using:

      "solidity.remapping": {
        "@OpenZeppelin": "~/.brownie/packages/OpenZeppelin/[email protected]/"
      },
    

    and i solc tries to: image

    opened by otavioschwanck 2
  • yarn packages not installed automatically

    yarn packages not installed automatically

    First of all, thanks for the repo. Take all my stars.

    I just installed with CocInstall coc-solidity and had to manually go to my coc installation folder to install the node dependencies. Simply cd /Users/hex/.config/coc/extensions/node_modules/coc-solidity && yarn. Maybe there is a way to do this automatically when the package is installed from CoC?

    opened by hexcowboy 2
  • Formatting using prettier-plugin-solidity fails if not installed locally.

    Formatting using prettier-plugin-solidity fails if not installed locally.

    If we create a project and do not install prettier-solidity-plugin locally, then coc.nvim fails at formatting a solidity file. The error is the following:

    [Error  - 2:22:27 PM] Request textDocument/formatting failed.
      Message: Request textDocument/formatting failed with message: Cannot find module '/home/dcordb/.config/coc/extensions/node_modules/coc-solidity/node_modules/solidity-ls/node_modules/prettier-plugin-solidity'
    Require stack:
    - /home/dcordb/.config/coc/extensions/node_modules/coc-solidity/node_modules/prettier/index.js
    - /home/dcordb/.config/coc/extensions/node_modules/coc-solidity/node_modules/solidity-ls/dist/index.js
      Code: -32603 
    

    Note that prettier-solidity-plugin exists on /home/dcordb/.config/coc/extensions/node_modules/coc-solidity/node_modules/prettier-solidity-plugin, since it is a dependency of solidity-ls.

    To reproduce, just create inside a folder a contract (for example, Test.sol) and try to format it.

    opened by dcordb 1
  • coc-solidity slows down nvim on .sol files

    coc-solidity slows down nvim on .sol files

    coc-solidity might be slowing down neovim on .sol files. I am not certain, but uninstalling coc-solidity does fix the problem.

    By performance issues I mean neovim is slow to react to typing in insert mode.

    When installed, the performance issues start / get worse when i introduce syntax errors while typing.

    Posting here to see if anyone else has had similar issues.

    opened by kevinhalliday 0
  • how to modify

    how to modify "Function state mutability" warnings?

    Hi, thanks for this great lib, it's been working very reliably since I installed it :slightly_smiling_face:

    I have one small problem with it, and that is that the function state mutability warnings are assigned to the entire function block and this can be an annoyance during development process, if you are using something like hardhat's console.log. The reason is, I usually leave pure functions as views while I am testing them so i can console.log easily. But this results in a visible warning in the whole function body:

    image

    (in my image above the cursor is still in the function signature but you get the idea).

    What I'd like is to be able to change that warning so it's only visible on the definition line of the function, not the whole body.

    Is there a way to do this?

    Many thanks

    opened by ssadler 2
Releases(v1.4.2)
Owner
7c00
7c00
Alpine.js Language Features (Volar) extension for coc.nvim

[Experimental] coc-volar-alpinejs fork from vscode-alpine-language-features Alpine Language Features extension for coc.nvim Note @volar/alpine-languag

yaegassy 6 Oct 12, 2022
Marksman (Markdown LSP server) extension for coc.nvim

coc-marksman fork from a marksman-vscode Integrates Marksman language server into coc.nvim for delightful Markdown note taking experience. coc-marksma

yaegassy 17 Nov 18, 2022
Vitest for coc.nvim

coc-vitest Vitest for coc.nvim Install vim-plug: Plug 'yaegassy/coc-vitest', {'do': 'yarn install --frozen-lockfile'} CocInstall: Not supported at thi

yaegassy 8 Sep 4, 2022
Intelligent Tailwind CSS tooling for coc.nvim

coc-tailwindcss3 fork from a vscode-tailwindcss Intelligent Tailwind CSS tooling for coc.nvim. Motivation There are two coc.nvim extensions to "tailwi

yaegassy 110 Jan 1, 2023
Typos integration with coc.nvim

coc-typos Typos integration with coc.nvim. It checks typos with opened buffer automatically. Install Install typos by: cargo install typos-cli Make s

Neoclide 31 Aug 22, 2022
Solidity Quickstart is an extensive solidity guide for the solidity newbies out there.

?? Solidity Quickstart Solidity Quickstart is an extensive solidity guide for the solidity newbies out there. ?? How does it work? All the guides rela

Kira 8 Aug 6, 2022
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
A hardhat solidity template with necessary libraries that support to develop, compile, test, deploy, upgrade, verify solidity smart contract

solidity-hardhat-template A solidity hardhat template with necessary libraries that support to develop, compile, test, deploy, upgrade, verify solidit

ChimGoKien 4 Oct 16, 2022
A professional truffle solidity template with all necessary libraries that support developer to develop, debug, test, deploy solidity smart contract

solidity-truffle-template A professional truffle solidity template with necessary libraries that support to develop, compile, test, deploy, upgrade, v

ChimGoKien 6 Nov 4, 2022
i18n-language.js is Simple i18n language with Vanilla Javascript

i18n-language.js i18n-language.js is Simple i18n language with Vanilla Javascript Write by Hyun SHIN Demo Page: http://i18n-language.s3-website.ap-nor

Shin Hyun 21 Jul 12, 2022
When a person that doesn't know how to create a programming language tries to create a programming language

Kochanowski Online Spróbuj Kochanowskiego bez konfiguracji projektu! https://mmusielik.xyz/projects/kochanowski Instalacja Stwórz nowy projekt przez n

Maciej Musielik 18 Dec 4, 2022
Write "hello world" in your native language, code "hello world" in your favorite programming language!

Hello World, All languages! ?? ?? Write "hello world" in your native language, code "hello world" in your favorite language! #hacktoberfest2022 How to

Carolina Calixto 6 Dec 13, 2022
Monolithic repo for api server, image server, web server

Onsecondary Market Deployed at https://market.onsecondary.com Monolithic repo for api server, image server, web server TODO -use a script to cull expi

Admazzola 2 Jan 11, 2022
Build a Full Stack Marketplace on Ethereum with React, Solidity, Hardhat, and Ethers.js

Building a Digital Marketplace on Ethereum The technologies used in this workshop are React, Next.js, Tailwind CSS, HardHat, Solidity, and Ethers. Get

Nader Dabit 114 Nov 15, 2022
The culmination of Encode Academy, the 8-week long Solidity course by Encode Club in collaboration with Extropy

Encode Academy | DAO: Real Estate & Renting What is this? This is the culmination of Encode Academy, the 8-week long Solidity course by Encode Club in

Oliver H. D. 5 May 25, 2022
timecapsule solidity contracts + app

timecapsule-contracts compile contracts: $ yarn compile run tests: $ yarn test deployed and verified on testnets: - rinkeby: https://rinkeby.ether

null 2 Sep 25, 2021
Solidity trivias

Solidity Trivias This repo contains condensed demos and explanations for the Solidity trivias being shared on twitter via the profile: https://twitter

Alejandro Santander 99 Dec 24, 2022