Skip to content
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

formatOnType does not work when you navigate away from the edited line #12064

Closed
tnikodym opened this issue Sep 15, 2016 · 1 comment
Closed
Assignees
Labels
*as-designed Described behavior is as designed

Comments

@tnikodym
Copy link

  • VSCode Version: 1.5.2
  • OS Version: OSX 10.11.6

I have "editor.formatOnType": true in my settings.json. It works fine when I press enter or closing bracket, but when I navigate away from the edited line (e.g. press UP/DOWN arrow, mouse-click, ...) it does not format the edited line.

Steps to Reproduce:

  1. Type let a = 1;
  2. Press enter
  3. Navigate back to the line and add some whitespace before the number 1
  4. Press DOWN arrow
  5. Notice that the line stays incorrectly formated
@alexdima alexdima assigned jrieken and unassigned alexdima Oct 22, 2016
@jrieken jrieken added the *as-designed Described behavior is as designed label Oct 24, 2016
@jrieken
Copy link
Member

jrieken commented Oct 24, 2016

Yes - format on type only works on certain trigger characters. Extension define what those characters are, for instance TypeScript uses \n, ;, and }.

Assuming your sample is TypeScript/JavaScript this is what happens

  • press enter on well formatted let a = 1; triggered format on type (\n)
  • format on type returns without edits
  • go back to line, miss-format, go back -> No change because arrow keys don't trigger format on type

@jrieken jrieken closed this as completed Oct 24, 2016
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*as-designed Described behavior is as designed
Projects
None yet
Development

No branches or pull requests

3 participants