Skip to content

fix(language_server): treat empty string config path as None in language server#17415

Merged
graphite-app[bot] merged 1 commit intomainfrom
copilot/fix-oxlintrc-initialization
Dec 28, 2025
Merged

fix(language_server): treat empty string config path as None in language server#17415
graphite-app[bot] merged 1 commit intomainfrom
copilot/fix-oxlintrc-initialization

Conversation

Copy link
Contributor

Copilot AI commented Dec 28, 2025

VS Code's settings UI auto-generates "oxc.configPath": "" when users click the setting field, causing the language server to fail initializing oxlintrc config instead of falling back to .oxlintrc.json.

Changes

  • Config path initialization: Match Some("") alongside None to use default config file
  • Watcher patterns: Apply same logic when determining file watchers
// Before
let config_path = options.config_path.as_ref().map_or(LINT_CONFIG_FILE, |v| v);

// After  
let config_path = match options.config_path.as_deref() {
    Some("") | None => LINT_CONFIG_FILE,
    Some(v) => v,
};

Applied at both config initialization and watcher pattern registration to ensure consistent behavior.

Original prompt

This section details on the original issue you should resolve

<issue_title>linter: [vscode] Failed to initialize oxlintrc config</issue_title>
<issue_description>### What version of Oxlint are you using?

1.35.0

What command did you run?

save changes

What does your .oxlintrc.json config file look like?

{
  "plugins": ["typescript", "unicorn", "oxc", "react"],
  "rules": {
    "no-unused-vars": "off",
    "no-unused-expressions": "off",
    "react/jsx-no-undef": "off",
    "react/jsx-no-target-blank": "off",
    "react/exhaustive-deps": "off",
    "react/rules-of-hooks": "error"
  }
}

What happened?

in vscode with settings.json oxc.configPath set to empty string

{
  "oxc.configPath": ""
}

will cause WARN oxc_language_server::linter::server_linter] Failed to initialize oxlintrc config
hence oxc config not recognized.

I looked into the code and found
https://github.com/oxc-project/oxc/blob/oxlint_v1.35.0/crates/oxc_language_server/src/linter/server_linter.rs#L58

empty string is used and not fallback to default .oxlintrc.json, so resulting Failed to initialize oxlintrc config error

but I was not meant to config oxc.configPath to an empty string, it's auto generated by a click on vscode settings UI
Image

Code

https://github.com/oxc-project/oxc/blob/oxlint_v1.35.0/crates/oxc_language_server/src/linter/server_linter.rs#L58

I confirmed the behavior with ChatGPT.
Image

empty string should use default fallback too:

let config_path = match options.config_path.as_deref() {
    Some("") | None => LINT_CONFIG_FILE,
    Some(v) => v,
};

</issue_description>

<agent_instructions>match on Some("") | None in the language server</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Fix issue with oxlintrc configuration initialization linter: treat empty string config path as None in language server Dec 28, 2025
Copilot AI requested a review from camc314 December 28, 2025 13:43
@camc314 camc314 changed the title linter: treat empty string config path as None in language server fix(language_server): treat empty string config path as None in language server Dec 28, 2025
@github-actions github-actions bot added A-editor Area - Editor and Language Server C-bug Category - Bug labels Dec 28, 2025
@camc314 camc314 marked this pull request as ready for review December 28, 2025 13:55
@camc314 camc314 requested a review from Sysix as a code owner December 28, 2025 13:55
Copilot AI review requested due to automatic review settings December 28, 2025 13:55
@camc314 camc314 force-pushed the copilot/fix-oxlintrc-initialization branch from 37dc782 to 5d77b23 Compare December 28, 2025 13:56
@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Dec 28, 2025
Copy link
Contributor

camc314 commented Dec 28, 2025

Merge activity

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes an issue where VS Code's settings UI auto-generates an empty string for oxc.configPath when users click on the setting field, causing the language server to fail loading the default .oxlintrc.json config file.

