For anyone struggling with code folding on JS files in Visual Studio 2017

heyitshannes profile image Hannes Calitz ・1 min read

Since installing Visual Studio 2017 I have been struggling to get my code folding to work in Javascript. I can't begin to explain how many hours I have wasted trying to find a solution for a problem I was having, and trust me, I have Googled like mad. So in an attempt to help someone who might be struggling with the same issue and kind find the answer, here are the steps I took to fix it.

  1. Open a .JS file.
  2. In the editor window, right click and navigate to Outlining > Stop Outlining.
  3. Right click again and navigate to Outlining > Start Automatic Outlining.
  4. Close the file, and reopen it.

The issue should not be fixed. It's a simple trick, and I have no idea why outlining does this, but hey, this fixes the issue.


Editor guide
heyitshannes profile image
Hannes Calitz Author

UPDATE: Disabling the new Javascript Language Service did the trick to permanently fix this issue. This can be disabled by going to Tools > Options > Text Editor > Javascript/Typescript > Language Service.

fabyyiola profile image
Fabiola Avila

Thank you SO MUCH this was driving me nuts and i never thought about doing these very simple steps, honestly i was thinking about downgrading i surfed online for more than 5 hours... thank you, thank you, thank you!

bhardesushama profile image

I tried this Not working for me

ben profile image
Ben Halpern

Thanks for this!