Skip to content

Add custom/projectFiles LSP request#4179

Open
navya9singh wants to merge 3 commits into
mainfrom
navyasingh/VS2757301
Open

Add custom/projectFiles LSP request#4179
navya9singh wants to merge 3 commits into
mainfrom
navyasingh/VS2757301

Conversation

@navya9singh
Copy link
Copy Markdown
Member

Adds a new custom/projectFiles request that returns all loaded projects and their source files. This enables VS clients to populate the Roslyn workspace with project structure information from tsgo, which is needed for features like Task List (TODO comments) that operate on workspace documents.

Protocol:

Request: custom/projectFiles
Params: none
Result: { projects: [{ configFilePath: string, files: string[] }] }

Each project entry contains the config file path (or inferred root) and an array of file URIs belonging to that project.

Copilot AI review requested due to automatic review settings June 2, 2026 19:00
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new custom/projectFiles LSP request to expose the server’s currently loaded projects along with their program source files, intended for VS clients to build a Roslyn workspace model.

Changes:

  • Register a new server handler for custom/projectFiles and implement project/file enumeration from the current session snapshot.
  • Add LSP-level tests covering configured, inferred, and “no projects loaded” scenarios.
  • Extend the generated LSP protocol types and generator inputs to include the new request and result structures.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
internal/lsp/server.go Registers/implements handleProjectFiles to return loaded projects and their source file URIs.
internal/lsp/server_projectfiles_test.go Adds integration tests for the new custom request.
internal/lsp/lsproto/lsp_generated.go Adds generated protocol types + method/result unmarshalling and request mapping for custom/projectFiles.
internal/lsp/lsproto/_generate/generate.mts Updates protocol generator inputs (structures + custom request entry).

Comment thread internal/lsp/server.go
Comment on lines +1835 to +1839
sourceFiles := proj.Program.GetSourceFiles()
files := make([]lsproto.DocumentUri, 0, len(sourceFiles))
for _, sf := range sourceFiles {
files = append(files, lsconv.FileNameToDocumentURI(sf.FileName()))
}
Comment thread internal/lsp/server.go
Comment on lines +1830 to +1833
configFilePath := ""
if proj.Kind == project.KindConfigured {
configFilePath = proj.Name()
}
@navya9singh navya9singh requested a review from jakebailey June 2, 2026 19:21
@gabritto
Copy link
Copy Markdown
Member

gabritto commented Jun 2, 2026

How is that going to be used by VS exactly? The projects that we currently have on the snapshot are typically only the ones we need to know about given the current set of open files, so I'm just wondering if VS having only partial project information is ok.

@navya9singh
Copy link
Copy Markdown
Member Author

How is that going to be used by VS exactly? The projects that we currently have on the snapshot are typically only the ones we need to know about given the current set of open files, so I'm just wondering if VS having only partial project information is ok.

VS uses this to populate the Roslyn workspace for Task List (TODO comments). Roslyn's Task List only scans documents with active text buffers, so it only needs projects for currently open files — which is exactly what the snapshot provides. Partial project info is fine here since the client and the server are both scoped to open files.

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

Successfully merging this pull request may close these issues.

3 participants