Skip to content

oxfmt LSP receives fmt.configPath but never reads the config file — formats with defaults #222

Description

@Relequestual

Confirm that this is a Bug for the editor extension, not the CLI

  • This bug does not happen in the Oxlint/Oxfmt CLI
  • After restarting the editor, the bug still appears

Versions used

VS Code extension: v1.52.0
oxlint: (not relevant — this is an oxfmt issue)
oxfmt: v0.36.0
VS Code version: 1.116.0 (arm64)
Operating System and Version: macOS 26.4 (Apple Silicon)
Node Version: v22.18.0 (project-local via Volta)
Node Manager: Volta

What happened?

The oxfmt formatter in the VS Code extension ignores the .oxfmtrc.jsonc config file and formats with default options (double quotes, semicolons), even though the config specifies singleQuote: true and semi: false.

The CLI correctly reads the config and formats as expected. The extension sends the fmt.configPath setting to the LSP (confirmed via extension source inspection), but the LSP never opens the config file (confirmed via oxc.trace.server: verbose — the config file never appears in the trace log).

Tested in both:

  • Multi-root .code-workspace (two folder entries)
  • Single folder open (opening just the project folder directly)

Both exhibit the same behavior — the LSP ignores the config.

Troubleshooting attempted:

  • Relative path (.oxfmtrc.jsonc) — ignored
  • Absolute path — ignored
  • ${workspaceFolder}/.oxfmtrc.jsonc — ignored
  • Renamed to .oxfmtrc.json (non-JSONC) — still ignored
  • Removed oxc.fmt.configPath entirely to rely on auto-discovery — still defaults
  • Reloaded window multiple times
  • Confirmed the extension is running and formatting (it does format, just with defaults)

CLI works correctly from the same directory:

cd project-a
npx oxfmt --check src/example.test.ts   # detects issues (exit 1)
npx oxfmt --write src/example.test.ts   # correctly applies single quotes, removes semicolons
echo 'import { foo } from "bar"' | npx oxfmt --stdin-filepath test.ts
# outputs: import { foo } from 'bar'

Reproduction repo

https://github.com/Relequestual/oxfmt-config-repro

Steps:

  1. Clone and run cd project-a && npm install
  2. Open repro.code-workspace in VS Code (or open project-a/ as a standalone folder)
  3. Open project-a/src/example.test.ts
  4. Format the file (Shift+Alt+F)
  5. Observe: double quotes and semicolons remain (defaults), instead of single quotes and no semicolons (config)

Output channel log

Click to expand
2026-04-20 15:57:24.190 [info] [Trace - 15:57:24] Sending request 'shutdown - (2)'.
2026-04-20 15:57:24.190 [info] 2026-04-20T14:57:24.190504Z  INFO tokio-runtime-worker tower_lsp_server::service::layers: shutdown request received, shutting down

2026-04-20 15:57:24.190 [info] [Trace - 15:57:24] Received response 'shutdown - (2)' in 0ms.
2026-04-20 15:57:24.190 [info] No result returned.


2026-04-20 15:57:24.190 [info] [Trace - 15:57:24] Sending notification 'exit'.
2026-04-20 15:57:24.190 [info] No parameters provided.


2026-04-20 15:57:24.191 [info] 2026-04-20T14:57:24.191070Z  INFO tokio-runtime-worker tower_lsp_server::service::layers: exit notification received, stopping

