ruby-lsp-rails: Crashing on startup when connecting to the database

Description

Ruby LSP Information

Suddenly since yesterday, when I save a ruby file it brings up the "Ruby LSP is formatting the document… " wait message and never actually completes. I think this is more related to the LSP server crashing but I can’t prove it yet.

Downgrading the extension to v0.18.2 removes the “problem” so there’s something going on. EDIT - It did not remove the problem.

I need to actually do work so I’m keeping it at this version and when I get more time (shortly) I’ll update this issue with all the diagnostics and debug information I can.

Raising this issue incase anyone else has strange crashes in v0.18.3


### Ruby LSP Information

#### VS Code Version

1.95.1

#### Ruby LSP Extension Version

0.8.13

#### Ruby LSP Server Version

0.21.3

#### Ruby LSP Addons

- Ruby LSP Rails

#### Ruby Version

3.3.5

#### Ruby Version Manager

rbenv

#### Installed Extensions

<details>
<summary>Click to expand</summary>

- astro-vscode (2.15.4)
- copilot (1.243.0)
- copilot-chat (0.22.1)
- csharp (2.50.27)
- debugpy (2024.12.0)
- errorlens (3.20.0)
- githistory (0.6.20)
- github-markdown-preview (0.3.0)
- gitlens (15.6.3)
- go (0.42.1)
- hcl (0.6.0)
- isort (2023.10.1)
- jupyter (2024.10.0)
- jupyter-keymap (1.1.2)
- jupyter-renderers (1.0.21)
- markdown-checkbox (0.4.0)
- markdown-emoji (0.3.0)
- markdown-footnotes (0.1.1)
- markdown-mermaid (1.26.0)
- markdown-preview-github-styles (2.1.0)
- markdown-table-prettify (3.6.0)
- markdown-yaml-preamble (0.1.0)
- powershell (2024.4.0)
- prettier-vscode (11.0.0)
- python (2024.18.0)
- remote-containers (0.388.0)
- remote-explorer (0.4.3)
- remote-server (1.5.2)
- remote-ssh (0.115.0)
- remote-ssh-edit (0.87.0)
- remote-wsl (0.88.5)
- ruby-lsp (0.8.13)
- scala (0.5.8)
- sentinel (0.3.0)
- sorbet-vscode-extension (0.3.37)
- spellright (3.0.140)
- terraform (2.33.0)
- tsl-problem-matcher (0.6.2)
- vscode-better-align (1.4.2)
- vscode-docker (1.29.3)
- vscode-dotnet-runtime (2.2.2)
- vscode-eslint (3.0.10)
- vscode-github-actions (0.27.0)
- vscode-icons (12.9.0)
- vscode-pull-request-github (0.100.0)
- vscode-pylance (2024.11.1)
- vscode-remote-extensionpack (0.26.0)
- vscode-table-formatter (1.2.1)
- vscode-wakatime (24.6.2)
- vsliveshare (1.0.5941)
</details>

#### Ruby LSP Settings

<details>
<summary>Click to expand</summary>

##### Workspace

```json
{}
User
{
  "enableExperimentalFeatures": false,
  "enabledFeatures": {
    "codeActions": true,
    "diagnostics": true,
    "documentHighlights": true,
    "documentLink": true,
    "documentSymbols": true,
    "foldingRanges": true,
    "formatting": true,
    "hover": true,
    "inlayHint": true,
    "onTypeFormatting": true,
    "selectionRanges": true,
    "semanticHighlighting": true,
    "completion": true,
    "codeLens": true,
    "definition": true,
    "workspaceSymbol": true,
    "signatureHelp": true,
    "typeHierarchy": true
  },
  "featuresConfiguration": {},
  "addonSettings": {},
  "rubyVersionManager": {
    "identifier": "rbenv"
  },
  "customRubyCommand": "",
  "formatter": "auto",
  "linters": null,
  "bundleGemfile": "",
  "testTimeout": 30,
  "branch": "",
  "pullDiagnosticsOn": "both",
  "useBundlerCompose": false,
  "bypassTypechecker": false,
  "rubyExecutablePath": "",
  "indexing": {},
  "erbSupport": true,
  "useLauncher": false,
  "featureFlags": {}
}
```

Reproduction steps

TBA

  1. Start the Ruby LSP using VSCode
  2. Open a Ruby file
  3. Make a simple edit
  4. Save it

Image

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 4
  • Comments: 16 (8 by maintainers)

Most upvoted comments

(I should move this issue to the ruby-lsp-rails repo, but will leave it here for visibility for now since users may not know where this originates).

Hi, @andyw8 . I have the same problem and tried what you said here:

On the terminal, if you run bin/rails runner ‘puts User.count’ (or something similar that hits the database) does it succeed?

It failed, really didn’t connect to the db. That’s because I don’t use rails natively while developing. I do all my testing inside a docker container.

I don’t know if this helpful for you somehow.