From 54620d26bbf569ad0652612df22077124f917454 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 8 Nov 2026 11:15:26 +0000 Subject: [PATCH 1/4] Initial plan From 7e765aa691f4bcc8e7dddb1869ff3c9b099fc0af Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 8 Nov 2026 11:23:57 +0000 Subject: [PATCH 2/4] Avoid recursive watches on macOS home-directory roots Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com> --- tsc/internal/project/watch.go | 4 ++-- tsc/internal/project/watch_test.go | 35 ++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/tsc/internal/project/watch.go b/tsc/internal/project/watch.go index 5c55ee3b22e01..733155575bbd0 100644 --- a/tsc/internal/project/watch.go +++ b/tsc/internal/project/watch.go @@ -450,8 +450,8 @@ func perceivedOsRootLengthForWatching(pathComponents []string) int { } return 1 } - if pathComponents[1] == "home" { - // Group /home/username into a single component + if pathComponents[1] == "home" || pathComponents[1] == "Users" { + // Group /home/username or /Users/username into a single component return min(3, length) } return 1 diff --git a/tsc/internal/project/watch_test.go b/tsc/internal/project/watch_test.go index 139e190924991..c24c9cee3557c 100644 --- a/tsc/internal/project/watch_test.go +++ b/tsc/internal/project/watch_test.go @@ -21,6 +21,41 @@ func TestGetPathComponentsForWatching(t *testing.T) { assert.DeepEqual(t, getPathComponentsForWatching(tspath.ToRootedDirectoryPath("C:\\Users\\andrew\\project", "")), []string{"C:/Users/andrew", "project"}) assert.DeepEqual(t, getPathComponentsForWatching(tspath.ToRootedDirectoryPath("/home", "")), []string{"/home"}) assert.DeepEqual(t, getPathComponentsForWatching(tspath.ToRootedDirectoryPath("/home/andrew/project", "")), []string{"/home/andrew", "project"}) + assert.DeepEqual(t, getPathComponentsForWatching(tspath.ToRootedDirectoryPath("/Users", "")), []string{"/Users"}) + assert.DeepEqual(t, getPathComponentsForWatching(tspath.ToRootedDirectoryPath("/Users/andrew", "")), []string{"/Users/andrew"}) + assert.DeepEqual(t, getPathComponentsForWatching(tspath.ToRootedDirectoryPath("/Users/andrew/project", "")), []string{"/Users/andrew", "project"}) +} + +func TestResolutionLookupWatcherOmitsMacOSHomeDirectories(t *testing.T) { + t.Parallel() + + for _, caseSensitivity := range []tspath.CaseSensitivity{tspath.CaseSensitive, tspath.CaseInsensitive} { + var files collections.SyncMap[tspath.PathKey, tspath.RootedFilePath] + for _, fileName := range []tspath.RootedFilePath{ + "/Users/package.json", + "/Users/andrew/package.json", + "/Users/andrew/project/package.json", + "/Users/andrew/other/package.json", + } { + files.Store(caseSensitivity.PathKey(tspath.RootedPath(fileName)), fileName) + } + + result := createResolutionLookupGlobMapper( + "/Users/andrew/project", + "/lib", + "/dev/null", + caseSensitivity, + )(&files) + + assert.DeepEqual(t, result.patternsInsideWorkspace, []string{"/Users/andrew/project/**/*"}) + assert.DeepEqual(t, result.directoriesOutsideWorkspace, []tspath.RootedDirectoryPath{"/Users/andrew/other"}) + assert.DeepEqual(t, result.ignored, map[tspath.RootedDirectoryPath]struct{}{ + "/Users": {}, + "/Users/andrew": {}, + }) + watcher := newRecursiveDirectoryWatcher(result.directoriesOutsideWorkspace[0], lsproto.WatchKindCreate, true) + assert.Equal(t, string(*watcher.GlobPattern.RelativePattern.BaseUri.URI), "file:///Users/andrew/other") + } } func TestNilWatchedFilesClone(t *testing.T) { From a1b133d6f995b2d0e1e26a0aa74ff1ffd5dc36ea Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 8 Nov 2026 12:23:59 +0000 Subject: [PATCH 3/4] Match macOS watch roots without case sensitivity Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com> --- tsc/internal/project/watch.go | 2 +- tsc/internal/project/watch_test.go | 25 +++++++++++++++---------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/tsc/internal/project/watch.go b/tsc/internal/project/watch.go index 733155575bbd0..f37eb8ef343ab 100644 --- a/tsc/internal/project/watch.go +++ b/tsc/internal/project/watch.go @@ -450,7 +450,7 @@ func perceivedOsRootLengthForWatching(pathComponents []string) int { } return 1 } - if pathComponents[1] == "home" || pathComponents[1] == "Users" { + if pathComponents[1] == "home" || strings.EqualFold(pathComponents[1], "Users") { // Group /home/username or /Users/username into a single component return min(3, length) } diff --git a/tsc/internal/project/watch_test.go b/tsc/internal/project/watch_test.go index c24c9cee3557c..0bbb3295615c9 100644 --- a/tsc/internal/project/watch_test.go +++ b/tsc/internal/project/watch_test.go @@ -30,31 +30,36 @@ func TestResolutionLookupWatcherOmitsMacOSHomeDirectories(t *testing.T) { t.Parallel() for _, caseSensitivity := range []tspath.CaseSensitivity{tspath.CaseSensitive, tspath.CaseInsensitive} { + usersDirectory := "/Users" + if caseSensitivity == tspath.CaseInsensitive { + usersDirectory = "/users" + } + var files collections.SyncMap[tspath.PathKey, tspath.RootedFilePath] for _, fileName := range []tspath.RootedFilePath{ - "/Users/package.json", - "/Users/andrew/package.json", - "/Users/andrew/project/package.json", - "/Users/andrew/other/package.json", + tspath.RootedFilePath(usersDirectory + "/package.json"), + tspath.RootedFilePath(usersDirectory + "/andrew/package.json"), + tspath.RootedFilePath(usersDirectory + "/andrew/project/package.json"), + tspath.RootedFilePath(usersDirectory + "/andrew/other/package.json"), } { files.Store(caseSensitivity.PathKey(tspath.RootedPath(fileName)), fileName) } result := createResolutionLookupGlobMapper( - "/Users/andrew/project", + tspath.RootedDirectoryPath(usersDirectory+"/andrew/project"), "/lib", "/dev/null", caseSensitivity, )(&files) - assert.DeepEqual(t, result.patternsInsideWorkspace, []string{"/Users/andrew/project/**/*"}) - assert.DeepEqual(t, result.directoriesOutsideWorkspace, []tspath.RootedDirectoryPath{"/Users/andrew/other"}) + assert.DeepEqual(t, result.patternsInsideWorkspace, []string{usersDirectory + "/andrew/project/**/*"}) + assert.DeepEqual(t, result.directoriesOutsideWorkspace, []tspath.RootedDirectoryPath{tspath.RootedDirectoryPath(usersDirectory + "/andrew/other")}) assert.DeepEqual(t, result.ignored, map[tspath.RootedDirectoryPath]struct{}{ - "/Users": {}, - "/Users/andrew": {}, + tspath.RootedDirectoryPath(usersDirectory): {}, + tspath.RootedDirectoryPath(usersDirectory + "/andrew"): {}, }) watcher := newRecursiveDirectoryWatcher(result.directoriesOutsideWorkspace[0], lsproto.WatchKindCreate, true) - assert.Equal(t, string(*watcher.GlobPattern.RelativePattern.BaseUri.URI), "file:///Users/andrew/other") + assert.Equal(t, string(*watcher.GlobPattern.RelativePattern.BaseUri.URI), "file://"+usersDirectory+"/andrew/other") } } From a8efcecd0766556fc2f6899e624efee7d76736e4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 8 Nov 2026 12:38:29 +0000 Subject: [PATCH 4/4] Use rooted path constructors in watch tests Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com> --- tsc/internal/project/watch_test.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tsc/internal/project/watch_test.go b/tsc/internal/project/watch_test.go index 0bbb3295615c9..c59fe6452cc1a 100644 --- a/tsc/internal/project/watch_test.go +++ b/tsc/internal/project/watch_test.go @@ -37,26 +37,26 @@ func TestResolutionLookupWatcherOmitsMacOSHomeDirectories(t *testing.T) { var files collections.SyncMap[tspath.PathKey, tspath.RootedFilePath] for _, fileName := range []tspath.RootedFilePath{ - tspath.RootedFilePath(usersDirectory + "/package.json"), - tspath.RootedFilePath(usersDirectory + "/andrew/package.json"), - tspath.RootedFilePath(usersDirectory + "/andrew/project/package.json"), - tspath.RootedFilePath(usersDirectory + "/andrew/other/package.json"), + tspath.ToRootedFilePath(usersDirectory+"/package.json", ""), + tspath.ToRootedFilePath(usersDirectory+"/andrew/package.json", ""), + tspath.ToRootedFilePath(usersDirectory+"/andrew/project/package.json", ""), + tspath.ToRootedFilePath(usersDirectory+"/andrew/other/package.json", ""), } { files.Store(caseSensitivity.PathKey(tspath.RootedPath(fileName)), fileName) } result := createResolutionLookupGlobMapper( - tspath.RootedDirectoryPath(usersDirectory+"/andrew/project"), + tspath.ToRootedDirectoryPath(usersDirectory+"/andrew/project", ""), "/lib", "/dev/null", caseSensitivity, )(&files) assert.DeepEqual(t, result.patternsInsideWorkspace, []string{usersDirectory + "/andrew/project/**/*"}) - assert.DeepEqual(t, result.directoriesOutsideWorkspace, []tspath.RootedDirectoryPath{tspath.RootedDirectoryPath(usersDirectory + "/andrew/other")}) + assert.DeepEqual(t, result.directoriesOutsideWorkspace, []tspath.RootedDirectoryPath{tspath.ToRootedDirectoryPath(usersDirectory+"/andrew/other", "")}) assert.DeepEqual(t, result.ignored, map[tspath.RootedDirectoryPath]struct{}{ - tspath.RootedDirectoryPath(usersDirectory): {}, - tspath.RootedDirectoryPath(usersDirectory + "/andrew"): {}, + tspath.ToRootedDirectoryPath(usersDirectory, ""): {}, + tspath.ToRootedDirectoryPath(usersDirectory+"/andrew", ""): {}, }) watcher := newRecursiveDirectoryWatcher(result.directoriesOutsideWorkspace[0], lsproto.WatchKindCreate, true) assert.Equal(t, string(*watcher.GlobPattern.RelativePattern.BaseUri.URI), "file://"+usersDirectory+"/andrew/other")