2026-04-20 15:57:24.196 [info] Using server binary at: /Users/relequestual/projects/oxfmt-repro/project-a/node_modules/.bin/oxfmt
2026-04-20 15:57:24.200 [info] [Trace - 15:57:24] Sending request 'initialize - (0)'.
2026-04-20 15:57:24.201 [info] Params: {
    "processId": 99278,
    "clientInfo": {
        "name": "Visual Studio Code",
        "version": "1.116.0"
    },
    "locale": "en",
    "rootPath": "/Users/relequestual/projects/oxfmt-repro",
    "rootUri": "file:///Users/relequestual/projects/oxfmt-repro",
    "capabilities": {
        "workspace": {
            "applyEdit": true,
            "workspaceEdit": {
                "documentChanges": true,
                "resourceOperations": [
                    "create",
                    "rename",
                    "delete"
                ],
                "failureHandling": "textOnlyTransactional",
                "normalizesLineEndings": true,
                "changeAnnotationSupport": {
                    "groupsOnLabel": true
                }
            },
            "configuration": true,
            "didChangeWatchedFiles": {
                "dynamicRegistration": true,
                "relativePatternSupport": true
            },
            "symbol": {
                "dynamicRegistration": true,
                "symbolKind": {
                    "valueSet": [
                        1,
                        2,
                        3,
                        4,
                        5,
                        6,
                        7,
                        8,
                        9,
                        10,
                        11,
                        12,
                        13,
                        14,
                        15,
                        16,
                        17,
                        18,
                        19,
                        20,
                        21,
                        22,
                        23,
                        24,
                        25,
                        26
                    ]
                },
                "tagSupport": {
                    "valueSet": [
                        1
                    ]
                },
                "resolveSupport": {
                    "properties": [
                        "location.range"
                    ]
                }
            },
            "codeLens": {
                "refreshSupport": true
            },
            "executeCommand": {
                "dynamicRegistration": true
            },
            "didChangeConfiguration": {
                "dynamicRegistration": true
            },
            "workspaceFolders": true,
            "foldingRange": {
                "refreshSupport": true
            },
            "semanticTokens": {
                "refreshSupport": true
            },
            "fileOperations": {
                "dynamicRegistration": true,
                "didCreate": true,
                "didRename": true,
                "didDelete": true,
                "willCreate": true,
                "willRename": true,
                "willDelete": true
            },
            "inlineValue": {
                "refreshSupport": true
            },
            "inlayHint": {
                "refreshSupport": true
            },
            "diagnostics": {
                "refreshSupport": true
            }
        },
        "textDocument": {
            "publishDiagnostics": {
                "relatedInformation": true,
                "versionSupport": false,
                "tagSupport": {
                    "valueSet": [
                        1,
                        2
                    ]
                },
                "codeDescriptionSupport": true,
                "dataSupport": true
            },
            "synchronization": {
                "dynamicRegistration": true,
                "willSave": true,
                "willSaveWaitUntil": true,
                "didSave": true
            },
            "completion": {
                "dynamicRegistration": true,
                "contextSupport": true,
                "completionItem": {
                    "snippetSupport": true,
                    "commitCharactersSupport": true,
                    "documentationFormat": [
                        "markdown",
                        "plaintext"
                    ],
                    "deprecatedSupport": true,
                    "preselectSupport": true,
                    "tagSupport": {
                        "valueSet": [
                            1
                        ]
                    },
                    "insertReplaceSupport": true,
                    "resolveSupport": {
                        "properties": [
                            "documentation",
                            "detail",
                            "additionalTextEdits"
                        ]
                    },
                    "insertTextModeSupport": {
                        "valueSet": [
                            1,
                            2
                        ]
                    },
                    "labelDetailsSupport": true
                },
                "insertTextMode": 2,
                "completionItemKind": {
                    "valueSet": [
                        1,
                        2,
                        3,
                        4,
                        5,
                        6,
                        7,
                        8,
                        9,
                        10,
                        11,
                        12,
                        13,
                        14,
                        15,
                        16,
                        17,
                        18,
                        19,
                        20,
                        21,
                        22,
                        23,
                        24,
                        25
                    ]
                },
                "completionList": {
                    "itemDefaults": [
                        "commitCharacters",
                        "editRange",
                        "insertTextFormat",
                        "insertTextMode",
                        "data"
                    ]
                }
            },
            "hover": {
                "dynamicRegistration": true,
                "contentFormat": [
                    "markdown",
                    "plaintext"
                ]
            },
            "signatureHelp": {
                "dynamicRegistration": true,
                "signatureInformation": {
                    "documentationFormat": [
                        "markdown",
                        "plaintext"
                    ],
                    "parameterInformation": {
                        "labelOffsetSupport": true
                    },
                    "activeParameterSupport": true
                },
                "contextSupport": true
            },
            "definition": {
                "dynamicRegistration": true,
                "linkSupport": true
            },
            "references": {
                "dynamicRegistration": true
            },
            "documentHighlight": {
                "dynamicRegistration": true
            },
            "documentSymbol": {
                "dynamicRegistration": true,
                "symbolKind": {
                    "valueSet": [
                        1,
                        2,
                        3,
                        4,
                        5,
                        6,
                        7,
                        8,
                        9,
                        10,
                        11,
                        12,
                        13,
                        14,
                        15,
                        16,
                        17,
                        18,
                        19,
                        20,
                        21,
                        22,
                        23,
                        24,
                        25,
                        26
                    ]
                },
                "hierarchicalDocumentSymbolSupport": true,
                "tagSupport": {
                    "valueSet": [
                        1
                    ]
                },
                "labelSupport": true
            },
            "codeAction": {
                "dynamicRegistration": true,
                "isPreferredSupport": true,
                "disabledSupport": true,
                "dataSupport": true,
                "resolveSupport": {
                    "properties": [
                        "edit"
                    ]
                },
                "codeActionLiteralSupport": {
                    "codeActionKind": {
                        "valueSet": [
                            "",
                            "quickfix",
                            "refactor",
                            "refactor.extract",
                            "refactor.inline",
                            "refactor.rewrite",
                            "source",
                            "source.organizeImports"
                        ]
                    }
                },
                "honorsChangeAnnotations": true
            },
            "codeLens": {
                "dynamicRegistration": true
            },
            "formatting": {
                "dynamicRegistration": true
            },
            "rangeFormatting": {
                "dynamicRegistration": true,
                "rangesSupport": true
            },
            "onTypeFormatting": {
                "dynamicRegistration": true
            },
            "rename": {
                "dynamicRegistration": true,
                "prepareSupport": true,
                "prepareSupportDefaultBehavior": 1,
                "honorsChangeAnnotations": true
            },
            "documentLink": {
                "dynamicRegistration": true,
                "tooltipSupport": true
            },
            "typeDefinition": {
                "dynamicRegistration": true,
                "linkSupport": true
            },
            "implementation": {
                "dynamicRegistration": true,
                "linkSupport": true
            },
            "colorProvider": {
                "dynamicRegistration": true
            },
            "foldingRange": {
                "dynamicRegistration": true,
                "rangeLimit": 5000,
                "lineFoldingOnly": true,
                "foldingRangeKind": {
                    "valueSet": [
                        "comment",
                        "imports",
                        "region"
                    ]
                },
                "foldingRange": {
                    "collapsedText": false
                }
            },
            "declaration": {
                "dynamicRegistration": true,
                "linkSupport": true
            },
            "selectionRange": {
                "dynamicRegistration": true
            },
            "callHierarchy": {
                "dynamicRegistration": true
            },
            "semanticTokens": {
                "dynamicRegistration": true,
                "tokenTypes": [
                    "namespace",
                    "type",
                    "class",
                    "enum",
                    "interface",
                    "struct",
                    "typeParameter",
                    "parameter",
                    "variable",
                    "property",
                    "enumMember",
                    "event",
                    "function",
                    "method",
                    "macro",
                    "keyword",
                    "modifier",
                    "comment",
                    "string",
                    "number",
                    "regexp",
                    "operator",
                    "decorator"
                ],
                "tokenModifiers": [
                    "declaration",
                    "definition",
                    "readonly",
                    "static",
                    "deprecated",
                    "abstract",
                    "async",
                    "modification",
                    "documentation",
                    "defaultLibrary"
                ],
                "formats": [
                    "relative"
                ],
                "requests": {
                    "range": true,
                    "full": {
                        "delta": true
                    }
                },
                "multilineTokenSupport": false,
                "overlappingTokenSupport": false,
                "serverCancelSupport": true,
                "augmentsSyntaxTokens": true
            },
            "linkedEditingRange": {
                "dynamicRegistration": true
            },
            "typeHierarchy": {
                "dynamicRegistration": true
            },
            "inlineValue": {
                "dynamicRegistration": true
            },
            "inlayHint": {
                "dynamicRegistration": true,
                "resolveSupport": {
                    "properties": [
                        "tooltip",
                        "textEdits",
                        "label.tooltip",
                        "label.location",
                        "label.command"
                    ]
                }
            },
            "diagnostic": {
                "dynamicRegistration": true,
                "relatedDocumentSupport": false
            }
        },
        "window": {
            "showMessage": {
                "messageActionItem": {
                    "additionalPropertiesSupport": true
                }
            },
            "showDocument": {
                "support": true
            },
            "workDoneProgress": true
        },
        "general": {
            "staleRequestSupport": {
                "cancel": true,
                "retryOnContentModified": [
                    "textDocument/semanticTokens/full",
                    "textDocument/semanticTokens/range",
                    "textDocument/semanticTokens/full/delta"
                ]
            },
            "regularExpressions": {
                "engine": "ECMAScript",
                "version": "ES2020"
            },
            "markdown": {
                "parser": "marked",
                "version": "1.1.0"
            },
            "positionEncodings": [
                "utf-16"
            ]
        },
        "notebookDocument": {
            "synchronization": {
                "dynamicRegistration": true,
                "executionSummarySupport": true
            }
        }
    },
    "initializationOptions": [
        {
            "workspaceUri": "file:///Users/relequestual/projects/oxfmt-repro",
            "options": {
                "fmt.experimental": true
            }
        }
    ],
    "trace": "verbose",
    "workspaceFolders": [
        {
            "uri": "file:///Users/relequestual/projects/oxfmt-repro",
            "name": "oxfmt-repro"
        }
    ]
}


