continuedev / continue

⏩ Continue is the leading open-source AI code assistant. You can connect any models and any context to build custom autocomplete and chat experiences inside VS Code and JetBrains
https://docs.continue.dev/
Apache License 2.0
13.59k stars 957 forks source link

Show plaintext scratch files in prompt context view #668

Open pkirkovsky opened 7 months ago

pkirkovsky commented 7 months ago

Validations

Problem

Unsaved/"un-languaged" files are not displayed in the "Add Context" menu in Continue.

Steps to reproduce:

Expected: Fresh unsaved files (Untitled-*) appear in the workspace files view and are available for use as prompt context

Actual: These files are not visible to the extension

Comments: I often find myself using scratch files to quickly try out new ideas or store code snippets/test data/whatever, and being able to use an LLM on these pieces of text would be very handy. Setting the language manually provides a workaround for this, but that can get annoying.

Solution

Looks like documentIsCode() here is responsible for this behavior.

I suggest adjusting the logic so that document.isUntitled(ref) being true should override document.languageId === "plaintext", since the user is probably interacting with a scratch file.

sestinj commented 7 months ago

Definitely a good update to make! Aiming to completely solve this, /edit, and cmd+m problems within unsaved files soon. Will update here as progress is made