Skip to content

editor: VS Code extension doesn't work for new unsaved files #25

@buzinas

Description

@buzinas

Description

The extension works well for any existing files (.ts, .tsx, .css etc), but if you use CMD+N to create a new file (or double click on the tab bar), and create a new file (prior to saving it), even if VS Code detects the file as TypeScript (as you e.g. paste a type), or if you manually select the TypeScript language on the dropdown, the extension doesn't work.

Steps to reproduce

  1. CMD+N to create a new file
  2. Copy and paste the code below:
    type MyType {
      n: number;
      s: string;
    }
  3. If you have auto-detection enabled, VS Code will detect the file as TypeScript. If not, you can manually go to the dropdown at the bottom and select TypeScript.
  4. Right-click and select "Format Document"

Expected

The file is formatted.

Actual

This message is displayed saying that OXC cannot format TypeScript files.

Image

Also, if you select "Format Document with…" instead, OXC won't be one of the options.

Once you save the file as e.g. types.ts, then you can use the extension as normal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions