fix(language_server): treat empty string config path as None in language server#17415
Merged
graphite-app[bot] merged 1 commit intomainfrom Dec 28, 2025
Merged
Conversation
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
camc314
approved these changes
Dec 28, 2025
camc314
approved these changes
Dec 28, 2025
37dc782 to
5d77b23
Compare
Contributor
Merge activity
|
Contributor
There was a problem hiding this comment.
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.jsonfile - 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 >  > > > ## 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.
5d77b23 to
97aef58
Compare
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Some("")alongsideNoneto use default config fileApplied at both config initialization and watcher pattern registration to ensure consistent behavior.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.