Guidance on pattern to improve context for completions in an IDE · Issue #24 · github/copilot-language-server-release · GitHub
Skip to content

Guidance on pattern to improve context for completions in an IDE #24

Open

Description

@gtritchie

Background

Our IDE has an opt-in feature where it will tell copilot about all files in the current project by doing textDocument/didOpen on them. This could potentially be dozens, possibly even hundreds of files, given the nature of the projects in real-world use.

This was originally implemented using the vim copilot plugin, now switched to using copilot-language-server.

Question

Is this a "Good Idea"? Will it actually improve completion suggestions by providing more context, or will it quickly hit some internal limit?

When I switched this to copilot-language-server I also implemented setting workspaceFolders to true, and pass the root folder of the project as the workspace folder; is that accomplishing anything in terms of improving awareness of other files in the project (i.e. does this make the "pretend to open all files" approach redundant)?

Thanks!

Activity

  1. johnwilmes commented on Jun 13, 2025

    @johnwilmes

    Passing the root folder as the workspace folder is great! Please do that!

    As of today, passing all the files in the current project as open files might be somewhat helpful on net. Though, for users who actually tend to open files they are specifically using and interested in, in separate tabs, it might be better to just signal textDocument/didOpen for those.

    However, Very Soon (🤞 ), setting the project root as the workspace folder will be sufficient to expose all the files, and reserving textDocument/didOpen for actually opened files will be clearly preferable.

  2. gtritchie commented on Jun 13, 2025

    @gtritchie
    Author

    Very Soon (🤞 ), setting the project root as the workspace folder will be sufficient to expose all the files, and reserving textDocument/didOpen for actually opened files will be clearly preferable

    Awesome, was hoping that was already the case but Soon is better than Never. The moment that arrives I'll be ripping out our "open all the files in the background" feature.

  3. gtritchie commented on Oct 17, 2025

    @gtritchie
    Author

    Very Soon (🤞 ), setting the project root as the workspace folder will be sufficient to expose all the files, and reserving textDocument/didOpen for actually opened files will be clearly preferable.

    Has there been any movement on this?

  4. MarkMpn commented on Dec 22, 2025

    @MarkMpn

    I'm testing adding the Copilot LSP to an editor, but I'm struggling to get it to give suggestions based on another document. Even if I notify the LSP with textDocument/didOpen for each document, I still only get suggestions from the currently focused document. If I copy the contents of one document into another I do get the more relevant suggestions, so it seems it is not using the other open documents.

    My flow looks like:

    • initialize
    • initialized
    • workspace/didChangeConfiguration
    • textDocument/didOpen (for doc 1)
    • textDocument/didOpen (for doc 2)
    • textDocument/didFocus (for doc 1)
    • textDocument/inlineCompletion (for doc 1)

    I'm expecting the contents of doc 2 to influence the returned completions, but so far they seem to be ignored. Is there some crucial step I've missed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions