internal/lsp: update documentation for directoryFilters setting and default value

Add `**` usage to directoryFilters documentation. Change directoryFilters default value to `-**/node_modules`

For golang/go#46438

Change-Id: I3ea14ad8a20893d19df4cf8d584a7c7f9b213aab
Reviewed-on: https://go-review.googlesource.com/c/tools/+/422356
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
Dylan Le 2022-08-09 12:16:47 -04:00
parent 96d05aa120
commit 6fa767d87c
3 changed files with 14 additions and 6 deletions

View File

@ -63,15 +63,19 @@ relative to the workspace folder. They are evaluated in order, and
the last filter that applies to a path controls whether it is included.
The path prefix can be empty, so an initial `-` excludes everything.
DirectoryFilters also supports the `**` operator to match 0 or more directories.
Examples:
Exclude node_modules: `-node_modules`
Exclude node_modules at current depth: `-node_modules`
Exclude node_modules at any depth: `-**/node_modules`
Include only project_a: `-` (exclude everything), `+project_a`
Include only project_a, but not node_modules inside it: `-`, `+project_a`, `-project_a/node_modules`
Default: `["-node_modules"]`.
Default: `["-**/node_modules"]`.
#### **templateExtensions** *[]string*

View File

@ -22,8 +22,8 @@ var GeneratedAPIJSON = &APIJSON{
{
Name: "directoryFilters",
Type: "[]string",
Doc: "directoryFilters can be used to exclude unwanted directories from the\nworkspace. By default, all directories are included. Filters are an\noperator, `+` to include and `-` to exclude, followed by a path prefix\nrelative to the workspace folder. They are evaluated in order, and\nthe last filter that applies to a path controls whether it is included.\nThe path prefix can be empty, so an initial `-` excludes everything.\n\nExamples:\n\nExclude node_modules: `-node_modules`\n\nInclude only project_a: `-` (exclude everything), `+project_a`\n\nInclude only project_a, but not node_modules inside it: `-`, `+project_a`, `-project_a/node_modules`\n",
Default: "[\"-node_modules\"]",
Doc: "directoryFilters can be used to exclude unwanted directories from the\nworkspace. By default, all directories are included. Filters are an\noperator, `+` to include and `-` to exclude, followed by a path prefix\nrelative to the workspace folder. They are evaluated in order, and\nthe last filter that applies to a path controls whether it is included.\nThe path prefix can be empty, so an initial `-` excludes everything.\n\nDirectoryFilters also supports the `**` operator to match 0 or more directories.\n\nExamples:\n\nExclude node_modules at current depth: `-node_modules`\n\nExclude node_modules at any depth: `-**/node_modules`\n\nInclude only project_a: `-` (exclude everything), `+project_a`\n\nInclude only project_a, but not node_modules inside it: `-`, `+project_a`, `-project_a/node_modules`\n",
Default: "[\"-**/node_modules\"]",
Hierarchy: "build",
},
{

View File

@ -119,7 +119,7 @@ func DefaultOptions() *Options {
ExpandWorkspaceToModule: true,
ExperimentalPackageCacheKey: true,
MemoryMode: ModeNormal,
DirectoryFilters: []string{"-node_modules"},
DirectoryFilters: []string{"-**/node_modules"},
TemplateExtensions: []string{},
},
UIOptions: UIOptions{
@ -232,9 +232,13 @@ type BuildOptions struct {
// the last filter that applies to a path controls whether it is included.
// The path prefix can be empty, so an initial `-` excludes everything.
//
// DirectoryFilters also supports the `**` operator to match 0 or more directories.
//
// Examples:
//
// Exclude node_modules: `-node_modules`
// Exclude node_modules at current depth: `-node_modules`
//
// Exclude node_modules at any depth: `-**/node_modules`
//
// Include only project_a: `-` (exclude everything), `+project_a`
//