juanfranblanco / vscode-solidity

Visual Studio Code language support extension for Solidity smart contracts in Ethereum https://marketplace.visualstudio.com/items?itemName=JuanBlanco.solidity
MIT License
871 stars 187 forks source link

Frequent Errors and Server Crashes with Solidity Language Server in VS Code #446

Open rocketman-21 opened 4 months ago

rocketman-21 commented 4 months ago

Description

I am experiencing frequent errors and crashes with the Solidity Language Server in Visual Studio Code, particularly when using the textDocument/hover and textDocument/completion functionalities. These issues significantly disrupt the development workflow. Below are the details of the errors and server behavior:

Errors Encountered

  1. EISDIR: illegal operation on a directory, read

    • First Occurrence: 3:39:25 PM (during textDocument/hover)
    • Second Occurrence: 3:40:26 PM (during textDocument/completion)
    • Error Message: Request failed with message: EISDIR: illegal operation on a directory, read
    • Code: -32603
  2. Cannot read properties of null (reading 'getSelectedItem')

    • Timestamp: 3:39:34 PM (during textDocument/hover)
    • Error Message: Request failed with message: Cannot read properties of null (reading 'getSelectedItem')
    • Code: -32603
  3. [Info - 3:36:18 PM] Validating using the compiler selected: localFile

    • [Info - 3:40:26 PM] Validating using the compiler selected: remote
    • [Info - 3:40:27 PM] Connection to server got closed. Server will restart.

Server Behavior

Log Snippets

Steps to Reproduce

  1. Open a `.sol file in Visual Studio Code with the Solidity extension enabled for this repo https://github.com/collectivexyz/revolution-protocol. Observe working compilation
  2. Open a .t.sol test file. Compilation breaks
  3. Observe the errors and eventual server crash + inability to compile

Environment

Additional Context

These issues began occurring recently, disrupting the usual development process. Any insights or fixes for these problems would be greatly appreciated.

juanfranblanco commented 4 months ago

Hi, I have tested on the latest version, and everything seems fine now: image image

Many thanks.

Configuration is mono repo "checked"

chapati23 commented 4 months ago

unfortunately still happening for me as well. language server crashes for almost any action AFAICT

VS Code and Env Version Infos

Version: 1.86.1
Commit: 31c37ee8f63491495ac49e43b8544550fbae4533
Date: 2024-02-07T09:08:57.920Z (6 days ago)
Electron: 27.2.3
ElectronBuildId: 26495564
Chromium: 118.0.5993.159
Node.js: 18.17.1
V8: 11.8.172.18-electron.0
OS: Darwin arm64 23.2.0

Extension Version

v0.0169

juanfranblanco commented 4 months ago

Any repo example? @chapati23

rocketman-21 commented 4 months ago

newest version doesn't seem to fix this w/the repo I linked

i'm on an apple silicon mac if that makes a difference

if I edit .sol files it works fine

as soon as I open eg RevolutionBuilder.t.sol it freezes, then the compiler switches from local to remote version and throws brief error, then the whole server crashes.

happy to hop on a discord/screenshare if that'd be helpful

rocketman-21 commented 4 months ago

for reference this is my vs code settings file

{
  "solidity.defaultCompiler": "localFile",
  "prettier.documentSelectors": ["**/*.sol"],
  "solidity.packageDefaultDependenciesDirectory": "node_modules",
  "solidity.enabledAsYouTypeCompilationErrorCheck": true,
  "[solidity]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "solidity.enableLocalNodeCompiler": true,
  "solidity.compileUsingLocalVersion": ".........../soljson-v0.8.22+commit.4fc1097e.js",
  "solidity.compileUsingRemoteVersion": ""
}
juanfranblanco commented 4 months ago

@rocketman-21 I assume that your local path is correct and relative, to the root. Can you turn off mono repo in the settings?

juanfranblanco commented 4 months ago

Ok i did turn off mono repo and made it worse, I tested it in windows and ubuntu with similar settings to this, these are the workspace settings

image Also I ensure in the workspace (just in case) I set it as in monorepo

"solidity.monoRepoSupport": true,
juanfranblanco commented 4 months ago

If you are still having problems, lets have a chat for sure :)

rocketman-21 commented 4 months ago

My config now is

  "solidity.monoRepoSupport": true,
  "solidity.compileUsingLocalVersion": "/Users/.../.../revolution-protocol/soljson-v0.8.22+commit.4fc1097e.js",
  "solidity.defaultCompiler": "localFile"

I type something in AuctionHouse.sol to make sure the compilation works

Then I open RevolutionBuilder.t.sol and it bricks itself as soon as I start typing, no compile checking.

I'm a bit confused, were you able to get it working with monoRepoSupport set to true?

What's the best way to chat?

juanfranblanco commented 4 months ago

Yes I set It on monorepo, drop me a message in twitter or pm me in discord (in my profile)