microsoft / TypeScript-Sublime-Plugin

IO wrapper around TypeScript language services, allowing for easy consumption by editor plugins
Apache License 2.0
1.72k stars 237 forks source link

Difficulties with JSX/TSX indentation #729

Open dvcrn opened 4 years ago

dvcrn commented 4 years ago

I have some issues getting indentation for JSX tags playing along nicely. Here's an exmaple:

  render() {
    return (
      <div class="wrap">
        <div>
        </div>
      </div>
      )
  }

Creating a new line anywhere within the JSX block indents to the parent starting line, not the indented one

  render() {
    return (
      <div class="wrap">
      |here
        <div>
        </div>
      </div>
      )
  }

Outside of JSX code the intendation works fine, for example inserting a new line after the opening bracket correctly indents by 2. This also messes with simple code formatting like through vintageous.

I tried playing with the typescript_auto_format setting and set my indent settings for typescript files to

{
    "tab_size": 2,
    "indent_size": 2,
}

but no good. Am I missing a setting here? (

(I have enable_*_language_service off and use typescript LSP through the sublime lsp project)