visual-studio-codebabeljsjsxsyntax-highlightingoptional-chaining

Syntax highlighting is not working in VS Code with the Babel extension because of optional chaining


As you can see in the picture, my syntax highlighting stops working just after I used an optional chaining in my JSX file. Please let me know how can I fix the problem. enter image description here

I am using Babel ES6/ES7 in my VS Code.


Solution

  • The mgmcdermott.vscode-language-babel extension should already support optional chaining. See Add support for optional-chaining operator ?. #15. If it's not working for you, consider raising an issue ticket with exact details to reproduce your setup and the problem.

    The issue could also possibly be caused by other extensions or interference from other extensions. Ex. as found in https://github.com/michaelgmcd/vscode-language-babel/issues/94 and https://github.com/microsoft/vscode/issues/101894. If you suspect such an issue, try disabling other JS/Babel extensions or do an extension bisect.