diff --git a/.trunk/.gitignore b/.trunk/.gitignore index 1e24652..15966d0 100644 --- a/.trunk/.gitignore +++ b/.trunk/.gitignore @@ -6,3 +6,4 @@ plugins user_trunk.yaml user.yaml +tmp diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index 00d19c5..880105f 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -1,20 +1,20 @@ version: 0.1 cli: - version: 1.17.2-beta.5 + version: 1.18.2-beta.14 options: - commands: [upgrade] args: -y --no-progress plugins: sources: - id: trunk - ref: v1.2.5 + ref: v1.4.1 uri: https://github.com/trunk-io/plugins - id: configs uri: https://github.com/trunk-io/configs - ref: v0.0.7 + ref: v1.0.1 lint: enabled: - - stylua@0.18.2 + - stylua@0.19.1 ignore: - linters: [ALL] paths: [lsp*] diff --git a/lua/trunk.lua b/lua/trunk.lua index f2b5a37..e607c4c 100644 --- a/lua/trunk.lua +++ b/lua/trunk.lua @@ -256,6 +256,32 @@ local function connect() -- TODO(Tyler): Conditionally add a progress bar pane? end, }, + -- custom callbacks for commands from code actions + commands = { + ["trunk.checkEnable"] = function(command, _client_info, _command_str, _args) + -- TODO(Tyler): Use non-ANSI mode + vim.cmd( + "!" + .. table.concat(executionTrunkPath(), " ") + .. " check enable " + .. table.concat(command["arguments"]) + .. [[ | sed -e 's/\x1b\[[0-9;]*m//g']] + ) + end, + ["trunk.checkDisable"] = function(command, _client_info, _command_str, _args) + -- TODO(Tyler): Use non-ANSI mode + vim.cmd( + "!" + .. table.concat(executionTrunkPath(), " ") + .. " check disable " + .. table.concat(command["arguments"]) + .. [[ | sed -e 's/\x1b\[[0-9;]*m//g']] + ) + end, + ["trunk.openConfigFile"] = function(_command, _client_info, _command_str, _args) + vim.cmd(":edit " .. findConfig()) + end, + }, }) end end