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

TypeScript formatter suddenly forgets about formatting rules #14599

Closed
joaomoreno opened this issue Oct 27, 2016 · 8 comments
Closed

TypeScript formatter suddenly forgets about formatting rules #14599

joaomoreno opened this issue Oct 27, 2016 · 8 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug typescript Typescript support issues verified Verification succeeded

Comments

@joaomoreno
Copy link
Member

While developing on Code's source code, the following has happened to me twice: as I edit a file, the language service somehow forgets about the formatting rules and starts formatting everything with 4 spaces, instead of a tab.

@jrieken suggests that

yes - typescript has ‘forgotten’ to which project your file belongs and now uses default settings (from the default project)
this happens after a rebase/sync/etc
restart typescript server and you’ll be happy again

This happened during regular coding, I did not mess with rebase/sync. It literally changed mid-edit. Reloading the TypeScript didn't fix it. Only reloading the window did.

@sandy081
Copy link
Member

I also saw this issue. I do following steps

  • Reload window
  • Convert to tabs manually

I felt it was my git config but do not know if it is related to it

@jrieken jrieken removed their assignment Oct 27, 2016
@dbaeumer dbaeumer added bug Issue identified by VS Code Team member as probable bug typescript Typescript support issues labels Oct 28, 2016
@jedfonner
Copy link

Happens to me too on v1.7.1 on OSX.

@dbaeumer
Copy link
Member

@jedfonner do you have any reproducible steps ?

@faisalhakim47
Copy link

faisalhakim47 commented Nov 15, 2016

it happens to me too in javascript, I cant reproduce it, because it happens occasionally after paste some code and format it. I use format on save. v1.7.1 on Ubuntu

@dbaeumer
Copy link
Member

@mhegazy @vladima any idea why this happens.

The bug came in with our update to tsserver 2.0.3. We use the formatter by setting the format options to use per file using the configure request. It looks like these settings can get lost in the tsserver.

@dbaeumer
Copy link
Member

@mhegazy @vladima after our discussion today I have an idea what might cause this. Will look into fixing this on our end.

@dbaeumer
Copy link
Member

So what I think happens is as follows:

  • all files of a TS project are close
  • tsserver unloads the project

However the formatter provide doesn't unload the fact that it needs to resent the formatting options. I added code to remove that info on file close.

@sandy081
Copy link
Member

sandy081 commented Dec 9, 2016

I have not seen this happening now. Hence marking this as verified.

@sandy081 sandy081 added the verified Verification succeeded label Dec 9, 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
bug Issue identified by VS Code Team member as probable bug typescript Typescript support issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

6 participants