Skip to content

Extract ScriptInfo and DocumentRegistry to common container #1202

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

Merged
merged 1 commit into from
Jun 16, 2025

Conversation

andrewbranch
Copy link
Member

This is a minor refactor that will make it easier to share files/state between LSP, MCP, and the IPC API.

Copy link
Contributor

@Copilot 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

This PR refactors the code by extracting the ScriptInfo and DocumentRegistry logic into a common container called DocumentStore, in order to share state among LSP, MCP, and the IPC API.

  • Removed multiple fields (documentRegistry, scriptInfos, and related locks) in favor of a single DocumentStore.
  • Updated methods in Service and API to delegate functionality to the DocumentStore.
  • Introduced a new DocumentStore file to encapsulate the shared logic.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
internal/project/service.go Replaced direct management of ScriptInfo with calls to DocumentStore.
internal/project/documentstore.go Introduced DocumentStore for handling ScriptInfo and DocumentRegistry.
internal/api/api.go Updated API to delegate document and script info operations to DocumentStore.

@andrewbranch andrewbranch force-pushed the project/documentstore branch from bf20a2d to 041bfb0 Compare June 16, 2025 18:55
Copy link
Member

@jakebailey jakebailey left a comment

Choose a reason for hiding this comment

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

Seems fine as a refactor, but I am increasingly unsure about our model here; I would really like to reformulate all of this as a real snapshot model so we can entirely eliminate all of the weird races that come from trying to manage the registry, updating script infos, etc...

@andrewbranch andrewbranch added this pull request to the merge queue Jun 16, 2025
Merged via the queue into microsoft:main with commit d2a87ed Jun 16, 2025
22 checks passed
@andrewbranch andrewbranch deleted the project/documentstore branch June 16, 2025 20:25
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.

2 participants