Skip to content

autoIndent doesn't handle indented wrapped TS lines well #29285

Closed

Description

@Tyriar
if (a) {
	b = `foo` + 
		`bar`;
}

Put cursor after } and press enter:

screen shot 2017-06-22 at 12 48 14 pm

Ran into this while changing some terminal code, specifically:

		if (fgColor) {
			css += `.monaco-workbench .panel.integrated-terminal .xterm { color: ${fgColor}; }` +
				`.monaco-workbench .panel.integrated-terminal .xterm:not(.xterm-cursor-style-underline):not(.xterm-cursor-style-bar).focus .terminal-cursor,` +
				`.monaco-workbench .panel.integrated-terminal .xterm:not(.xterm-cursor-style-underline):not(.xterm-cursor-style-bar):focus .terminal-cursor { background-color: ${fgColor} }` +
				`.monaco-workbench .panel.integrated-terminal .xterm:not(.focus):not(:focus) .terminal-cursor { outline-color: ${fgColor}; }` +
				`.monaco-workbench .panel.integrated-terminal .xterm.xterm-cursor-style-bar .terminal-cursor::before,` +
				`.monaco-workbench .panel.integrated-terminal .xterm.xterm-cursor-style-underline .terminal-cursor::before { background-color: ${fgColor}; }` +
				`.monaco-workbench .panel.integrated-terminal .xterm.xterm-cursor-style-bar.focus.xterm-cursor-blink .terminal-cursor::before,` +
				`.monaco-workbench .panel.integrated-terminal .xterm.xterm-cursor-style-underline.focus.xterm-cursor-blink .terminal-cursor::before { background-color: ${fgColor}; }`;
		}

Activity

  1. added
    bug
    editor-autoindent
    typescript
    on Jun 22, 2017
  2. rebornix commented on Jun 22, 2017

    @rebornix
    Contributor

    Root cause: don't have a clue whether the unexpected indentation of previous is intentional or not.

    Atom/Sublime/TextMate don't have this issue as they only change indentation when type, if you press enter, it doesn't change the indentation as they think the indentation of current line is intentional so it no longer modify that.

    Matt Bierner (@mjbvz) do you think it's a good idea to disable indentation check on Enter?

  3. added
    under-discussion
    on Jun 22, 2017
  4. Tyriar commented on Jun 23, 2017

    @Tyriar
    ContributorAuthor

    I've use this pattern pretty frequently, either having 1 or 2 indents on wrapped lines. I'd likely opt to disable if it stayed as is. Here's another common thing I do:

    if (someVeryLongConditionLine === true ||
        andAnotherOne) {
      doSomething();
    }
    
  5. Tyriar commented on Jun 27, 2017

    @Tyriar
    ContributorAuthor

    #29492

    The current behavior is a little better but still not ideal. Consider the following:

    image

    Move up:

    image

    Move down:

    image

  6. rebornix commented on Nov 21, 2017

    @rebornix
    Contributor

    Move lines up and down around the intentional indentation can lead to this problem, however if you are just moving lines across your intentional changed area, it'll not affect your final content

    movelines-wrapped

    I'd like to move this fr/bug to backlog at this moment.

  7. removed
    bug
    on Nov 21, 2017
  8. added this to the Backlog milestone on Nov 21, 2017
  9. locked and limited conversation to collaborators on Jan 5, 2018
  10. added a commit that references this issue on Sep 6, 2026
    f5a1741
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

editor-autoindenttypescriptunder-discussion

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions