Search code examples
javascripttypescriptvisual-studio-codegoogle-chrome-devtoolsprivate-members

Private class fields: support in Chrome developer tools / Visual Studio Code


Private class fields have been shipped in Chrome 74 according to caniuse. I am aware that despite being shipped, private class fields still have proposal status as of TC39.

We would very much love to use these in the webcomponent library we're developing. Our build setup fully supports this and the code works as designed.

Unfortunately, by the looks of it there is still no support for this feature in the Chrome developer tools (as of Version 78.0.3904.97) - despite a Chromium issue claiming the opposite.

Not only can you not look into private class fields while debugging

Chrome debugger won't show the contents of private class fields

but also the indentation is completely screwed in the source view (we're using sourcemaps). Identically wrong indentation behaviour is found in Visual Studio Code 1.39.2 (which, I assume, is the reason I'm seeing this wrong indentation in Chrome developer tools).

Indentation is wrecked

Also VS Code linter shows Invalid character:

VS code linter does not know prviate class field syntax

I tried to research information on this, but wasn't able to find anything substantial.

Does anyone have any reference/knowledge as of

  1. is this supposed to work (which I'd expect for a feature shipped 5 versions ago, maybe behind a flag?),
  2. if not, when will this work,
  3. is there any way to enable support for private class fields in VS Code (e.g. via a plugin)?

What I was able to find:


Solution

  • When will this work?