vscode-solidity icon indicating copy to clipboard operation
vscode-solidity copied to clipboard

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

Open rocketman-21 opened this issue 1 year ago • 10 comments

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

  • The server attempted to restart multiple times after encountering errors but eventually crashed and did not restart after the 5th crash within a 3-minute window.

Log Snippets

  • Validation attempts using both local and remote compilers were noted before and after the errors occurred.
  • The final message indicated that the server crashed 5 times in the last 3 minutes and would not be restarted.

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

  • VS Code Version: 1.85.1
  • Solidity Extension Version: 0.0.166
  • Operating System: Mac OSX 13.5.1

Additional Context

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

rocketman-21 avatar Feb 07 '24 20:02 rocketman-21

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

Many thanks.

Configuration is mono repo "checked"

juanfranblanco avatar Feb 12 '24 10:02 juanfranblanco

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

chapati23 avatar Feb 13 '24 15:02 chapati23

Any repo example? @chapati23

juanfranblanco avatar Feb 13 '24 15:02 juanfranblanco

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 avatar Feb 13 '24 22:02 rocketman-21

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": ""
}

rocketman-21 avatar Feb 13 '24 22:02 rocketman-21

@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 avatar Feb 14 '24 07:02 juanfranblanco

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 avatar Feb 14 '24 11:02 juanfranblanco

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

juanfranblanco avatar Feb 14 '24 11:02 juanfranblanco

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?

rocketman-21 avatar Feb 15 '24 15:02 rocketman-21

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

juanfranblanco avatar Feb 16 '24 06:02 juanfranblanco