Search code examples
javascriptvisual-studio-codemonaco-editor

Monaco: How to add inline autocomplete/code suggestion?


I couldn't find any examples on how to add inline autocomplete like the images below? Can someone guide me on how to do this in monaco?

enter image description here

enter image description here


Solution

  • This can be enabled in v1.66 (it is in the Insiders now):

    The editor.quickSuggestions setting now accepts inline as configuration value. When set to inline, quick suggestions (IntelliSense) don't display the suggestions widget when you type but show completions as ghosted text.

    See v1.66 release notes: inline quick suggestions

    In your settings:

      "editor.quickSuggestions": {
        "other": "inline", // the `inline` value is new
        "comments": true,
        "strings": true
      }
    

    With this setting the suggestions will appear inline rather than as a pop-up.

    getting the suggestions inline