| 1 | Autocomplete will automatically determine context based on the current cursor position. We use the following techniques to determine what to include in the prompt: |
| 2 | |
| 3 | ## File prefix/suffix |
| 4 | |
| 5 | We will always include the code from your file prior to and after the cursor position. |
| 6 | |
| 7 | ## Definitions from the Language Server Protocol |
| 8 | |
| 9 | Similar to how you can use cmd/ctrl + click in your editor, we use the same tool (the LSP) to power "go to definition". For example, if you are typing out a function call, we will include the function definition. Or, if you are writing code inside of a method, we will include the type definitions for any parameters or the return type. |
| 10 | |
| 11 | ## Imported files |
| 12 | |
| 13 | Because there are often many imports, we can't include all of them. Instead, we look for symbols around your cursor that have matching imports and use that as context. |
| 14 | |
| 15 | ## Recent files |
| 16 | |
| 17 | We automatically consider recently opened or edited files and include snippets that are relevant to the current completion. |