Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions internal/project/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"strings"
"time"

"github.com/microsoft/typescript-go/internal/core"
"github.com/microsoft/typescript-go/internal/lsp/lsproto"
"github.com/microsoft/typescript-go/internal/tspath"
)
Expand Down Expand Up @@ -101,8 +102,16 @@ func createResolutionLookupGlobMapper(host ProjectHost) func(data map[tspath.Pat

// dir -> recursive
globSet := make(map[string]bool)
var seenDirs core.Set[string]

for path, fileName := range data {
// Assuming all of the input paths are filenames, we can avoid
// duplicate work by only taking one file per dir, since their outputs
// will always be the same.
if !seenDirs.AddIfAbsent(tspath.GetDirectoryPath(string(path))) {
continue
}

w := getDirectoryToWatchFailedLookupLocation(
fileName,
path,
Expand Down