Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Watch type refs and instead of watching directly use go routine#1217

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
sheetalkamat wants to merge5 commits intomain
base:main
Choose a base branch
Loading
fromwatchTypeRefs

Conversation

sheetalkamat
Copy link
Member

No description provided.

Copy link
Contributor

@CopilotCopilotAI 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 module resolution watching by extracting lookup-glob generation into standalone functions, introduces concurrency-safe watcher updates withsync.RWMutex, and runs watcher updates and typing-location watches in goroutines.

  • IntroducedgetModuleResolutionWatchGlobs and genericextractLookups inwatch.go
  • AddedwatchMu sync.RWMutex to guard watcher updates inproject.go and madeupdateWatchers asynchronous
  • Spawned goroutines forupdateWatchers andWatchTypingLocations to decouple from the main update loop

Reviewed Changes

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

Show a summary per file
FileDescription
internal/project/watch.goNew helper functions to gather module-resolution watch patterns
internal/project/project.goAddedwatchMu, updatedupdateWatchers signature and concurrency, adjusted locks inWatchTypingLocations and event handler
internal/project/ata.goChangeddiscoverAndInstallTypings to invokeWatchTypingLocations asynchronously
internal/module/types.goAddedGetLookupLocations methods to resolved-module types
internal/compiler/program.goExposedGetResolvedTypeReferenceDirectives onProgram
internal/compiler/parsetask.goAdded flag for automatic-type parsing inparseTask
internal/compiler/fileloader.goIntegrated automatic-type-directive tasks into parsing workflow
Comments suppressed due to low confidence (3)

internal/project/project.go:354

  • [nitpick] The parameter nameprogram shadowsp.program; consider renaming it (e.g.,prog) to reduce confusion.
func (p *Project) updateWatchers(ctx context.Context, program *compiler.Program) {

internal/project/watch.go:368

  • These new functions (getModuleResolutionWatchGlobs andextractLookups) introduce nontrivial logic; consider adding unit tests to verify correct extraction of lookup globs.
func getModuleResolutionWatchGlobs(program *compiler.Program) (failedLookups map[tspath.Path]string, affectingLocaions map[tspath.Path]string) {

internal/project/project.go:170

  • The code introducessync.RWMutex but there is nosync import; addimport "sync" to avoid a compile error.
watchMu                 sync.RWMutex

Copy link
Member

@jakebaileyjakebailey left a comment

Choose a reason for hiding this comment

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

The file loader code seems correct to me, though I am unsure about the concurrency stuff in the Project given our ongoing logical races.

I assume no tests change with the loader change since the main effect here is to actually keep track of these files for watching?

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

@jakebaileyjakebaileyjakebailey left review comments

Copilot code reviewCopilotCopilot left review comments

@andrewbranchandrewbranchAwaiting requested review from andrewbranch

At least 1 approving review is required to merge this pull request.

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@sheetalkamat@jakebailey

[8]ページ先頭

©2009-2025 Movatter.jp