Code in code blocks is wrongly indented in multi-line functions using `js` and `ts` languages

Steps to reproduce

Try to create a JavaScript snippet with the following code (excluding the comments):

function foo(
  a,
  b, // indents wrong
  c, // continues to indent wrong
) {

} // indents wrong on legacy edit mode only

Now try to create the following TypeScript snippet (excluding the comments):

function foo(
  a: number,
  b: string, // indents wrong
  c: boolean, // continues to indent wrong
): void {

} // indents wrong on legacy edit mode only

Expected result

JS and TS language code blocks should indent properly when typing functions which span multiple lines.

Actual result

All parameters after the first are incorrectly indented. In legacy edit mode, the opening and closing curly braces are incorrectly indented.

Environment

  • Operating system: Windows 10 Home Version 10.0.19042 Build 19042
  • Debug info:
SYSTEM INFO:
	Obsidian version: v0.13.14
	Installer version: v0.12.19
	Login status: not logged in
	Insider build toggle: off
	Live preview: on
	Legacy editor: on
	Base theme: dark
	Community theme: none
	Snippets enabled: 1
	Safe mode: on

Additional information

I experienced this after the v0.13.14 update.

This issue affects both the legacy edit mode and live preview mode, although the legacy edit mode is affected more. This issue was present when using the JavaScript and TypeScript languages but it may also affect other languages.

The issue is also only present when typing functions where the parameter list spans multiple lines. Functions with a parameter list on a single line are indented correctly.

I tried turning off the “Smart indent lists” setting but there was no change in behavior. I am using spaces for tabs (the “Use tabs” setting is OFF) and my tab size is set to 2. I disabled all themes and snippets but noticed no change.

I don’t understand what the problem is.

Here are some captured screenshots:
legacy-edit-ts
live-preview-ts

Upstream report: Javascript/Typescript mode indentation in function parameters · Issue #6853 · codemirror/CodeMirror · GitHub