-
Notifications
You must be signed in to change notification settings - Fork 78
Doesn't indent multiple variable declarations #40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
As far as Typescript goes, there's just one canonical answer to how things should be: However And lucky for you, tsserver agrees :) The good news/workaround: If you use typescript-mode with tide, it will use tsserver to reformat the document on each save, giving you the correct formatting. It would of course be nice if we could make typescript-mode also indent like this out of the box. If anyone feels like making a PR which fixes this, I'll be happy to review. |
Have at look at that pull request. It does not handle the case of multiline destructuring assignments. E.g., I think they ought to be indented like this: var a = 1,
{x,
y,
z} = object; But typescript mode is still aligning the continuations with the opening brace: var a = 1,
{x,
y,
z} = object; I have been using advice that fixes both cases. However there are a lot more edge cases to destructuring that I'm probably ignoring so I excluded. I notice that typescript mode does correctly indent multiline desctructuring statements when they are on their own. So it would probably not be too difficult to generalize that in a way that it just gives the correct offset relative to the opening of the destructure (which could then be added to the normal multiline to get the proper indentation). |
What is the state of this issue? It would be really cool if typescript-mode would indent multiple variable declarations as in the opening comment, even if it doesn't get destructuring statements right in all edge cases. |
@lddubeau I do not have the skills required nor any familiarity with the codebase to be able to do that. I just wanted to open an issue with a feature request and realised it existed already, so I popped in to see if there were still plans of adding this feature. |
typescript.el
indents like this:I posit that it should indent like this:
The text was updated successfully, but these errors were encountered: