Microsoft/monaco-editor
在 GitHub 查看[Bug] editor.action.selectToBracket - selectBrackets argument is not considered
Open
#4,022 创建于 2023年6月13日
bugeditor-corehelp wanted
描述
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