Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not go to definition and remote "latest" compiler version is still 0.8.19 #440

Open
ClaudeZsb opened this issue Jan 8, 2024 · 3 comments

Comments

@ClaudeZsb
Copy link

I have two project, one with solc 0.8.19 and the other one with solc 0.8.21.

First of all, within the project with solc 0.8.19, I have default extension settings, which means in this workspace, remote and latest compiler will be used. If you run cmd Solidity: get compiler release, you'll see that the latest is 0.8.23. But if you run cmd Solidity: compiler information, you'll get Compiler using remote version: 'latest', solidity version: 0.8.19+commit.7dd6d404.Emscripten.clang. So this is my first question, that the remote latest solc is somehow locked on 0.8.19.

Secondly, within the project with solc 0.8.19, I cannot use goto definition and references, and hover neither. Output of Solidity language server said that

[Error - 15:14:40] Request textDocument/hover failed.
  Message: Request textDocument/hover failed with message: Cannot read properties of undefined (reading 'sort')
  Code: -32603 
[Error - 15:14:40] Request textDocument/definition failed.
  Message: Request textDocument/definition failed with message: Cannot read properties of undefined (reading 'sort')
  Code: -32603 

Within the project with solc 0.8.21, since the latest remote is 0.8.19, I've already changed it to remote 0.8.21 instead of latest. Hover seems good. But when you want to goto definition or references, the output log said that

[Error - 15:17:17] Request textDocument/definition failed.
  Message: Request textDocument/definition failed with message: Maximum call stack size exceeded
  Code: -32603 

Although, goto definition or references didn't work for both of projects, their reason seems to be different.

@F01ivor4
Copy link

Same issue maybe: #437

@juanfranblanco
Copy link
Owner

@ClaudeZsb check the latest and see if it fixes it

@fluffywaffles
Copy link

fluffywaffles commented Feb 22, 2024

On latest (vscode-solidity-server@0.0.171), and curiously, the server seems to be trying to use multiple versions at once--and it insists on installing soljson-latest.js, which I am assuming is where 0.8.19 is coming from... LSP log output attached. I have scrubbed from the log output some details about the code in question, but it is still largely complete.

