Ruby LSP Rails prevents dropping the database by keeping an active connection
Ruby LSP Information
VS Code Version
1.95.3
Ruby LSP Extension Version
0.8.13
Ruby LSP Server Version
0.22.1
Ruby LSP Addons
- Ruby LSP Rails
Ruby Version
3.3.5
Ruby Version Manager
none
Installed Extensions
Click to expand
- copilot (1.245.0)
- copilot-chat (0.22.4)
- gitlens (16.0.2)
- ruby-lsp (0.8.13)
- vscode-eslint (3.0.10)
- vscode-pull-request-github (0.100.3)
Ruby LSP Settings
Click to expand
Workspace
{
"rubyVersionManager": {
"identifier": "none"
}
}
User
{
"enableExperimentalFeatures": true,
"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": false,
"definition": true,
"workspaceSymbol": true,
"signatureHelp": true,
"typeHierarchy": true
},
"featuresConfiguration": {},
"addonSettings": {},
"rubyVersionManager": {
"identifier": "none"
},
"customRubyCommand": "",
"formatter": "auto",
"linters": null,
"bundleGemfile": "",
"testTimeout": 30,
"branch": "",
"pullDiagnosticsOn": "both",
"useBundlerCompose": false,
"bypassTypechecker": false,
"rubyExecutablePath": "",
"indexing": {},
"erbSupport": true,
"useLauncher": false,
"featureFlags": {}
}
Reproduction steps
- Open any Rails project with PostgreSQL database.
- Run the command
bin/rails db:dropin the terminal. - Observe the error message stating that the database cannot be dropped because it is being accessed by another user.
This is expected because the Rails add-on would still have its Rails process active. I'm not sure how we could solve this, as we would need to intercept that command and trigger the LSP to shutdown.
To workaround this for now, you should be able to stop Ruby LSP (Commmand-Shift-P then 'RubyLSP: Stop') before running db:drop.
Re-opening this as it affects multiple users and there's currently no good workaround.
+1 this is annoying, have to force close vscode in order to drop the DB.
+1 this is annoying, have to force close vscode in order to drop the DB.
See my comment above, you can stop Ruby LSP before running db:drop.
Ah right, sorry missed that, thanks @andyw8 🙏