Define the context
Last updated
Last updated
General rule: Provide context about the task, the project, or the specific issue you are dealing with.
Here is the referenced function in the text editor:
As an alternative to mentioning the function name in the prompt, you can also select the code in the editor or use the CodeLens ask
option just above the code. Selecting the code in the current open file provides Tabnine Chat with explicit context. If you'd like to perform operations on specific code, be sure to select the code in the IDE before you ask Chat to operate it.
Less effective: prompt Improve this code:
More effective: with the relevant code context made explicit as described above, prompt Refactor the function printCelsius to have the formula just once:
Using workspace context is a form of personalization that Tabnine offers to improve the quality of responses from an LLM that was not trained on your existing code base. If workspace context is enabled by your team admin, it is on by default. The toggle to control whether it is on or off is in the lower right corner of the Tabnine Chat window.
Here is the workspace context selector with the toggle switched off:
Using the same reference code in example 1 above, here is the response to the prompt Modify this code to convert from Celsius to Fahrenheit with workspace context on:
Here is the response to the same prompt with the workspace context turned off:
It is not always best to add more context (such as by opening a large number of files in the workspace). Only the most recently touched 2 files in the text editor will be loaded into the context window. In cases where you do not want to open additional files, you can use Mentions to reference specific files, methods or functions elsewhere in your local workspace as part of your prompt.