microsoft / microsoft/monaco-editor
[Bug] editor.action.selectToBracket - selectBrackets argument is not considered
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 46.8k
- Forks
- 4.1k
- Avg merge
- 17h 58m
- Merged PRs (30d)
- 1
Description
Reproducible in vscode.dev or in VS Code Desktop?
- Not reproducible in vscode.dev or VS Code Desktop
Reproducible in the monaco editor playground?
- Not reproducible in the monaco editor playground
Monaco Editor Playground Link
Monaco Editor Playground Code
const value = `{
"name": "john",
"orgDetails": {
"name": "xyz",
"location": "UK"
},
"array": ["a", "b", "c", ["d", "e"], "f"]
}`;
const container = document.getElementById("container");
const myEditor = monaco.editor.create(container, {
value,
language: "json",
automaticLayout: true,
});
container.addEventListener('dblclick', () => {
const actionId = 'editor.action.selectToBracket',
args = { selectBrackets: false}
myEditor.trigger(null, actionId, JSON.stringify(args));
});
Reproduction Steps
Double-click anywhere inside the brackets, you will see that the brackets are also included in the selection.
Actual (Problematic) Behavior
Upon double-clicking, the brackets are also included in the selection. Somehow the argument is not working properly.
Expected Behavior
Since we are passing the argument selectBrackets as false then the selection should not include the surrounding brackets.
Additional Context
I have come across this argument from here: https://github.com/Microsoft/vscode/issues/43371
and the implementation of this from here: https://github.com/microsoft/monaco-editor/blob/d514ddaa8d0ac3a3c11bffe6d3ca1bf9ee822228/test/smoke/smoke.test.js#L101-L105
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked Monaco Editor Playground code and the referenced test/smoke/smoke.test.js entry. Reproduce editor.action.selectToBracket with selectBrackets set to false, then compare the selection behavior against the expected result and add or update coverage so the surrounding brackets are excluded.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100