Key changes:

  • Modified config path initialization to treat empty strings the same as None, falling back to the default .oxlintrc.json file
  • Applied the same logic to file watcher pattern generation for consistency
  • Added test coverage to verify empty string config paths behave identically to undefined config paths

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…age server (#17415)

VS Code's settings UI auto-generates `"oxc.configPath": ""` when users click the setting field, causing the language server to fail initializing oxlintrc config instead of falling back to `.oxlintrc.json`.

## Changes

- **Config path initialization**: Match `Some("")` alongside `None` to use default config file
- **Watcher patterns**: Apply same logic when determining file watchers

```rust
// Before
let config_path = options.config_path.as_ref().map_or(LINT_CONFIG_FILE, |v| v);

// After
let config_path = match options.config_path.as_deref() {
    Some("") | None => LINT_CONFIG_FILE,
    Some(v) => v,
};
```

Applied at both config initialization and watcher pattern registration to ensure consistent behavior.

<!-- START COPILOT ORIGINAL PROMPT -->

<details>

<summary>Original prompt</summary>

>
> ----
>
> *This section details on the original issue you should resolve*
>
> <issue_title>linter: [vscode] Failed to initialize oxlintrc config</issue_title>
> <issue_description>### What version of Oxlint are you using?
>
> 1.35.0
>
> ### What command did you run?
>
> save changes
>
> ### What does your `.oxlintrc.json` config file look like?
>
> ```jsonc
> {
>   "plugins": ["typescript", "unicorn", "oxc", "react"],
>   "rules": {
>     "no-unused-vars": "off",
>     "no-unused-expressions": "off",
>     "react/jsx-no-undef": "off",
>     "react/jsx-no-target-blank": "off",
>     "react/exhaustive-deps": "off",
>     "react/rules-of-hooks": "error"
>   }
> }
> ```
>
>
> ### What happened?
>
> in vscode with settings.json `oxc.configPath` set to empty string
> ```json
> {
>   "oxc.configPath": ""
> }
> ```
>
> will cause `WARN  oxc_language_server::linter::server_linter] Failed to initialize oxlintrc config`
> hence oxc config not recognized.
>
> I looked into the code and found
> https://github.com/oxc-project/oxc/blob/oxlint_v1.35.0/crates/oxc_language_server/src/linter/server_linter.rs#L58
>
> empty string is used and not fallback to default `.oxlintrc.json`, so resulting `Failed to initialize oxlintrc config` error
>
> but I was not meant to config `oxc.configPath` to an empty string, it's auto generated by a click on vscode  settings UI
> ![Image](https://github.com/user-attachments/assets/3ac7eed6-787c-4d3a-b335-a5a06f493e74)
>
>
> ## Code
>
> https://github.com/oxc-project/oxc/blob/oxlint_v1.35.0/crates/oxc_language_server/src/linter/server_linter.rs#L58
>
> I confirmed the behavior with ChatGPT.
> <img width="1101" height="1211" alt="Image" src="https://github.com/user-attachments/assets/a8bd6b1e-5d96-4040-b258-15a91679959b" />
>
> empty string should use default fallback too:
> ```rust
> let config_path = match options.config_path.as_deref() {
>     Some("") | None => LINT_CONFIG_FILE,
>     Some(v) => v,
> };
> ```
>
> </issue_description>
>
> <agent_instructions>match on Some("") | None in the language server</agent_instructions>
>
> ## Comments on the Issue (you are @copilot in this section)
>
> <comments>
> </comments>
>

</details>

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

- Fixes #17384

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

✨ Let Copilot coding agent [set things up for you](https://github.com/oxc-project/oxc/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo.
@graphite-app graphite-app bot force-pushed the copilot/fix-oxlintrc-initialization branch from 5d77b23 to 97aef58 Compare December 28, 2025 14:13
@graphite-app graphite-app bot merged commit 97aef58 into main Dec 28, 2025
21 checks passed
@graphite-app graphite-app bot deleted the copilot/fix-oxlintrc-initialization branch December 28, 2025 14:18
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Dec 28, 2025
graphite-app bot pushed a commit that referenced this pull request Dec 28, 2025
> This PR fixes the handling of empty string values in the fmt.configPath setting for the formatter service, mirroring the fix made for the linter in PR #17415. When VS Code's settings UI auto-generates "fmt.configPath": "", the formatter now treats this as if no config path was specified and falls back to searching for default config files (.oxfmtrc.json and .oxfmtrc.jsonc) instead of failing to initialize.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-editor Area - Editor and Language Server C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

linter: [vscode] Failed to initialize oxlintrc config

3 participants