LSP Log output, verbosity=debug
[START][2024-02-21 23:39:24] LSP logging initiated
[INFO][2024-02-21 23:39:24] .../vim/lsp/rpc.lua:662	"Starting RPC client"	{  args = { "--stdio" },  cmd = "/home/fluffywaffles/.npm/bin/vscode-solidity-server",  extra = {}}
[DEBUG][2024-02-21 23:39:24] .../vim/lsp/rpc.lua:284	"rpc.send"	{  id = 1,  jsonrpc = "2.0",  method = "initialize",  params = {    capabilities = {      textDocument = {        callHierarchy = {          dynamicRegistration = false        },        codeAction = {          codeActionLiteralSupport = {            codeActionKind = {              valueSet = { "", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" }            }          },          dataSupport = true,          dynamicRegistration = false,          isPreferredSupport = true,          resolveSupport = {            properties = { "edit" }          }        },        completion = {          completionItem = {            commitCharactersSupport = false,            deprecatedSupport = true,            documentationFormat = { "markdown", "plaintext" },            insertReplaceSupport = true,            insertTextModeSupport = {              valueSet = { 1, 2 }            },            labelDetailsSupport = true,            preselectSupport = true,            resolveSupport = {              properties = {}            },            snippetSupport = true,            tagSupport = {              valueSet = { 1 }            }          },          completionItemKind = {            valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }          },          contextSupport = false,          dynamicRegistration = false        },        declaration = {          linkSupport = true        },        definition = {          linkSupport = true        },        documentHighlight = {          dynamicRegistration = false        },        documentSymbol = {          dynamicRegistration = false,          hierarchicalDocumentSymbolSupport = true,          symbolKind = {            valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 }          }        },        hover = {          contentFormat = { "markdown", "plaintext" },          dynamicRegistration = false        },        implementation = {          linkSupport = true        },        publishDiagnostics = {          relatedInformation = true,          tagSupport = {            valueSet = { 1, 2 }          }        },        references = {          dynamicRegistration = false        },        rename = {          dynamicRegistration = false,          prepareSupport = true        },        semanticTokens = {          augmentsSyntaxTokens = true,          dynamicRegistration = false,          formats = { "relative" },          multilineTokenSupport = false,          overlappingTokenSupport = true,          requests = {            full = {              delta = true            },            range = false          },          serverCancelSupport = false,          tokenModifiers = { "declaration", "definition", "readonly", "static", "deprecated", "abstract", "async", "modification", "documentation", "defaultLibrary" },          tokenTypes = { "namespace", "type", "class", "enum", "interface", "struct", "typeParameter", "parameter", "variable", "property", "enumMember", "event", "function", "method", "macro", "keyword", "modifier", "comment", "string", "number", "regexp", "operator", "decorator" }        },        signatureHelp = {          dynamicRegistration = false,          signatureInformation = {            activeParameterSupport = true,            documentationFormat = { "markdown", "plaintext" },            parameterInformation = {              labelOffsetSupport = true            }          }        },        synchronization = {          didSave = true,          dynamicRegistration = false,          willSave = true,          willSaveWaitUntil = true        },        typeDefinition = {          linkSupport = true        }      },      window = {        showDocument = {          support = true        },        showMessage = {          messageActionItem = {            additionalPropertiesSupport = false          }        },        workDoneProgress = true      },      workspace = {        applyEdit = true,        configuration = true,        didChangeWatchedFiles = {          dynamicRegistration = false,          relativePatternSupport = true        },        semanticTokens = {          refreshSupport = true        },        symbol = {          dynamicRegistration = false,          hierarchicalWorkspaceSymbolSupport = true,          symbolKind = {            valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 }          }        },        workspaceEdit = {          resourceOperations = { "rename", "create", "delete" }        },        workspaceFolders = true      }    },    clientInfo = {      name = "Neovim",      version = "0.9.5"    },    initializationOptions = "/home/fluffywaffles/.cache/nvim/vscode-solidity-server",    processId = 1410116,   ...}
[DEBUG][2024-02-21 23:39:25] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  jsonrpc = "2.0",  method = "window/logMessage",  params = {    message = "1",    type = 3  }}
[INFO][2024-02-21 23:39:25] ...lsp/handlers.lua:539	"1"
[DEBUG][2024-02-21 23:39:25] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  jsonrpc = "2.0",  method = "window/logMessage",  params = {    message = "initVersion",    type = 4  }}
[DEBUG][2024-02-21 23:39:25] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  jsonrpc = "2.0",  method = "window/logMessage",  params = {    message = "latest",    type = 4  }}
[DEBUG][2024-02-21 23:39:25] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  id = 1,  jsonrpc = "2.0",  result = {    capabilities = {      completionProvider = {        resolveProvider = false,        triggerCharacters = { "." }      },      definitionProvider = true,      hoverProvider = true,      referencesProvider = true,      textDocumentSync = 1,      workspace = {        workspaceFolders = {          supported = true        }      }    }  }}
[INFO][2024-02-21 23:39:25] ...lsp/handlers.lua:539	"initVersion"
[INFO][2024-02-21 23:39:25] ...lsp/handlers.lua:539	"latest"
[DEBUG][2024-02-21 23:39:25] .../vim/lsp/rpc.lua:284	"rpc.send"	{  jsonrpc = "2.0",  method = "initialized",  params = vim.empty_dict()}
[DEBUG][2024-02-21 23:39:25] .../vim/lsp/rpc.lua:284	"rpc.send"	{  jsonrpc = "2.0",  method = "workspace/didChangeConfiguration",  params = {    settings = {      solidity = {        compileUsingRemoteVersion = "v0.8.23+commit.f704f362",        formatter = "forge"      }    }  }}
[INFO][2024-02-21 23:39:25] .../lua/vim/lsp.lua:1344	"LSP[vscode-solidity-server]"	"server_capabilities"	{  server_capabilities = {    completionProvider = {      resolveProvider = false,      triggerCharacters = { "." }    },    definitionProvider = true,    hoverProvider = true,    referencesProvider = true,    textDocumentSync = {      change = 1,      openClose = true,      save = {        includeText = false      },      willSave = false,      willSaveWaitUntil = false    },    workspace = {      workspaceFolders = {        supported = true      }    }  }}
[DEBUG][2024-02-21 23:39:25] .../vim/lsp/rpc.lua:284	"rpc.send"	{  jsonrpc = "2.0",  method = "textDocument/didOpen",  params = {    textDocument = {      languageId = "solidity",      text = "...",      uri = "file:///home/fluffywaffles/dev/work/compound/quark/test/quark-core/EIP712.t.sol",      version = 0    }  }}
[DEBUG][2024-02-21 23:39:25] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  id = 0,  jsonrpc = "2.0",  method = "client/registerCapability",  params = {    registrations = { {        id = "5f1a2e47-6ae6-4663-bb1e-904b9d47b6c4",        method = "workspace/didChangeWorkspaceFolders",        registerOptions = vim.empty_dict()      } }  }}
[DEBUG][2024-02-21 23:39:25] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  jsonrpc = "2.0",  method = "window/logMessage",  params = {    message = "1",    type = 3  }}
[DEBUG][2024-02-21 23:39:25] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  jsonrpc = "2.0",  method = "window/logMessage",  params = {    message = "initVersion",    type = 4  }}
[DEBUG][2024-02-21 23:39:25] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  jsonrpc = "2.0",  method = "window/logMessage",  params = {    message = "v0.8.23+commit.f704f362",    type = 4  }}
[WARN][2024-02-21 23:39:25] ...lsp/handlers.lua:137	"The language server vscode-solidity-server triggers a registerCapability handler despite dynamicRegistration set to false. Report upstream, this warning is harmless"
[DEBUG][2024-02-21 23:39:25] .../vim/lsp/rpc.lua:403	"server_request: callback result"	{  result = vim.NIL,  status = true}
[DEBUG][2024-02-21 23:39:25] .../vim/lsp/rpc.lua:284	"rpc.send"	{  id = 0,  jsonrpc = "2.0",  result = vim.NIL}
[INFO][2024-02-21 23:39:25] ...lsp/handlers.lua:539	"1"
[INFO][2024-02-21 23:39:25] ...lsp/handlers.lua:539	"initVersion"
[INFO][2024-02-21 23:39:25] ...lsp/handlers.lua:539	"v0.8.23+commit.f704f362"
[DEBUG][2024-02-21 23:39:27] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  jsonrpc = "2.0",  method = "window/logMessage",  params = {    message = "Validating using the compiler selected: remote",    type = 3  }}
[INFO][2024-02-21 23:39:27] ...lsp/handlers.lua:539	"Validating using the compiler selected: remote"
[DEBUG][2024-02-21 23:39:27] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  jsonrpc = "2.0",  method = "window/logMessage",  params = {    message = "Validating using compiler version: 0.8.19+commit.7dd6d404.Emscripten.clang",    type = 3  }}
[DEBUG][2024-02-21 23:39:27] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  jsonrpc = "2.0",  method = "window/logMessage",  params = {    message = "Validating using the compiler selected: remote",    type = 3  }}
[DEBUG][2024-02-21 23:39:27] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  jsonrpc = "2.0",  method = "window/logMessage",  params = {    message = "Validating using compiler version: 0.8.19+commit.7dd6d404.Emscripten.clang",    type = 3  }}
[DEBUG][2024-02-21 23:39:27] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  jsonrpc = "2.0",  method = "window/logMessage",  params = {    message = "Validating using compiler selected version: v0.8.23+commit.f704f362",    type = 3  }}
[DEBUG][2024-02-21 23:39:27] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  jsonrpc = "2.0",  method = "textDocument/publishDiagnostics",  params = {    diagnostics = { {        code = "5333",        message = "Source file requires different compiler version (current compiler is 0.8.19+commit.7dd6d404.Emscripten.clang) - note that nightly builds are considered to be strictly less than the released version",        range = {          ["end"] = {            character = 23,            line = 1          },          start = {            character = 0,            line = 1          }        },        severity = 1      } },    uri = "file:///home/fluffywaffles/dev/work/compound/quark/test/quark-core/EIP712.t.sol"  }}
[INFO][2024-02-21 23:39:27] ...lsp/handlers.lua:539	"Validating using compiler version: 0.8.19+commit.7dd6d404.Emscripten.clang"
[INFO][2024-02-21 23:39:27] ...lsp/handlers.lua:539	"Validating using the compiler selected: remote"
[INFO][2024-02-21 23:39:27] ...lsp/handlers.lua:539	"Validating using compiler version: 0.8.19+commit.7dd6d404.Emscripten.clang"
[INFO][2024-02-21 23:39:27] ...lsp/handlers.lua:539	"Validating using compiler selected version: v0.8.23+commit.f704f362"
[DEBUG][2024-02-21 23:39:29] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  jsonrpc = "2.0",  method = "window/logMessage",  params = {    message = "Validating using the compiler selected: remote",    type = 3  }}
[INFO][2024-02-21 23:39:29] ...lsp/handlers.lua:539	"Validating using the compiler selected: remote"
[DEBUG][2024-02-21 23:39:29] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  jsonrpc = "2.0",  method = "window/logMessage",  params = {    message = "Validating using compiler version: 0.8.23+commit.f704f362.Emscripten.clang",    type = 3  }}
[DEBUG][2024-02-21 23:39:29] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  jsonrpc = "2.0",  method = "window/logMessage",  params = {    message = "Validating using compiler selected version: v0.8.23+commit.f704f362",    type = 3  }}
[DEBUG][2024-02-21 23:39:29] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  jsonrpc = "2.0",  method = "textDocument/publishDiagnostics",  params = {    diagnostics = { {        code = "9755",        message = "Wrong argument count for struct constructor: 0 arguments given but expected 5.",        range = {          ["end"] = {            character = 77,            line = 107          },          start = {            character = 47,            line = 107          }        },        severity = 1      } },    uri = "file:///home/fluffywaffles/dev/work/compound/quark/test/quark-core/EIP712.t.sol"  }}
[INFO][2024-02-21 23:39:29] ...lsp/handlers.lua:539	"Validating using compiler version: 0.8.23+commit.f704f362.Emscripten.clang"
[INFO][2024-02-21 23:39:29] ...lsp/handlers.lua:539	"Validating using compiler selected version: v0.8.23+commit.f704f362"

What's interesting to me is the Validating using compiler version lines, which sometimes say 0.8.23 (yay!) but then it switches to 0.8.19... It almost seems like a race condition, and 0.8.19 always eventually wins, even if for a short time I get proper diagnostics from 0.8.23.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants