Replies: 3 comments 6 replies
-
Beta Was this translation helpful? Give feedback.
-
|
It should work 🤞 , we have a test for it: oxc/editors/vscode/tests/code_actions.spec.ts Lines 85 to 112 in 8c85e08 |
Beta Was this translation helpful? Give feedback.
-
|
Ok thank you, I'm sorry for the confusion I should have emphasized on the fact that my question was specifically about the LS and not about the VSCode extension. I'm using Neovim native LSP client. I now understand that the LS provides a fixAll comand that is to be used by the editor, not a formatting capability in the LSP sense. So I could replicate the VSCode extension feature using a simple autocmd : vim.api.nvim_create_autocmd("BufWritePre", {
desc = "Format before save",
pattern = "*",
group = vim.api.nvim_create_augroup("FormatConfig", { clear = true }),
callback = function(ev)
local client = vim.lsp.get_clients({ name = "oxlint", bufnr = ev.buf })[1]
if not client then
return
end
local request_result = client:request_sync("workspace/executeCommand", {
command = "oxc.fixAll",
arguments = {
{
uri = vim.uri_from_bufnr(ev.buf),
},
},
})
if request_result and request_result.err then
vim.notify(request_result.err.message, vim.log.levels.ERROR)
return
end
end,
})
So now it works as expected, only issue I get now is how can I change the LS settings? vim.lsp.config("oxlint", {
cmd = { "oxc_language_server" },
cmd_env = {
RUST_LOG = "debug",
},
settings = {
initializationOptions = {
{
workspaceUri = "file://home/francois/Projects/Personal/project",
options = {
["fmt.experimental"] = true,
},
},
},
},
})I'm not understand why it complains, in the VSCode Oxc channel the settings are passed with the same format : Any idea of the format expected? |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone,
I’m in the process of migrating from ESLint to Oxlint, but I’ve hit one missing feature.
Oxlint supports autofixes with the --fix flag, but the LSP doesn’t seem to provide any formatting capabilities, even though the source.fixAll.oxc command is available.
Did I miss something, or is this a feature that could be added to the LSP?
Beta Was this translation helpful? Give feedback.
All reactions