Skip to content

Indent after <ENTER> is incorrect after endless method definition #3997

@eregon

Description

@eregon

Description

Ruby LSP Information

Ruby LSP Information

VS Code Version

1.110.1

Ruby LSP Extension Version

0.10.0

Ruby LSP Server Version

Unknown

Ruby LSP Add-ons

Ruby Version

3.3.5

Ruby Version Manager

chruby

Installed Extensions

Click to expand
  • cmake (0.0.17)
  • cmake-tools (1.22.28)
  • code-spell-checker (4.5.6)
  • cpp-devtools (0.3.6)
  • cpptools (1.30.5)
  • cpptools-extension-pack (1.5.1)
  • cpptools-themes (2.0.0)
  • debugpy (2025.18.0)
  • python (2026.2.0)
  • ruby-lsp (0.10.0)
  • rust-analyzer (0.3.2811)
  • test-adapter-converter (0.2.1)
  • vscode-github-actions (0.31.0)
  • vscode-jsonnet (0.7.4)
  • vscode-pylance (2026.1.1)
  • vscode-test-explorer (2.22.1)

Ruby LSP Settings

Click to expand
Workspace
{}
User
{
  "enabledFeatures": {
    "codeActions": true,
    "diagnostics": false,
    "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": "auto"
  },
  "customRubyCommand": "",
  "formatter": "auto",
  "linters": null,
  "bundleGemfile": "",
  "testTimeout": 30,
  "branch": "",
  "pullDiagnosticsOn": "both",
  "useBundlerCompose": false,
  "bypassTypechecker": false,
  "rubyExecutablePath": "",
  "indexing": {},
  "erbSupport": true,
  "featureFlags": {},
  "sigOpacityLevel": "1"
}

Reproduction steps

Create a new file with:

def foo = 42

Put the cursor at the end of the line, after 42, type ENTER.
The cursor should have indentation 0 but it has indentation 2:

def foo = 42
  #<cursor
Image

(unfortunately it seems hard to screenshot the cursor so I annotated it)

The same happens in a class, where e.g. it should have indentation 2 and not 4 after ENTER.

I think this is an important bug to fix, IMO it gives the impression that Ruby LSP doesn't really doesn't understand Ruby syntax properly due to this bug.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions