Skip to content

feat: support default option for bindCLIShortcuts#15819

Open
Plumbiu wants to merge 1 commit intovitejs:mainfrom
Plumbiu:shortcuts
Open

feat: support default option for bindCLIShortcuts#15819
Plumbiu wants to merge 1 commit intovitejs:mainfrom
Plumbiu:shortcuts

Conversation

@Plumbiu
Copy link
Copy Markdown
Contributor

@Plumbiu Plumbiu commented Feb 6, 2024

Description

fix #15781

we can now add default: false to disable default shortcuts.

configureServer(server) {
  devServer = server

  devServer.bindCLIShortcuts({
    print: true,
    defalut: false, // disable default shortcuts
    customShortcuts: [{
      key: 'p',
      description: 'xxxx',
      action(server) {
        console.log('test')
      }
    }]
  })
}

Additional context

Also fixed double binding issue.


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines, especially the Pull Request Guidelines.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Update the corresponding documentation if needed.
  • Ideally, include relevant tests that fail without this PR but pass with it.

@bolt-new-by-stackblitz
Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@patak-cat
Copy link
Copy Markdown
Member

Would you split this PR in two? One for the fix for #15781 and the other one for the new default: false option. Let's fix the issue first, and we can discuss about the other option and bring that to a team meeting.

@Plumbiu
Copy link
Copy Markdown
Contributor Author

Plumbiu commented Feb 12, 2024

Would you split this PR in two? One for the fix for #15781 and the other one for the new default: false option. Let's fix the issue first, and we can discuss about the other option and bring that to a team meeting.

Spliting this PR in two is more reasonable.

I found that if readline is only created once, readline monitoring will be lost after HMR. The PR has fixed this problem. I will wait for that PR to be merged before modifying this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bindCLIShortcuts need a new option to disable default shortcuts

2 participants