[Bug]

Open
#5,429 0 comments 1 reaction 1 assignee View on GitHub

Maintainers usually reply within 1 day

@aiday-mar is already working on this.

Since Aug 2, 2026.

Assessment

This issue has not been assessed yet.

Description

bug editor-indent-detection
Reproducible in vscode.dev or in VS Code Desktop?
  • Not reproducible in vscode.dev or VS Code Desktop
Reproducible in the monaco editor playground?
Monaco Editor Playground Link

https://microsoft.github.io/monaco-editor/playground.html?source=v0.55.1#XQAAAAJ8AAAAAAAAAABBqQkHQ5NjdMjwa-jY7SIQ9S7DNlzs5W-mwj0fe1ZCDRFc9ws9XQE0SJE1jc2VKxhaLFIw9vEWSxW3yscjtPHiSSzE4WUfroqWVtW5X_5X2Eu1DcEHUGBUpzkgp7MHVn16NTpxO4etzyW0R3-SXvNP__5c0AA

Monaco Editor Playground Code
function alpha() { 
	;
}

function beta() { //Comment
;
}
Reproduction Steps
  1. Paste the following code in the playground:
function alpha() { 
}

function beta() { //Comment
}
  1. Place the cursor at the end of the line with alpha() function header.
  2. Press Enter.
  3. There is an auto-indentation for the function body
  4. Now, pace the cursor at the end of the line with beta() function header.
  5. Press Enter.
  6. There is not an auto-indentation.
Actual (Problematic) Behavior

A trailing comment on the function header prevents Monaco from applying the auto-indentation.

Expected Behavior

Both of the function bodies should receive the auto-indentation.

Additional Context

The equivalent bug exists for the following languages, checked on the Home page of Monaco:

  • Python
  • C
  • C#
  • Java
  • Go
  • PHP
  • Rust

I have only verified these languages so far, therefore the list should not be considered exhaustive.

Dominant language
JavaScript
Stars
47k
Forks
4.2k
Avg merge
3d 13h
Merged PRs (30d)
13

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/monaco-editor

All issues in microsoft/monaco-editor

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.