Skip to content

Commit 856536a

Browse files
committed
Add file names to root file watch globs
1 parent 08c6506 commit 856536a

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

internal/project/project.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,12 +231,15 @@ func (p *Project) LanguageService() *ls.LanguageService {
231231

232232
func (p *Project) getRootFileWatchGlobs() []string {
233233
if p.kind == KindConfigured {
234-
wildcardDirectories := p.parsedCommandLine.WildcardDirectories()
235-
result := make([]string, 0, len(wildcardDirectories)+1)
234+
globs := p.parsedCommandLine.WildcardDirectories()
235+
result := make([]string, 0, len(globs)+1)
236236
result = append(result, p.configFileName)
237-
for dir, recursive := range wildcardDirectories {
237+
for dir, recursive := range globs {
238238
result = append(result, fmt.Sprintf("%s/%s", dir, core.IfElse(recursive, recursiveFileGlobPattern, fileGlobPattern)))
239239
}
240+
for _, fileName := range p.parsedCommandLine.LiteralFileNames() {
241+
result = append(result, fileName)
242+
}
240243
return result
241244
}
242245
return nil

internal/tsoptions/parsedcommandline.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ func (p *ParsedCommandLine) WildcardDirectories() map[string]bool {
3636
return p.wildcardDirectories
3737
}
3838

39+
// Normalized file names explicitly specified in `files`
40+
func (p *ParsedCommandLine) LiteralFileNames() []string {
41+
if p.ConfigFile != nil {
42+
return p.FileNames()[0:len(p.ConfigFile.configFileSpecs.validatedFilesSpec)]
43+
}
44+
return nil
45+
}
46+
3947
func (p *ParsedCommandLine) SetParsedOptions(o *core.ParsedOptions) {
4048
p.ParsedConfig = o
4149
}
@@ -48,6 +56,7 @@ func (p *ParsedCommandLine) CompilerOptions() *core.CompilerOptions {
4856
return p.ParsedConfig.CompilerOptions
4957
}
5058

59+
// All file names matched by files, include, and exclude patterns
5160
func (p *ParsedCommandLine) FileNames() []string {
5261
return p.ParsedConfig.FileNames
5362
}

0 commit comments

Comments
 (0)