monaco-editor icon indicating copy to clipboard operation
monaco-editor copied to clipboard

[Bug] Cannot disable suggestions for only one editor on page

Open abaksha-sc opened this issue 2 years ago • 2 comments

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?

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.)

abaksha-sc avatar Oct 20 '22 12:10 abaksha-sc

I think thats the same problem as my initial bug ticket: https://github.com/microsoft/monaco-editor/issues/2947 https://github.com/microsoft/monaco-editor/issues/3084 I still have not found any workaround for this.

steinerjakob avatar Oct 21 '22 06:10 steinerjakob

same problem for me. when I create multiple monaco instances and add different suggestions for them, they will be mixed up and some will show up multiple times. It seems that all monaco instances will interact with each other, any ideas?

legends-killer avatar Jan 10 '24 15:01 legends-killer