Add `oxc-codegen` package - a printer written in TS.
### Features
- Prints JS, JSX, TS, TSX.
- Matches `oxc_codegen` exactly on all Test262, TypeScript, Acorn-JSX fixtures.
- Very fast.
### Deficiencies
- Pretty-printing only (no compact/minified output).
- No support for printing comments.
- Source map support is semi-there, but largely untested, and poor API (design doc has some ideas on how to improve it).
### This PR adds
- The printer code.
- Conformance testing infra.
- Further tests for edge cases.
- README.
- Design doc - how it differs from `oxc_codegen` and why, what produces the perf.
### This PR doesn't add
- Not integrated into CI or release pipeline.
### Notes
This started as a slop port of `oxc_codegen`. I've iterated on that base, cleaned it up a lot, and at least skimmed through all of it. I think it's in fairly decent shape.
The design doc is I think worth a read. It explains the rationale for the choices, in particular the "1 codebase, 4 builds" approach.
I've put it in a new top-level directory called `packages`. It's not an app, so didn't seem to me to fit alongside `apps/oxlint` and `apps/oxfmt`. It's pure JS, so not like e.g. `napi/parser`. And it felt too heavyweight to put into `npm` dir. But maybe there's a better place for it.
Co-authored-by: Cameron <cameron.clark@hey.com>
Remove the Prettier related stuff from the conformance, which is purely aimed at JS/TS.
Instead, `oxc_formatter_tests` manage Prettier's test fixtures along with Oxfmt.
`just new-jsx-a11y-rule <name>` panics because `eslint-plugin-jsx-a11y`
uses Flow type annotations, which the Oxc parser can't handle, causing
parse errors that hit `assert!(ret.errors.is_empty())` (introduced in
#15865).
## Changes
- **`tasks/rulegen/src/main.rs`**: Replace two
`assert!(ret.errors.is_empty())` calls — one for test file parsing, one
for rule source file parsing — with `eprintln!` warnings that allow
execution to continue with the partial AST.
The tool can still extract test cases and rule config from a
partially-parsed AST, so this restores pre-#15865 behavior while
surfacing parse issues to the user:
```
Warning: 3 parse error(s) in rule source file (possibly due to Flow types). Attempting to extract rule config anyway.
```
---------
Signed-off-by: Connor Shea <2977353+connorshea@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: connorshea <2977353+connorshea@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Cameron <cameron.clark@hey.com>
## Summary
This PR adds `optimizeEnums` and `optimizeConstEnums` options to the playground's transformer configuration, enabling TypeScript enum optimization features that are already available in the transformer.
## Changes
- Added `optimize_enums: bool` and `optimize_const_enums: bool` fields to the `OxcTransformerOptions` struct in `napi/playground/src/options.rs`
- Updated `apply_transformations` method in `napi/playground/src/lib.rs` to apply these options to `options.typescript.optimize_enums` and `options.typescript.optimize_const_enums`
## Reference
Resolves https://github.com/oxc-project/oxc/blob/d1cf22efc2bc9cf9fa82e887c34965d2ce3004c3/napi/playground/src/options.rs#L59
These options enable:
- `optimize_enums`: Optimize regular (non-const) enums by inlining their member accesses at usage sites when the member value is statically known
- `optimize_const_enums`: Optimize const enums by inlining their values at usage sites and removing the enum declaration
Replaces #20064
The `dom` lib was implicitly being injected, this means stuff like `Token` and `Comment` were in the global scope, which was incorrect.
cc @overlookmotel
## Summary
- Removes `editors/vscode` directory - code has been moved to
https://github.com/nicholasrice/oxc-vscode
- Removes `tasks/vscode_docs` crate (no longer needed)
- Removes CI and release workflows for VS Code extension
- Updates `editors/README.md` to point to the new repository
- Cleans up references in `.gitignore`, `justfile`, `oxc_release.toml`,
`oxfmtrc.jsonc`, `oxlintrc.json`, and `pnpm-workspace.yaml`
closes#17484🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
- Add issue number and repository to prompt
- Instruct Claude to use `gh issue view` to read issue details first
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
> This PR reorganizes the VSCode extension tests by separating unit tests into their own test suite, distinct from integration tests. This allows unit tests to run independently and faster without requiring LSP server initialization.
We have now 3 different test setups:
### `test()`
Will be executed in both modes. Should be used to make sure this works for both ways.
### `testSingleFolderMode()`
Will only be executed for single folders. Testing with multi folder is redundant.
### `testMultiFolderMode()`
Will only be executed in multi folder mode. These are special tests which are only designed for multi folders and makes no sense that it will work in single folder.
---
`loadFixture()` and `getDiagnostics()` will use the second folder when the multi folder mode is activated
It may be a problem, but doesn't matter previously.
Formerly, the `is_reserved_keyword_or_global_object` is
`is_reserved_keyword(s) || is_reserved_keyword(s)`. I think it should be
`is_reserved_keyword(s) || is_global_object(s)` according to its name.
Also, the `.idea` may be because I am using RustRover, which may
automatically create `.idea` folder. So I ignore it in `.gitignore`.
I think I can contribute to `oxc` more when I am free.
This PR shards benchmarks when running on CI. Each benchmark (parser, minifier etc) runs as a separate job, and then a final job combines the results and uploads to Codspeed.
A bit of a hacky implementation. Uses a small NodeJS HTTP server to intercept the results from `codspeed-runner`, and then another NodeJS script to combine them all together, and upload to CodSpeed.
I will submit PRs on Codspeed's runner + action to do it properly, but as I imagine it'll be a slow process getting that merged upstream, I wanted to see if it worked first. We can replace this once it's supported upstream.
Sharding only reduces total time to run the benchmarks by about 70 secs at present, because linter benchmark takes 6 mins alone and holds up the whole process (all the rest are done in ~2 mins). If we can split up the linter benchmark, we can likely get total run time down to around 3 mins. I'll try that in a follow-on PR.
I guess the other upside is we can now add as many benchmarks as we like with impunity - they'll run in parallel, and so won't slow things down overall.
This gets all the new TS types working to the same level TS output was
before and fixes a bunch of other codegen
---------
Co-authored-by: Boshen <boshenc@gmail.com>
1. add a `test.js` file to the project root:
```js
class A extends B {
constructor() {
try {
super();
} finally {
this.a;
}
}
}
```
2. run:
```bash
$ cargo run -p oxc_semantic --example simple
Compiling oxc_semantic v0.5.0 (/home/tzvipm/src/github.com/tzvipm/oxc/crates/oxc_semantic)
Finished dev [unoptimized + debuginfo] target(s) in 32.07s
Running `target/debug/examples/simple`
Wrote AST to: test.ast.txt
Wrote CFG blocks to: test.cfg.txt
Wrote CFG dot diagram to: test.dot
```
3. resulting graph from .dot file:

related: #688 .
There are some unfinished things that need to be finalised by Boshen.
1. Official icon and description for the package.
2. Publishing strategy ( It's probably not a good idea to use
`package.json` as a probe to publish extension, as there's too much
vscode configuration coupled to it, a git tag like `vscode_v0.0.x` might
be worth considering ).
3. License for the extension.