microsoft / microsoft/monaco-editor

Access to `showInputBox`

Open
#627 2 comments 21 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature-request quick-pick
Dominant language
JavaScript
Stars
46.8k
Forks
4.1k
Avg merge
17h 58m
Merged PRs (30d)
1

Description

monaco-editor version: 0.10.0
Browser:Chrome
OS: MacOX
Steps or JS usage snippet reproducing the issue:

I think it would be nice to have access to showInputBox to add additional inputs to Action Commands.

I do see we can able input the line number when open the go to line is selected from the palette. But I could not find a way to add action commands to accept quick inputs to execute the action.

  private editorDidMount(editor, monaco) {
    editor.addAction({
      id: 'my-unique-id',
      label: 'Test: Add value',
      keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyCode.F10],
      contextMenuGroupId: 'Test',
      contextMenuOrder: 1,
      run: function (ed) {
           showInputBox({
           acceptInput: 'accept input',
           prompt: 'add any value',
           ignoreFocusOut: true,
         })
      },
    });
    editor.focus();
    this.monaco = monaco;
    this.editor = editor;
  }

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the existing Go to Line input flow and the public addAction API, focusing on how an action's run callback can access editor services. Done means custom actions can invoke showInputBox with options such as prompt and ignoreFocusOut, with the input result available to the action.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.