2026-04-20 15:57:24.243 [info] 2026-04-20T14:57:24.243682Z  INFO tokio-runtime-worker oxc_language_server::backend: initialize: Some([WorkspaceOption { workspace_uri: Uri(Uri { scheme: "file", authority: Some(Authority { userinfo: None, host: "", host_parsed: RegName(""), port: None }), path: "/Users/relequestual/projects/oxfmt-repro", query: None, fragment: None }), options: Object {"fmt.experimental": Bool(true)} }])
2026-04-20T14:57:24.243698Z  INFO tokio-runtime-worker oxc_language_server::backend: oxfmt version: 0.36.0

2026-04-20 15:57:24.246 [info] [Trace - 15:57:24] Received response 'initialize - (0)' in 46ms.
2026-04-20 15:57:24.246 [info] Result: {
    "capabilities": {
        "textDocumentSync": {
            "openClose": true,
            "change": 1,
            "save": {
                "includeText": false
            }
        },
        "documentFormattingProvider": true,
        "workspace": {
            "workspaceFolders": {
                "supported": true,
                "changeNotifications": true
            }
        }
    },
    "serverInfo": {
        "name": "oxfmt",
        "version": "0.36.0"
    }
}


2026-04-20 15:57:24.246 [info] [Trace - 15:57:24] Sending notification 'initialized'.
2026-04-20 15:57:24.246 [info] Params: {}


