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

Is there a way to disable IntelliSense?

Open Manish-Giri opened this issue 4 years ago • 6 comments

In my project, IntelliSense seems to obscure a lot of the code in the editor, similar to what is described in this issue - https://github.com/microsoft/monaco-editor/issues/344#issue-204285250

Can I disable IntelliSense entirely? I went through IEditorOptions in the API, but didn't find anything that I could use.

~~I also looked at the VSCode docs on Customizing IntelliSense, but not sure if/how they relate to Monaco Editor.~~

On further digging - I tried the config from VSCode docs in the Monaco Playground, and it seems like intellisense is turned off -

var editor = monaco.editor.create(document.getElementById("container"), {
	value: jsCode,
	language: "javascript",
    quickSuggestions: {
         "other": false,
        "comments": false,
        "strings": false
    },
    parameterHints: {
        enabled: false
    },
    ordBasedSuggestions: false,
    suggestOnTriggerCharacters: false,
    acceptSuggestionOnEnter: "off",
    tabCompletion: "off",
    wordBasedSuggestions: false
});

I just took the config described in the "Customizing IntelliSense" section to try this out, but is there another command that disables IntelliSense entirely all at once, instead of using individual properties?

Manish-Giri avatar Nov 21 '19 20:11 Manish-Giri

In my use case just setting quickSuggestions to false is enough to make all of intellisense go away.

mattgodbolt avatar Nov 21 '19 23:11 mattgodbolt

@mattgodbolt Thank You. I too thought quickSuggestions would take care of it, but it only disables the suggestions as you type. If you press ., you still get suggestions in the dropdown -

Untitled

Manish-Giri avatar Nov 22 '19 22:11 Manish-Giri

There is currently no way to disable suggestions entirely in the AMD distribution. The only possible way would be by using the ESM distribution of the editor and not including the suggest functionality -- see here.

alexdima avatar Nov 25 '19 15:11 alexdima

🤔 features: ["!suggest"] did not work for me. But, this very upsetting CSS snippet did:

.monaco-editor .editor-widget {
  display: none !important;
  visibility: hidden !important;
}

(!important was necessary to override the inline styles added by Monaco)

It'd be swell if ISuggestOptions could have an enabled?: boolean added to it.

My use case is pretty common with education platforms where surfacing additional information is surprisingly harmful to the experience of new users. Other example: https://github.com/freeCodeCamp/learn/issues/88

JoshuaKGoldberg avatar Jan 31 '20 14:01 JoshuaKGoldberg

@alexdima Hi. Could you tell a bit more about how to exclude Suggestion functionality via ESM way?

alxpsr avatar Aug 29 '22 13:08 alxpsr

Seems that i could disable default javascript suggestions

const myDiv: HTMLDivElement = this.editorContent.nativeElement;
        const editorJS: ICodeEditor = editor.create(myDiv, {
            language: 'javascript',
            formatOnPaste: true,
            model: model,
            readOnly: false,
            lineNumbers: 'on',
            minimap: { enabled: false },
            suggest: {
                showFields: false,
                showFunctions: false
            }
        });

See all options at ISuggestOptions interface

alxpsr avatar Aug 29 '22 13:08 alxpsr