Skip to content

Commit

Permalink
Discover: Always return a possible directory.
Browse files Browse the repository at this point in the history
Discover is used by the language server to find the root of a project.
If the root is not found, it will now return the initial directory.

Closes #709
  • Loading branch information
5nord committed Nov 3, 2024
1 parent 96b7533 commit 9827672
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion project/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ func Discover(path string) []Suite {
}
list = append(list, readIndices(fs.JoinPath(path, IndexFile))...)

// Check build directories
// Check parallel build directories
for _, file := range fs.Glob(path + "/*build*/" + IndexFile) {
list = append(list, readIndices(file)...)
}
Expand All @@ -290,6 +290,12 @@ func Discover(path string) []Suite {
})
}

// If we still could not find any coherent test suite, just add the
// current directory in the hopes it contains TTCN-3 files.
if len(list) == 0 {
return []Suite{{RootDir: path, SourceDir: path}}
}

// Remove duplicate entries
result := make([]Suite, 0, len(list))
visited := make(map[Suite]bool)
Expand Down

0 comments on commit 9827672

Please sign in to comment.