castwide / solargraph

A Ruby language server.
https://solargraph.org
MIT License
1.87k stars 154 forks source link

v0.50.0 throws "[TypeError] no implicit conversion of nil into String" / "[NameError] uninitialized constant" #701

Open sephraim opened 6 months ago

sephraim commented 6 months ago

Problem

Solargraph gem v0.49.0 seems to work fine for me. However with v0.50.0, whenever I open a .rb file in VS Code, I repeatedly get the following errors no matter where I click in the file:

[Error - 12:36:41 AM] Request textDocument/hover failed.
  Message: [TypeError] no implicit conversion of nil into String
  Code: -32603 
[Error - 12:36:41 AM] Request textDocument/documentHighlight failed.
  Message: [TypeError] no implicit conversion of nil into String
  Code: -32603

I saw the following error pop up as well at one point, but I'm not sure how to reproduce it:

[Error - 12:36:41 AM] Request textDocument/formatting failed.
  Message: [NameError] uninitialized constant Solargraph::LanguageServer::Message::TextDocument::Formatting::RuboCop

I do not get these errors when using gem v0.49.0.

My setup

Versions

Solargraph config

I have env var SOLARGRAPH_GLOBAL_CONFIG=~/.config/solargraph/config.yml. Here is my ~/.config/solargraph/config.yml file:

---
include:
- "**/*.rb"
exclude:
- spec/**/*
- test/**/*
- vendor/**/*
- ".bundle/**/*"
require: []
domains: []
reporters:
- rubocop
- require_not_found
formatter:
  rubocop:
    cops: safe
    except: []
    only: []
    extra_args: []
require_paths: []
plugins: []
max_files: 5000

VS Code config

Here are my Ruby / Solargraph settings inside my settings.json file:

  "[ruby]": {
    "editor.defaultFormatter": "castwide.solargraph",
    "editor.formatOnSave": true,
    "editor.formatOnType": true,
    "editor.tabSize": 2,
    "editor.insertSpaces": true,
    "editor.semanticHighlighting.enabled": true,
    "files.trimTrailingWhitespace": true,
    "files.insertFinalNewline": true,
    "files.trimFinalNewlines": true,
    "editor.rulers": [
      120
    ]
  },
  "solargraph.formatting": true,
  "solargraph.diagnostics": true

Rubocop config

Here is my .rubocop.yml file:

AllCops:
  TargetRubyVersion: 3.2

Layout/LineLength:
  Max: 120