DEV Community

Hannes Calitz
Hannes Calitz

Posted on

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

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.

Top comments (4)

Collapse
 
heyitshannes profile image
Hannes Calitz

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.

Collapse
 
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!

Collapse
 
bhardesushama profile image
bhardesushama

I tried this Not working for me

Collapse
 
ben profile image
Ben Halpern

Thanks for this!