Commit Graph

8 Commits

Author SHA1 Message Date
leaysgur 47fb154918 test(oxfmt): Add tests and conformance (#21832) 2026-05-11 01:24:38 +00:00
Sysix c1b461b877 fix(oxfmt/lsp): revert #19977, prefer file extension over languageId for format strategy (#20623)
closes https://github.com/oxc-project/oxc-vscode/issues/140
Preferring the languageID over the real file extension creates inconsistency between the editor and the CLI.
Reverting the changes from #19977 back to align back with CLI.

This only effects `file://` scheme, where we can expect a real file on a disk. Other schemes are still preferring the languageID, because we do not to what exactly they are relating to.
2026-03-23 00:45:32 +00:00
leaysgur 89ce30b641 fix(oxlint,oxfmt): Redirect JS stdout to stderr for LSP (#20321)
Fixes #20320

(It's fine to release this as scheduled one)
2026-03-16 10:15:23 +00:00
leaysgur 95943aa6f2 feat(oxfmt): Support vite.config.* .fmt field (#20197)
NOTE: I'll do a self-review and add the test tomorrow.

<details>
<summary>Prompt</summary>

```
# Support `vite.config.*` as a Configuration File

## Target Files

- `vite.config.ts`
- `vite.config.mts`
- `vite.config.cts`
- `vite.config.js`
- `vite.config.mjs`
- `vite.config.cjs`

## Auto-Discovery Priority

When searching for a config file from `cwd` upwards, the following priority applies within the same directory:

1. Tool-specific JSON/JSONC config files (e.g. `.oxfmtrc.json`, `.oxlintrc.json`)
2. Tool-specific JS/TS config files (e.g. `oxfmt.config.ts`, `oxlint.config.ts`)
3. `vite.config.*`

## Extracting Configuration

The default export of `vite.config.*` is expected to contain tool-specific configuration under a dedicated field:

- oxfmt: `.fmt`
- oxlint: `.lint`

If the field does not exist, an error is returned (e.g. `Expected a 'fmt' field in the default export.`).

## Explicit `--config` Flag

When `--config vite.config.ts` is explicitly specified, the same behavior applies. The file name is used to determine whether to extract a nested field.

## LSP

`vite.config.*` files are added to the file watch patterns so that configuration changes trigger a reload.
```

</details>
2026-03-11 04:34:48 +00:00
leaysgur 172fc072f3 feat(oxfmt): .js/.ts config file support (#20135)
Fixes #19711, also resolves some of the demands for nested configs.
2026-03-11 04:34:48 +00:00
copilot-swe-agent 114f974d25 fix(oxfmt/lsp): prefer language_id over file extension when formatting (#19977)
- [x] Explore the codebase (apps/oxfmt/src/lsp/, test/lsp/format/)
- [x] Make `get_file_extension_from_language_id` accessible (pub(super)) in `mod.rs`
- [x] Modify `format_file` in `server_formatter.rs` to prefer `language_id` over file extension
- [x] Update `run_format` to pass `language_id` to `format_file`
- [x] Create test fixture `apps/oxfmt/test/lsp/format/fixtures/format/test.ts.txt`
- [x] Add test case in `format.test.ts` for `.txt` file with TypeScript `language_id`
- [x] Update snapshot
- [x] Refactor: extract `apply_language_id_extension` helper shared by both `create_fake_file_path_from_language_id` and `format_file`

<!-- START COPILOT CODING AGENT TIPS -->
---

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. [Learn more about Advanced Security.](https://gh.io/cca-advanced-security)
2026-03-04 00:25:24 +00:00
Alexander S. 87cb667e82 test(oxfmt/lsp): add nested workspace folders test (#19507)
Added test coverage for a bug a possible
https://github.com/oxc-project/oxc-vscode/issues/66
From the snapshots, I could not detect something wrong. Still worth to
include it
2026-02-20 09:57:25 +09:00
leaysgur 1a02f6ee8c test(oxfmt): Arrange test files and directries (#17822)
Sorry for the large diff! 🙇🏻

But it's mostly just file relocations (and path updates).
Details on the changes are also documented in [`AGENTS.md`](https://github.com/oxc-project/oxc/pull/17822/changes#diff-b9a8ddc83e0b93133df7274e37b5fcdaec808090721eec2194782fe968819e69), so please refer to that file.

TL;DR: I wanted to colocate test cases and fixtures in the same directory.
2026-01-09 15:11:35 +00:00