Reputation: 1495
For no apparent reason, on Monday, my VS2017 starting getting the error highlighted in this SO post, and all JS Intellisense and auto-formatting vanished.
Managed to fix it by turning off Enable the new JavaScript language service
but now the auto-formatting is ignoring my settings; in-house style is brace on newline after functions, which is set, but a Ctrl-E-D reformat now moves all braces to the same line as the function definition.
How do I fix this?
EDIT: I have found this old thread with an identical issue but sadly no fix for the new Language Service: https://developercommunity.visualstudio.com/content/problem/138728/if-statements-still-place-a-opening-brace-on-the-s.html
The irritating thing is that is has been working for months and months, and only stopped yesterday, with no settings changes.
EDIT to add the Intellisense error:
The JavaScript and TypeScript language service has been disabled due to an error. You may see reduced IntelliSense support for your project. Please try reloading your solution to reenable the language service.
Error processing request. Cannot read property 'length' of undefined
TypeError: Cannot read property 'length' of undefined
at createSourceFile (C:\Program Files (x86)\Microsoft SDKs\TypeScript\3.1\tsserver.js:16674:110)
at Object.parseJsonText (C:\Program Files (x86)\Microsoft SDKs\TypeScript\3.1\tsserver.js:16508:26)
at Object.parseJsonText (C:\Program Files (x86)\Microsoft SDKs\TypeScript\3.1\tsserver.js:16330:23)
at ProjectService.loadConfiguredProject (C:\Program Files (x86)\Microsoft SDKs\TypeScript\3.1\tsserver.js:120258:33)
at ProjectService.createAndLoadConfiguredProject (C:\Program Files (x86)\Microsoft SDKs\TypeScript\3.1\tsserver.js:120247:22)
at ProjectService.createLoadAndUpdateConfiguredProject (C:\Program Files (x86)\Microsoft SDKs\TypeScript\3.1\tsserver.js:120251:36)
at ProjectService.openClientFileWithNormalizedPath (C:\Program Files (x86)\Microsoft SDKs\TypeScript\3.1\tsserver.js:120776:44)
at ProjectService.applyChangesInOpenFiles (C:\Program Files (x86)\Microsoft SDKs\TypeScript\3.1\tsserver.js:120882:30)
at Session.handlers.ts.createMapFromTemplate._a.(anonymous function) (C:\Program Files (x86)\Microsoft SDKs\TypeScript\3.1\tsserver.js:121548:46)
at C:\Program Files (x86)\Microsoft SDKs\TypeScript\3.1\tsserver.js:123063:88
at IOSession.Session.executeWithRequestId (C:\Program Files (x86)\Microsoft SDKs\TypeScript\3.1\tsserver.js:123054:28)
at IOSession.Session.executeCommand (C:\Program Files (x86)\Microsoft SDKs\TypeScript\3.1\tsserver.js:123063:33)
at IOSession.Session.onMessage (C:\Program Files (x86)\Microsoft SDKs\TypeScript\3.1\tsserver.js:123083:35)
at Interface.<anonymous> (C:\Program Files (x86)\Microsoft SDKs\TypeScript\3.1\tsserver.js:124346:27)
at Interface.emit (events.js:182:13)
at Interface._onLine (readline.js:290:10)
at Interface._normalWrite (readline.js:433:12)
at Socket.ondata (readline.js:149:10)
at Socket.emit (events.js:182:13)
at addChunk (_stream_readable.js:283:12)
at readableAddChunk (_stream_readable.js:264:11)
at Socket.Readable.push (_stream_readable.js:219:10)
at Pipe.onread (net.js:638:20)
Upvotes: 0
Views: 732
Reputation: 28156
With new language service disabled.
1.After you've disabled the JavaScript Language Service
, use commands below in Developer command prompt to set the option:
CD %VSINSTALLDIR%
vsregedit set . HKCU "ApplicationPrivateSettings\TextEditor\JavaScript\Specific" "PlaceOpenBraceOnNewLineForControlBlocks" string "0*System.Int32*1"
See this.
With new language service enabled.
2.Try creating a new project(maybe you're in node.js project?) to check if similar issue persists, if this issue disappears, maybe the cause of your issue is now your project contains too many JS files. See the limitation here.
If the issue still persists in new project, repair VS or update VS2017 to latest 15.9.16 to check if it helps. I guess there's something broken in your environment.
Also, try deleting the hidden .vs
folder in Solution Directory after closing VS, clean the VS cache and restart VS.
Upvotes: 1