From afd59cf6b5ff4e713c1d478ab8e8344aded1e314 Mon Sep 17 00:00:00 2001 From: Marek Vospel <73162071+marekvospel@users.noreply.github.com> Date: Sat, 8 Feb 2025 19:10:54 +0100 Subject: feat(oxc): OxcFixAll command #3604 --- lua/lspconfig/configs/oxlint.lua | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'lua') diff --git a/lua/lspconfig/configs/oxlint.lua b/lua/lspconfig/configs/oxlint.lua index 4bfbd9fd..c82985f6 100644 --- a/lua/lspconfig/configs/oxlint.lua +++ b/lua/lspconfig/configs/oxlint.lua @@ -15,6 +15,27 @@ return { }, root_dir = util.root_pattern('.oxlintrc.json'), single_file_support = false, + + commands = { + OxcFixAll = { + function() + local client = vim.lsp.get_clients({ bufnr = 0, name = 'oxlint' })[1] + if client == nil then + return + end + + client.request('workspace/executeCommand', { + command = 'oxc.fixAll', + arguments = { + { + uri = vim.uri_from_bufnr(0), + }, + }, + }, nil, 0) + end, + description = 'Apply fixes to current buffer using oxlint (--fix)', + }, + }, }, docs = { description = [[ -- cgit v1.2.3-70-g09d2