Skip to content

# symbols

In the input box of side chat, you can add various types of context, including code, files, folders, and the workspace, by using the # symbol. Typically, the list will display recommended contexts related to the file currently opened in the editor, but you can still search for the needed context and add it to the input box. Depending on the type of context you add, the AI assistant will provide more accurate and relevant responses.

#Code

By using #Code, you can add relevant code related to functions or classes as context for your chat with the AI assistant. The result list defaults to displaying functions or classes from the file currently opened in the editor. Before selecting, you can preview the code of the recommended functions or classes. If the recommended content is not what you need, you can use keywords to search for the desired functions or classes.

Note: If there is no corresponding Language Server Protocol (LSP) for a programming language in Trae, install it in advance; otherwise, Trae may fail to recognize code symbols.

  1. In the input box, type #, or click the # Context button at the bottom left.

  2. A list of context types appears above the input box.

  3. Select Code from the list (or manually type Code after the # symbol) and then press the Enter key.

  4. The list displays the functions and classes available in the file currently opened in the editor. When you hover over an item in the list, the code content for that function or class will be shown on the left for preview.

    #Code preview

  5. If the recommended functions and classes are not what you need, enter the name or keywords of the desired function or class after #Code:.

  6. The AI assistant searches for related functions and classes within the project and displays them in the list for you to preview.

    #Code search

  7. From the list, select the function or class you want to specify as context.

#File

By using #File, you can set all content from a specified file as context for your chat with the AI assistant. The result list defaults to showing the files recently opened in the editor. You can preview the directories of these files to avoid mistakenly selecting files with the same name. If the given files are not what you need, you can use keywords to search for the desired files.

  1. In the input box, type #, or click the # Context button at the bottom left.

  2. A list of context types appears above the input box.

  3. Select File from the list (or manually type File after the # symbol) and then press the Enter key.

  4. The list displays the files recently opened in the editor. When you hover over a file in the list, the directory of that file will be shown on the left.

    #File preview

  5. If the recommended files are not what you need, enter the name or keywords of the desired file after #File:.

  6. The AI assistant searches for related files within the project and displays them in the list.

    #File search

  7. Select the file from the list that you want to specify as context.

#Folder

By using #Folder, you can set all content from a specified folder as context for your chat with the AI assistant. The result list defaults to showing folders related to the file currently opened in the editor. You can preview the directories of these folders to avoid mistakenly selecting folders with the same name. If the displayed folders are not what you need, you can use keywords to search for the desired folders.

Note: The #Folder feature requires the code index of the project to be completely built. If not, it may negatively affect the retrieval of content from folders, leading to incomplete responses from the AI assistant. When asking questions, if the index has never been built or is currently building, you will see "Index not built" or "Index building" in the references section.

  1. In the input box, type #, or click the # Context button at the bottom left.

  2. A list of context types appears above the input box.

  3. Select Folder from the list (or manually type Folder after the # symbol) and then press the Enter key.

  4. The list displays folders related to the file currently opened in the editor. When you hover over a folder in the list, the directory of that folder will be shown on the left.

    #Folder preview

  5. If the recommended folders are not what you need, enter the name or keywords of the desired folder after #Folder:.

  6. The AI assistant searches for related folders within the project and displays them in the list.

    #Folder search

  7. Select the folder from the list that you want to specify as context.

#Workspace

You can use #Workspace to ask the AI assistant questions about the entire workspace. The assistant will automatically search for the most relevant content within the workspace to provide context for its responses. This feature is especially helpful when you're encountering an unfamiliar project, as it can give you a comprehensive understanding of the features and code implemented in the project, allowing you to quickly get up to speed.

Your Ultimate AI-Powered IDE Learning Guide