DocsSuggestionCustomizing suggestions

Customizing Suggestions

You can customize how suggestions appear in the autocomplete popup and how they behave when selected.

Appearance

The attributes that control the appearance of a Fig suggestion are:

  • icon. Can be an emoji, a URL to an image asset or a fig:// URL, which can be used to access built-in assets and macOS filesystem icons. See "Icon API" to learn more.

  • displayName. Directly sets the text that appears for a given suggestion. This should be used to customize text, rather than name.

  • description. Sets the description text for a given suggestion.

Behavior

The attributes that control the behavior of a Fig suggestion are:

  • insertValue. Determines what text is inserted into the terminal when a suggestion is selected.

    You can use the insertValue to assist the user by automatically inserting quotation marks or adding and equals sign.

{
  // The token used for Fig's parser. Will also be text displayed if not overridden by displayName
  name: [ "-m", "--message"],
  // change what is inserted when the users selects something
  insertValue: "-m '{cursor}'",
  description: "Add a commit message",
  args: {
    name: "message"
  }
}

For example, the Option above defines the -m flag of git commit. When this suggestion is selected, it will insert the -m flag, add a space and wrap the user's cursor in single quotes.

  • isDangerous. Indicates whether executing this suggestion might potentially run an irreversible or dangerous command. The icon will not appear.

    Setting isDangerous to true will prevent Fig from allowing the user to run the suggestion directly.

  • priority. Indicate the relative priority or importance of a suggestion.

    See "Indicating Priority" to learn more.

Using name vs displayName vs insertValue

  • name is a token used by Fig while parsing the edit buffer.

  • displayName is the text that appears in the autocomplete popup. It has no effect on parsing or what value is inserted.

  • insertValue is the text that is inserted into the terminal. You can use it to add additional text that speeds up the user's typing, but would break Fig's parser, if included in the name property.

    Note: If displayName or insertValue are not set, they default to the value of the name property.