2026-04-20 15:57:24.247 [info] [Trace - 15:57:24] Sending notification 'textDocument/didOpen'.
2026-04-20 15:57:24.247 [info] Params: {
    "textDocument": {
        "uri": "file:///Users/relequestual/projects/oxfmt-repro/project-a/src/example.test.ts",
        "languageId": "typescript",
        "version": 70,
        "text": "import { describe, it, expect } from \"vitest\";\n\ndescribe(\"example\", () => {\n  it(\"should use double quotes by default\", () => {\n    const message = \"hello world\";\n    expect(message).toBe(\"hello world\");\n  });\n});\n"
    }
}


2026-04-20 15:57:24.248 [info] [Trace - 15:57:24] Received request 'client/registerCapability - (0)'.
2026-04-20 15:57:24.248 [info] Params: {
    "registrations": [
        {
            "id": "watcher-formatter-file:///Users/relequestual/projects/oxfmt-repro",
            "method": "workspace/didChangeWatchedFiles",
            "registerOptions": {
                "watchers": [
                    {
                        "globPattern": {
                            "baseUri": "file:///Users/relequestual/projects/oxfmt-repro",
                            "pattern": ".oxfmtrc.json"
                        },
                        "kind": 7
                    },
                    {
                        "globPattern": {
                            "baseUri": "file:///Users/relequestual/projects/oxfmt-repro",
                            "pattern": ".oxfmtrc.jsonc"
                        },
                        "kind": 7
                    },
                    {
                        "globPattern": {
                            "baseUri": "file:///Users/relequestual/projects/oxfmt-repro",
                            "pattern": ".editorconfig"
                        },
                        "kind": 7
                    }
                ]
            }
        }
    ]
}


2026-04-20 15:57:24.248 [info] [Trace - 15:57:24] Sending response 'client/registerCapability - (0)'. Processing request took 1ms
2026-04-20 15:57:24.248 [info] No result returned.


2026-04-20 15:57:24.248 [info] [Error - 15:57:24] Server process exited with code 0.

2026-04-20 15:59:22.978 [info] [Trace - 15:59:22] Sending request 'textDocument/formatting - (1)'.
2026-04-20 15:59:22.978 [info] Params: {
    "textDocument": {
        "uri": "file:///Users/relequestual/projects/oxfmt-repro/project-a/src/example.test.ts"
    },
    "options": {
        "tabSize": 2,
        "insertSpaces": true,
        "trimTrailingWhitespace": true
    }
}


2026-04-20 15:59:22.979 [info] [Trace - 15:59:22] Received response 'textDocument/formatting - (1)' in 1ms.
2026-04-20 15:59:22.979 [info] No result returned.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions