Skip to content

Commit

Permalink
fix(commands): connects showCommandPalette
Browse files Browse the repository at this point in the history
  • Loading branch information
unional committed Oct 27, 2022
1 parent edca7c1 commit adebc08
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .changeset/swift-queens-rescue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@just-web/commands": patch
---

Connects `showCommandPalate` instead of the `just` variant
4 changes: 2 additions & 2 deletions plugins/commands/ts/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import keyboardPlugin from '@just-web/keyboard'
import { logTestPlugin } from '@just-web/log'
import { logEqual } from '@just-web/testing'
import commandsPlugin, { justShowCommandPalette } from '.'
import { AssertOrder } from 'assertron'
import { justValue } from 'just-func'
import commandsPlugin, { showCommandPalette } from '.'

describe('plugin.init()', () => {
test('basic case', () => {
Expand Down Expand Up @@ -41,7 +41,7 @@ describe('plugin.init()', () => {
const [{ commands }] = commandsPlugin().init({ log, keyboard })
const o = new AssertOrder(1)

justShowCommandPalette.connect([{ commands, keyboard }, () => (o.once(1), justValue())])
showCommandPalette.connect({ commands, keyboard }, () => (o.once(1), justValue()))

commands.showCommandPalette()
o.end()
Expand Down
11 changes: 4 additions & 7 deletions plugins/commands/ts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ import type { CommandContribution, CommandsContext } from './types'

export * from './command'
export * from './formatCommand'
export type {
JustCommand as Command, CommandContribution, CommandHandler, CommandsContext, JustCommand_WithDefault as Command_WithDefault,
ContributionRegistry, HandlerRegistry
} from './types'
export type { CommandContribution, CommandHandler, CommandsContext, ContributionRegistry, HandlerRegistry, JustCommand as Command, JustCommand_WithDefault as Command_WithDefault } from './types'

export const showCommandPalette = command({
id: 'just-web.showCommandPalette',
Expand Down Expand Up @@ -41,14 +38,14 @@ const plugin = definePlugin((options?: CommandsOptions) => ({
const contributions = contributionRegistry(ctx, options?.commands?.contributions)
const handlers = handlerRegistry(ctx, options?.commands?.handlers)

contributions.add(justShowCommandPalette)
ctx.keyboard.keyBindingContributions.add(justShowCommandPalette)
contributions.add(showCommandPalette)
ctx.keyboard.keyBindingContributions.add(showCommandPalette)

return [{
commands: {
contributions,
handlers,
showCommandPalette: justShowCommandPalette
showCommandPalette
}
}]
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/commands/ts/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export type CommandsContext = {
commands: {
contributions: ContributionRegistry,
handlers: HandlerRegistry,
showCommandPalette(): any
showCommandPalette(): void
}
}

Expand Down

0 comments on commit adebc08

Please sign in to comment.