MCPcopy Create free account
hub / github.com/microsoft/typescript-go / getPathComponentsForWatching

Function getPathComponentsForWatching

internal/project/watch.go:397–405  ·  view source on GitHub ↗
(path string, currentDirectory string)

Source from the content-addressed store, hash-verified

395}
396
397func getPathComponentsForWatching(path string, currentDirectory string) []string {
398 components := tspath.GetPathComponents(path, currentDirectory)
399 rootLength := perceivedOsRootLengthForWatching(components)
400 if rootLength <= 1 {
401 return components
402 }
403 newRoot := tspath.CombinePaths(components[0], components[1:rootLength]...)
404 return append([]string{newRoot}, components[rootLength:]...)
405}
406
407func perceivedOsRootLengthForWatching(pathComponents []string) int {
408 length := len(pathComponents)

Callers 1

Calls 4

GetPathComponentsFunction · 0.92
CombinePathsFunction · 0.92
appendFunction · 0.50

Tested by 1