Skip to content

VS Code extension is not registered as a formatter for TypeScript, shows for a long time or forever #17586

Description

@Meligy

I tried using Oxc VS Code extension, but noticed that it is not recognised as a formatter, even for TS files.
(Note: I'm aware there're other isues for non JS/TS files, but that's different. It's TS)

At least that's how it looked like that. First for about 10-15 minutes, then later forever when I tried to restart.

My VS Code setting:

"editor.defaultFormatter": "oxc.oxc-vscode",

(And removed any language-specific formatter)

Then when I tried to save a TypeScript file, having format on save enabled, I got this error:

Image

I tried the following ways to solve this:

  • Installing oxfmt in the repo
  • Installing oxlint in the repo
  • Using a JSON config as .oxcmtrc.jsonc and then .oxcmtrc.json, and also oxcmtrc.json (no .), because it seemed when I looked in in source code here that maybe different parts of the code look for different patterns
  • I ensured that versions of "oxc.fmt.configPath": ".oxfmtrc.jsonc" matching each of the files above
  • Keeping both .oxcmtrc.json and oxcmtrc.json with the same content
  • I also set "oxc.trace.server": "verbose", but it was still silent for as long as the extension was not running as a formatter
  • I also optionally tried installing tsgo and setting "oxc.path.tsgolint": "node_modules/@typescript/native-preview/bin/tsgo.js",

Then I noticed while writing this issue that the formatter started working again.

I restarted VS Code to star to counting the time. But it never showed up that time.
I also tried the extension command "Restart oxfmt server" and it didn't help.

Tested versions:

  • Oxc VS Code Extension: 1.36.0
  • oxfmt: 0.21.0
  • oxlint: 1.36.0 (also tried 1.17.0-alpha.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-editorArea - Editor and Language Server

    Type

    Fields

    Priority

    None yet

    Effort

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions