Skip to content

Setting context for inline completions #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
michaelstaszewski opened this issue Apr 9, 2025 · 1 comment
Closed

Setting context for inline completions #19

michaelstaszewski opened this issue Apr 9, 2025 · 1 comment

Comments

@michaelstaszewski
Copy link

I am having some troubles with setting context. I would like to open multiple files and have them all participate in the context used when generating inline completions.

In my test I have a folder with two files:

  1. SchemaExport.sql - Schema export file from a SQL database
  2. NewCode.sql - Empty file where I'll be writing queries against my schema

After initialization and sign in, I do the following:

  1. Send a workspace/didChangeWorkspaceFolders notification with my folder in the added list
  2. Send a textDocument/didOpen notification for each file in the folder
  3. Activate the tab for NewCode.sql and send a textDocument/didFocus notification
  4. I send incremental updates using the textDocument/didChange notification

Inline completions work in NewCode.sql, but the results are largely based on general SQL knowledge vs. knowledge of the contents of SchemaExport.sql.

If I repeat the above steps, but activate the tab for SchemaExport.sql and send a textDocument/didFocus for it, inline completions made within SchemaExport.sql work exactly as I expect and use the contents of the file.

How can I improve upon the context? I see similar results when opening my folder in VS Code and using Copilot there.

Thanks,
Michael

@tpope
Copy link

tpope commented Apr 14, 2025

The exact context used is an implementation detail that is constantly in flux. There are no guarantees here. But the behavior you observing today is deriving from recently focused documents. Just having a document open in the background doesn't make the cut.

@tpope tpope closed this as completed Apr 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants