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
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.
//
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Auto-Submit | +1 |
| Commit-Queue | +1 |
FileWatcher FileWatcherMode `status:"experimental"`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`.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
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
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
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)
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",
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |