microsoft / microsoft/monaco-editor
[Bug] Cannot disable suggestions for only one editor on page
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?
- [ I don't know ] 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 Code
const container1 = document.createElement('div');
const container2 = document.createElement('div');
const style = 'height: 200px; border: 1px solid #000; margin: 10px;';
container1.setAttribute('style', style);
container2.setAttribute('style', style);
document.body.appendChild(container1);
document.body.appendChild(container2);
// basic editor #1
monaco.editor.create(container1, {
value: '/* suggestions are not working here */\n<Item type="Test1" id="512FF7893DBCD6D1AC1F55B87A480934">\n</Item>',
language: 'xml'
});
// read only editor #2
monaco.editor.create(container2, {
value: '/* read only editor */\n<Item type="Read Only Editor">\n\n</Item>',
language: 'xml',
readOnly: true,
suggest: {
showFields: false,
showFunctions: false
},
quickSuggestions: {
"other": false,
"comments": false,
"strings": false
},
parameterHints: {
enabled: false
},
ordBasedSuggestions: false,
suggestOnTriggerCharacters: false,
acceptSuggestionOnEnter: "off",
tabCompletion: "off",
wordBasedSuggestions: false
});
Reproduction Steps
Call suggestions dialog at first editor
Actual (Problematic) Behavior
There is always "No suggestions"
Expected Behavior
Suggestions dialog works and displays and includes only keywords from current editor.
Additional Context
I have two editors on page and I need to split suggestions for them. Keywords for each editor should be taken separately.
As a workaround I tries to disable editing and all suggestions options for the second editor. But these options also applies for the first editor. It's unexpected.
Do anyone has idea how to split suggestions keywords between each editor? Or maybe to leave only code highlighting for the second one.
P.S. There is a service where user inputs XML request (should be with IntelliSense) in first monaco editor and after request user should see highlighted XML response in second editor (this one can be stupid - without editing, suggestions etc.)
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 provided Monaco Editor Playground reproduction and inspect how the two XML editor instances apply suggestion and language settings. Verify whether disabling suggestions on the read-only editor affects the first editor, then confirm that the first editor still shows its own suggestions while the second remains read-only without suggestions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100