internal/lsp: exclude node_modules in the workspace root by default

It is unlikely that users want gopls operating on their node_modules
directories, so we should exclude them by default. If a user wants to
include them, they can override their directory filters setting.

This doesn't exclude *any* directory named "node_modules", so we still
need to implement golang/go#46438 to exclude node_modules completely.

Change-Id: I03c42208e62390dc35e44ac5176422ddf8dc53f7
Reviewed-on: https://go-review.googlesource.com/c/tools/+/347297
Trust: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
This commit is contained in:
Rebecca Stambler 2021-09-02 13:51:16 -04:00
parent 8373dc3f73
commit 3b801c8b83
3 changed files with 3 additions and 2 deletions

View File

@ -70,7 +70,7 @@ 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: `[]`.
Default: `["-node_modules"]`.
#### **memoryMode** *enum*

View File

@ -40,7 +40,7 @@ var GeneratedAPIJSON = &APIJSON{
Keys: nil,
},
EnumValues: nil,
Default: "[]",
Default: "[\"-node_modules\"]",
Status: "",
Hierarchy: "build",
},

View File

@ -109,6 +109,7 @@ func DefaultOptions() *Options {
ExpandWorkspaceToModule: true,
ExperimentalPackageCacheKey: true,
MemoryMode: ModeNormal,
DirectoryFilters: []string{"-node_modules"},
},
UIOptions: UIOptions{
DiagnosticOptions: DiagnosticOptions{