diff options
| author | William Boman <william@redwill.se> | 2022-09-22 14:01:21 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-22 12:01:21 +0000 |
| commit | 4a5aaf7d4cf91b595b8defc0f3ed9b5c995755ad (patch) | |
| tree | 35b0516c493d899f52c9c3fec25d2b92a750df0d | |
| parent | chore: update generated code (#457) (diff) | |
| download | mason-4a5aaf7d4cf91b595b8defc0f3ed9b5c995755ad.tar mason-4a5aaf7d4cf91b595b8defc0f3ed9b5c995755ad.tar.gz mason-4a5aaf7d4cf91b595b8defc0f3ed9b5c995755ad.tar.bz2 mason-4a5aaf7d4cf91b595b8defc0f3ed9b5c995755ad.tar.lz mason-4a5aaf7d4cf91b595b8defc0f3ed9b5c995755ad.tar.xz mason-4a5aaf7d4cf91b595b8defc0f3ed9b5c995755ad.tar.zst mason-4a5aaf7d4cf91b595b8defc0f3ed9b5c995755ad.zip | |
chore: upgrade stylua to 0.15.0 (#454)
| -rw-r--r-- | .github/workflows/stylua.yml | 4 | ||||
| -rw-r--r-- | lua/mason-core/managers/powershell/init.lua | 38 | ||||
| -rw-r--r-- | tests/mason-core/EventEmitter_spec.lua | 25 |
3 files changed, 24 insertions, 43 deletions
diff --git a/.github/workflows/stylua.yml b/.github/workflows/stylua.yml index abdcfd35..89ce5ede 100644 --- a/.github/workflows/stylua.yml +++ b/.github/workflows/stylua.yml @@ -12,10 +12,10 @@ jobs: steps: - uses: actions/checkout@v2 - name: Run Stylua check - uses: JohnnyMorganz/stylua-action@1.0.0 + uses: JohnnyMorganz/stylua-action@v1.1.1 with: # token is needed because the action allegedly downloads binary from github releases token: ${{ secrets.GITHUB_TOKEN }} # CLI arguments args: --check . - version: 0.14.3 + version: 0.15.0 diff --git a/lua/mason-core/managers/powershell/init.lua b/lua/mason-core/managers/powershell/init.lua index c0d36f2e..5cc5e21d 100644 --- a/lua/mason-core/managers/powershell/init.lua +++ b/lua/mason-core/managers/powershell/init.lua @@ -15,19 +15,17 @@ function M.script(script, opts, custom_spawn) opts = opts or {} ---@type JobSpawn local spawner = custom_spawn or spawn - return spawner.powershell( - vim.tbl_extend("keep", { - "-NoProfile", - on_spawn = function(_, stdio) - local stdin = stdio[1] - stdin:write(PWSHOPT.progress_preference) - stdin:write(PWSHOPT.security_protocol) - stdin:write(script) - stdin:close() - end, - env_raw = process.graft_env(opts.env or {}, { "PSMODULEPATH" }), - }, opts) --[[@as JobSpawnOpts]] - ) + return spawner.powershell(vim.tbl_extend("keep", { + "-NoProfile", + on_spawn = function(_, stdio) + local stdin = stdio[1] + stdin:write(PWSHOPT.progress_preference) + stdin:write(PWSHOPT.security_protocol) + stdin:write(script) + stdin:close() + end, + env_raw = process.graft_env(opts.env or {}, { "PSMODULEPATH" }), + }, opts) --[[@as JobSpawnOpts]]) end ---@param command string @@ -37,14 +35,12 @@ function M.command(command, opts, custom_spawn) opts = opts or {} ---@type JobSpawn local spawner = custom_spawn or spawn - return spawner.powershell( - vim.tbl_extend("keep", { - "-NoProfile", - "-Command", - PWSHOPT.progress_preference .. PWSHOPT.security_protocol .. command, - env_raw = process.graft_env(opts.env or {}, { "PSMODULEPATH" }), - }, opts) --[[@as JobSpawnOpts]] - ) + return spawner.powershell(vim.tbl_extend("keep", { + "-NoProfile", + "-Command", + PWSHOPT.progress_preference .. PWSHOPT.security_protocol .. command, + env_raw = process.graft_env(opts.env or {}, { "PSMODULEPATH" }), + }, opts) --[[@as JobSpawnOpts]]) end return M diff --git a/tests/mason-core/EventEmitter_spec.lua b/tests/mason-core/EventEmitter_spec.lua index 4b9e3a6e..c7eb5745 100644 --- a/tests/mason-core/EventEmitter_spec.lua +++ b/tests/mason-core/EventEmitter_spec.lua @@ -8,10 +8,7 @@ describe("EventEmitter", function() it("should call registered event handlers", function() local emitter = EventEmitter.init(setmetatable({}, { __index = EventEmitter })) local my_event_handler = spy.new() - emitter:on( - "my:event", - my_event_handler --[[@as fun()]] - ) + emitter:on("my:event", my_event_handler --[[@as fun()]]) emitter:emit("my:event", { table = "value" }) emitter:emit("my:event", 1337, 42) @@ -24,10 +21,7 @@ describe("EventEmitter", function() it("should call registered event handlers only once", function() local emitter = EventEmitter.init(setmetatable({}, { __index = EventEmitter })) local my_event_handler = spy.new() - emitter:once( - "my:event", - my_event_handler --[[@as fun()]] - ) + emitter:once("my:event", my_event_handler --[[@as fun()]]) emitter:emit("my:event", { table = "value" }) emitter:emit("my:event", 1337, 42) @@ -39,19 +33,10 @@ describe("EventEmitter", function() it("should remove registered event handlers", function() local emitter = EventEmitter.init(setmetatable({}, { __index = EventEmitter })) local my_event_handler = spy.new() - emitter:on( - "my:event", - my_event_handler --[[@as fun()]] - ) - emitter:once( - "my:event", - my_event_handler --[[@as fun()]] - ) + emitter:on("my:event", my_event_handler --[[@as fun()]]) + emitter:once("my:event", my_event_handler --[[@as fun()]]) - emitter:off( - "my:event", - my_event_handler --[[@as fun()]] - ) + emitter:off("my:event", my_event_handler --[[@as fun()]]) emitter:emit("my:event", { table = "value" }) assert.spy(my_event_handler).was_called(0) |
