typescript-go icon indicating copy to clipboard operation
typescript-go copied to clipboard

inconsistent patterns in `getSubPatternFromSpec`

Open joshcartme opened this issue 6 months ago • 0 comments

I don't fully understand the impact of this (perhaps none since the comments indicate this is just an optimization) but this code https://github.com/microsoft/typescript-go/blob/e7a30f5106f7af66974b59bba2d9510c11b7bfb6/internal/vfs/utilities.go#L216-L224 will produce different results depending on if the directory name, for example, has dashes in it or not. If it's this-directory componentPattern.String() will be this\\-directory and it will enter the condition. If it's thisdirectory the condition will not be true because componentPattern.String() will be thisdirectory

Again, not sure if this has an impact, but I was trying to debug something else and noticed that when launch tsgo with a config at /some/projects/this-directory I was seeing: "^((/some/projects/(?!(node_modules|bower_components|jspm_packages)(/|$))this\\-directory (snipped the end) which looked odd since it's putting the node_modules et al. exclude before the actual directory that the config is in.

If I launch it with a config in /some/projects/thisdirectory I get "^((/some/projects/thisdirectory(/(?!(node_modules|bower_components|jspm_packages)(/|$))[^/.][^/]*)*?/(?!(node_modules|bower_components|jspm_packages)(/|$))([^./]([^./]|(\\.(?!min\\.js$))?)*)?))$", i.e. thisdirectory comes before the exclude.

joshcartme avatar May 31 '25 03:05 joshcartme