Skip to main content

How does Mistral Code handle multi-file projects and context?

Updated this week

When working on larger software projects, code is typically spread across multiple files and directories.

πŸ”‘ Mistral Code is designed to handle these multi-file projects effectively but, like any AI tool, you need to provide it with adequate context and some guidance to understand the structure of your project.

Autocompletion vs Chat: Different approaches to context understanding

Mistral Code autocompletion (typically triggered by pressing the tab key) provides blazingly fast contextually relevant suggestions based on the current file and its surroundings, at the trade-off of not inherently understand the broader project structure or the relationships between different files.

To the contrary, Mistral Code's chat interface is designed to understand and leverage the broader context of your project, using special conversation commands to help it focus on specific files, directories, or aspects of your codebase.

Fine-Tuning Context with Chat Commands

Adding context to your Chat conversations is as simple as hitting the @ symbol on your keyboard then using one of the following context commands:

  • @Current File: Instructs Mistral Code to focus its attention primarily on the content of the currently active file in your editor.

  • @Open Files: Adds all files that are currently open in your IDE tabs to the conversation's context (⚠️ warning: this can lead to large tokens consumption).

  • @Files: Allows you to browse and select specific files or directories from your project to be explicitly included in the context. (You might also be able to directly reference a file using a syntax like @FileName.extension for quick single-file selection)

  • @Git Diff: Adds the current changes in your codebase (the difference between your working directory and the last Git commit) to the context. Useful for asking questions about recent modifications or generating commit messages.

  • @Terminal: Allows you to reference the content or output of your IDE's integrated terminal, such as the last command run or its output, making it part of the context for Mistral Code.

  • @Problems: Brings any problems or errors detected by your IDE (e.g., linting errors, compilation errors) in your current file or project into the context, allowing you to ask Mistral Code for help in resolving them.

Did this answer your question?