[tools] gopls/internal/settings: move file watcher setting to user options

1 view
Skip to first unread message

Hongxiang Jiang (Gerrit)

unread,
3:57 PM (7 hours ago) 3:57 PM
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Hongxiang Jiang has uploaded the change for review

Commit message

gopls/internal/settings: move file watcher setting to user options

When a setting is internal options, they can be set by the user
but it is generally very hard to discover unless the user look at
the release note or the gopls's code base.

Moving from internal setting to user setting improves the
setting's discoverability.

For golang/go#67995
Change-Id: Icd06e1321ea873dbd82f41b8a2e9da606ed35c80

Change diff

diff --git a/gopls/internal/settings/default.go b/gopls/internal/settings/default.go
index b4c0ec1..8b5c9f1 100644
--- a/gopls/internal/settings/default.go
+++ b/gopls/internal/settings/default.go
@@ -137,12 +137,12 @@
NewGoFileHeader: true,
RenameMovesSubpackages: false,
},
+ FileWatcher: FileWatcherOff,
},
InternalOptions: InternalOptions{
CompleteUnimported: true,
CompletionDocumentation: true,
DeepCompletion: true,
- FileWatcher: FileWatcherOff,
SubdirWatchPatterns: SubdirWatchPatternsAuto,
ReportAnalysisProgressAfter: 5 * time.Second,
TelemetryPrompt: false,
diff --git a/gopls/internal/settings/settings.go b/gopls/internal/settings/settings.go
index bcaf2ac..52c7786 100644
--- a/gopls/internal/settings/settings.go
+++ b/gopls/internal/settings/settings.go
@@ -663,6 +663,17 @@
UIOptions
FormattingOptions

+ // FileWatcher specifies the server-side file watching strategy used by gopls.
+ //
+ // By default, this is set to "off", meaning gopls relies exclusively on the
+ // language client (e.g., the editor) to send file change notifications.
+ //
+ // Available options:
+ // - "off" : Client-driven watching (default)
+ // - "fsnotify" : OS-level event notifications
+ // - "poll" : Periodic directory scanning
+ FileWatcher FileWatcherMode `status:"experimental"`
+
// MaxFileCacheBytes sets a soft limit on the file cache size in bytes.
// If zero, the default budget is used.
//
@@ -793,17 +804,6 @@
// issue.
SubdirWatchPatterns SubdirWatchPatterns

- // FileWatcher specifies the server-side file watching strategy used by gopls.
- //
- // By default, this is set to "off", meaning gopls relies exclusively on the
- // language client (e.g., the editor) to send file change notifications.
- //
- // Available options:
- // - "off" : Client-driven watching (default)
- // - "fsnotify" : OS-level event notifications
- // - "poll" : Periodic directory scanning
- FileWatcher FileWatcherMode
-
// ReportAnalysisProgressAfter sets the duration for gopls to wait before starting
// progress reporting for ongoing go/analysis passes.
//

Change information

Files:
  • M gopls/internal/settings/default.go
  • M gopls/internal/settings/settings.go
Change size: S
Delta: 2 files changed, 12 insertions(+), 12 deletions(-)
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newchange
Gerrit-Project: tools
Gerrit-Branch: master
Gerrit-Change-Id: Icd06e1321ea873dbd82f41b8a2e9da606ed35c80
Gerrit-Change-Number: 776882
Gerrit-PatchSet: 1
Gerrit-Owner: Hongxiang Jiang <hxj...@golang.org>
unsatisfied_requirement
satisfied_requirement
open
diffy

Hongxiang Jiang (Gerrit)

unread,
4:24 PM (7 hours ago) 4:24 PM
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Hongxiang Jiang uploaded new patchset

Hongxiang Jiang uploaded patch set #2 to this change.
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newpatchset
Gerrit-Project: tools
Gerrit-Branch: master
Gerrit-Change-Id: Icd06e1321ea873dbd82f41b8a2e9da606ed35c80
Gerrit-Change-Number: 776882
Gerrit-PatchSet: 2
Gerrit-Owner: Hongxiang Jiang <hxj...@golang.org>
unsatisfied_requirement
satisfied_requirement
open
diffy

Hongxiang Jiang (Gerrit)

unread,
4:27 PM (6 hours ago) 4:27 PM
to goph...@pubsubhelper.golang.org, Alan Donovan, Madeline Kalil, golang-co...@googlegroups.com
Attention needed from Alan Donovan

Hongxiang Jiang voted and added 1 comment

Votes added by Hongxiang Jiang

Auto-Submit+1
Commit-Queue+1

1 comment

File gopls/internal/settings/settings.go
Line 675, Patchset 2 (Latest): FileWatcher FileWatcherMode `status:"experimental"`
Hongxiang Jiang . resolved

I believe this setting belongs to user options. Because the server option is LSP specific by definition below.

```
// ServerOptions holds LSP-specific configuration that is provided by the
// server.
//
// ServerOptions must be comparable with reflect.DeepEqual.
```

But this does not belongs to any embedded user option like build, ui, formatting...

This is still marked as `experimental`.

Open in Gerrit

Related details

Attention is currently required from:
  • Alan Donovan
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: tools
Gerrit-Branch: master
Gerrit-Change-Id: Icd06e1321ea873dbd82f41b8a2e9da606ed35c80
Gerrit-Change-Number: 776882
Gerrit-PatchSet: 2
Gerrit-Owner: Hongxiang Jiang <hxj...@golang.org>
Gerrit-Reviewer: Alan Donovan <adon...@google.com>
Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
Gerrit-CC: Madeline Kalil <mka...@google.com>
Gerrit-Attention: Alan Donovan <adon...@google.com>
Gerrit-Comment-Date: Mon, 11 May 2026 20:27:49 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
unsatisfied_requirement
satisfied_requirement
open
diffy

Alan Donovan (Gerrit)

unread,
4:29 PM (6 hours ago) 4:29 PM
to Hongxiang Jiang, goph...@pubsubhelper.golang.org, golang...@luci-project-accounts.iam.gserviceaccount.com, Madeline Kalil, golang-co...@googlegroups.com
Attention needed from Hongxiang Jiang

Alan Donovan voted Code-Review+2

Code-Review+2
Open in Gerrit

Related details

Attention is currently required from:
  • Hongxiang Jiang
Submit Requirements:
  • requirement satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: tools
Gerrit-Branch: master
Gerrit-Change-Id: Icd06e1321ea873dbd82f41b8a2e9da606ed35c80
Gerrit-Change-Number: 776882
Gerrit-PatchSet: 2
Gerrit-Owner: Hongxiang Jiang <hxj...@golang.org>
Gerrit-Reviewer: Alan Donovan <adon...@google.com>
Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
Gerrit-CC: Madeline Kalil <mka...@google.com>
Gerrit-Attention: Hongxiang Jiang <hxj...@golang.org>
Gerrit-Comment-Date: Mon, 11 May 2026 20:29:07 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Hongxiang Jiang (Gerrit)

unread,
4:58 PM (6 hours ago) 4:58 PM
to goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, golang...@luci-project-accounts.iam.gserviceaccount.com, Alan Donovan, Madeline Kalil, golang-co...@googlegroups.com

Hongxiang Jiang submitted the change

Change information

Commit message:
gopls/internal/settings: move file watcher setting to user options

When a setting is internal options, they can be set by the user
but it is generally very hard to discover unless the user look at
the release note or the gopls's code base.

Moving from internal setting to user setting improves the
setting's discoverability.

For golang/go#67995
Change-Id: Icd06e1321ea873dbd82f41b8a2e9da606ed35c80
Auto-Submit: Hongxiang Jiang <hxj...@golang.org>
Reviewed-by: Alan Donovan <adon...@google.com>
Files:
  • M gopls/doc/settings.md
  • M gopls/internal/doc/api.json
  • M gopls/internal/settings/default.go
  • M gopls/internal/settings/settings.go
Change size: M
Delta: 4 files changed, 65 insertions(+), 12 deletions(-)
Branch: refs/heads/master
Submit Requirements:
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: tools
Gerrit-Branch: master
Gerrit-Change-Id: Icd06e1321ea873dbd82f41b8a2e9da606ed35c80
Gerrit-Change-Number: 776882
Gerrit-PatchSet: 3
Gerrit-Owner: Hongxiang Jiang <hxj...@golang.org>
Gerrit-Reviewer: Alan Donovan <adon...@google.com>
Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
open
diffy
satisfied_requirement

Hongxiang Jiang (Gerrit)

unread,
4:59 PM (6 hours ago) 4:59 PM
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Hongxiang Jiang has uploaded the change for review

Commit message

gopls/internal/settings: move file watcher setting to user options

When a setting is internal options, they can be set by the user
but it is generally very hard to discover unless the user look at
the release note or the gopls's code base.

Moving from internal setting to user setting improves the
setting's discoverability.

For golang/go#67995

Change-Id: Icd06e1321ea873dbd82f41b8a2e9da606ed35c80
Reviewed-on: https://go-review.googlesource.com/c/tools/+/776882
Auto-Submit: Hongxiang Jiang <hxj...@golang.org>
Reviewed-by: Alan Donovan <adon...@google.com>
LUCI-TryBot-Result: golang...@luci-project-accounts.iam.gserviceaccount.com <golang...@luci-project-accounts.iam.gserviceaccount.com>
(cherry picked from commit a3954b5c7496c91c1095bd368722a4e80d793f28)

Change diff

diff --git a/gopls/doc/settings.md b/gopls/doc/settings.md
index 44ab0e7..674813c 100644
--- a/gopls/doc/settings.md
+++ b/gopls/doc/settings.md
@@ -625,6 +625,29 @@

Default: `"all"`.

+<a id='fileWatcher'></a>
+### `fileWatcher enum`
+
+**This setting is experimental and may be deleted.**
+
+fileWatcher specifies the server-side file watching strategy used by gopls.
+
+By default, this is set to "off", meaning gopls relies exclusively on the
+language client (e.g., the editor) to send file change notifications.
+
+Available options:
+ - "off" : Client-driven watching (default)
+ - "fsnotify" : OS-level event notifications
+ - "poll" : Periodic directory scanning
+
+Must be one of:
+
+* `"fsnotify"`
+* `"off"`
+* `"poll"`
+
+Default: `"off"`.
+
<a id='maxFileCacheBytes'></a>
### `maxFileCacheBytes int64`

diff --git a/gopls/internal/doc/api.json b/gopls/internal/doc/api.json
index dbe3ce7..df5c2cd 100644
--- a/gopls/internal/doc/api.json
+++ b/gopls/internal/doc/api.json
@@ -2273,6 +2273,36 @@
"DeprecationMessage": ""
},
{
+ "Name": "fileWatcher",
+ "Type": "enum",
+ "Doc": "fileWatcher specifies the server-side file watching strategy used by gopls.\n\nBy default, this is set to \"off\", meaning gopls relies exclusively on the\nlanguage client (e.g., the editor) to send file change notifications.\n\nAvailable options:\n - \"off\" : Client-driven watching (default)\n - \"fsnotify\" : OS-level event notifications\n - \"poll\" : Periodic directory scanning\n",
+ "EnumKeys": {
+ "ValueType": "",
+ "Keys": null
+ },
+ "EnumValues": [
+ {
+ "Value": "\"fsnotify\"",
+ "Doc": "",
+ "Status": ""
+ },
+ {
+ "Value": "\"off\"",
+ "Doc": "",
+ "Status": ""
+ },
+ {
+ "Value": "\"poll\"",
+ "Doc": "",
+ "Status": ""
+ }
+ ],
+ "Default": "\"off\"",
+ "Status": "experimental",
+ "Hierarchy": "",
+ "DeprecationMessage": ""
+ },
+ {
"Name": "maxFileCacheBytes",
"Type": "int64",
"Doc": "maxFileCacheBytes sets a soft limit on the file cache size in bytes.\nIf zero, the default budget is used.\n\nThe cache may temporarily use more than this amount.\nAlso, this parameter limits file contents; disk block usage\nas measured by du(1) may be significantly higher.\n",

Change information

Files:
  • M gopls/doc/settings.md
  • M gopls/internal/doc/api.json
  • M gopls/internal/settings/default.go
  • M gopls/internal/settings/settings.go
Change size: M
Delta: 4 files changed, 65 insertions(+), 12 deletions(-)
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newchange
Gerrit-Project: tools
Gerrit-Branch: gopls-release-branch.0.22
Gerrit-Change-Id: Icd06e1321ea873dbd82f41b8a2e9da606ed35c80
Gerrit-Change-Number: 776981
unsatisfied_requirement
satisfied_requirement
open
diffy

Hongxiang Jiang (Gerrit)

unread,
5:02 PM (6 hours ago) 5:02 PM
to goph...@pubsubhelper.golang.org, Madeline Kalil, Alan Donovan, golang-co...@googlegroups.com
Attention needed from Alan Donovan and Madeline Kalil

Hongxiang Jiang voted

Auto-Submit+1
Commit-Queue+1
Open in Gerrit

Related details

Attention is currently required from:
  • Alan Donovan
  • Madeline Kalil
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: tools
Gerrit-Branch: gopls-release-branch.0.22
Gerrit-Change-Id: Icd06e1321ea873dbd82f41b8a2e9da606ed35c80
Gerrit-Change-Number: 776981
Gerrit-PatchSet: 2
Gerrit-Owner: Hongxiang Jiang <hxj...@golang.org>
Gerrit-Reviewer: Alan Donovan <adon...@google.com>
Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
Gerrit-Reviewer: Madeline Kalil <mka...@google.com>
Gerrit-Attention: Madeline Kalil <mka...@google.com>
Gerrit-Attention: Alan Donovan <adon...@google.com>
Gerrit-Comment-Date: Mon, 11 May 2026 21:02:16 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
unsatisfied_requirement
satisfied_requirement
open
diffy

Hongxiang Jiang (Gerrit)

unread,
5:06 PM (6 hours ago) 5:06 PM
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
Attention needed from Alan Donovan, Hongxiang Jiang and Madeline Kalil

Hongxiang Jiang uploaded new patchset

Hongxiang Jiang uploaded patch set #3 to this change.
Open in Gerrit

Related details

Attention is currently required from:
  • Alan Donovan
  • Hongxiang Jiang
  • Madeline Kalil
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newpatchset
Gerrit-Project: tools
Gerrit-Branch: gopls-release-branch.0.22
Gerrit-Change-Id: Icd06e1321ea873dbd82f41b8a2e9da606ed35c80
Gerrit-Change-Number: 776981
Gerrit-PatchSet: 3
Gerrit-Owner: Hongxiang Jiang <hxj...@golang.org>
Gerrit-Reviewer: Alan Donovan <adon...@google.com>
Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
Gerrit-Reviewer: Madeline Kalil <mka...@google.com>
Gerrit-Attention: Madeline Kalil <mka...@google.com>
Gerrit-Attention: Hongxiang Jiang <hxj...@golang.org>
Gerrit-Attention: Alan Donovan <adon...@google.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

Hongxiang Jiang (Gerrit)

unread,
5:06 PM (6 hours ago) 5:06 PM
to goph...@pubsubhelper.golang.org, golang...@luci-project-accounts.iam.gserviceaccount.com, Madeline Kalil, Alan Donovan, golang-co...@googlegroups.com
Attention needed from Alan Donovan and Madeline Kalil

Hongxiang Jiang voted

Auto-Submit+1
Commit-Queue+1
Open in Gerrit

Related details

Attention is currently required from:
  • Alan Donovan
  • Madeline Kalil
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: tools
Gerrit-Branch: gopls-release-branch.0.22
Gerrit-Change-Id: Icd06e1321ea873dbd82f41b8a2e9da606ed35c80
Gerrit-Change-Number: 776981
Gerrit-PatchSet: 4
Gerrit-Owner: Hongxiang Jiang <hxj...@golang.org>
Gerrit-Reviewer: Alan Donovan <adon...@google.com>
Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
Gerrit-Reviewer: Madeline Kalil <mka...@google.com>
Gerrit-Attention: Madeline Kalil <mka...@google.com>
Gerrit-Attention: Alan Donovan <adon...@google.com>
Gerrit-Comment-Date: Mon, 11 May 2026 21:06:50 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
unsatisfied_requirement
satisfied_requirement
open
diffy

Alan Donovan (Gerrit)

unread,
5:40 PM (5 hours ago) 5:40 PM
to Hongxiang Jiang, goph...@pubsubhelper.golang.org, golang...@luci-project-accounts.iam.gserviceaccount.com, Madeline Kalil, golang-co...@googlegroups.com
Attention needed from Hongxiang Jiang and Madeline Kalil

Alan Donovan voted

Auto-Submit+1
Code-Review+2
Commit-Queue+1
Open in Gerrit

Related details

Attention is currently required from:
  • Hongxiang Jiang
  • Madeline Kalil
Submit Requirements:
  • requirement satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement satisfiedReview-Enforcement
  • requirement satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: tools
Gerrit-Branch: gopls-release-branch.0.22
Gerrit-Change-Id: Icd06e1321ea873dbd82f41b8a2e9da606ed35c80
Gerrit-Change-Number: 776981
Gerrit-PatchSet: 4
Gerrit-Owner: Hongxiang Jiang <hxj...@golang.org>
Gerrit-Reviewer: Alan Donovan <adon...@google.com>
Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
Gerrit-Reviewer: Madeline Kalil <mka...@google.com>
Gerrit-Attention: Madeline Kalil <mka...@google.com>
Gerrit-Attention: Hongxiang Jiang <hxj...@golang.org>
Gerrit-Comment-Date: Mon, 11 May 2026 21:40:49 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy
Reply all
Reply to author
Forward
0 new messages