Skip to content

Commit f8786df

Browse files
committed
settings: prepend options with 'indexing'
1 parent f339103 commit f8786df

File tree

5 files changed

+16
-12
lines changed

5 files changed

+16
-12
lines changed

docs/SETTINGS.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ you can just add that folder to the workspace and it will be indexed as usual.
3737

3838
Deprecated in favour of `ignorePaths`
3939

40-
## `ignorePaths` (`[]string`)
40+
## `indexing.ignorePaths` (`[]string`)
4141

4242
Paths to ignore when indexing the workspace on initialization. This can serve
4343
as an escape hatch in large workspaces. Key side effect of ignoring a path
@@ -72,7 +72,11 @@ Or if left empty
7272
This setting should be deprecated once the language server supports multiple workspaces,
7373
as this arises in VS code because a server instance is started per VS Code workspace.
7474

75-
## `ignoreDirectoryNames` (`[]string`)
75+
## **DEPRECATED**: `ignoreDirectoryNames` (`[]string`)
76+
77+
Deprecated in favour of `indexing.ignoreDirectoryNames`
78+
79+
## `indexing.ignoreDirectoryNames` (`[]string`)
7680

7781
This allows excluding directories from being indexed upon initialization by passing a list of directory names.
7882

internal/langserver/handlers/initialize.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ func getTelemetryProperties(out *settings.DecodedOptions) map[string]interface{}
186186
properties["options.rootModulePaths"] = len(out.Options.XLegacyModulePaths) > 0
187187
properties["options.excludeModulePaths"] = len(out.Options.XLegacyExcludeModulePaths) > 0
188188
properties["options.commandPrefix"] = len(out.Options.CommandPrefix) > 0
189-
properties["options.ignoreDirectoryNames"] = len(out.Options.IgnoreDirectoryNames) > 0
190-
properties["options.ignorePaths"] = len(out.Options.IgnorePaths) > 0
189+
properties["options.indexing.ignoreDirectoryNames"] = len(out.Options.IgnoreDirectoryNames) > 0
190+
properties["options.indexing.ignorePaths"] = len(out.Options.IgnorePaths) > 0
191191
properties["options.experimentalFeatures.prefillRequiredFields"] = out.Options.ExperimentalFeatures.PrefillRequiredFields
192192
properties["options.experimentalFeatures.validateOnSave"] = out.Options.ExperimentalFeatures.ValidateOnSave
193193
properties["options.ignoreSingleFileWarning"] = out.Options.IgnoreSingleFileWarning
@@ -258,7 +258,7 @@ func (svc *service) setupWalker(ctx context.Context, params lsp.InitializeParams
258258
if len(options.XLegacyExcludeModulePaths) != 0 {
259259
jrpc2.ServerFromContext(ctx).Notify(ctx, "window/showMessage", &lsp.ShowMessageParams{
260260
Type: lsp.Warning,
261-
Message: fmt.Sprintf("excludeModulePaths (%q) is deprecated (no-op), use ignorePaths instead",
261+
Message: fmt.Sprintf("excludeModulePaths (%q) is deprecated (no-op), use indexing.ignorePaths instead",
262262
options.XLegacyExcludeModulePaths),
263263
})
264264
}

internal/langserver/handlers/initialize_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ func TestInitialize_ignoreDirectoryNames(t *testing.T) {
196196
"rootUri": %q,
197197
"processId": 12345,
198198
"initializationOptions": {
199-
"ignoreDirectoryNames": [%q]
199+
"indexing.ignoreDirectoryNames": [%q]
200200
}
201201
}`, tmpDir.URI, "ignore")})
202202
waitForWalkerPath(t, ss, wc, tmpDir)

internal/settings/settings.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ type ExperimentalFeatures struct {
1717

1818
type Options struct {
1919
CommandPrefix string `mapstructure:"commandPrefix"`
20-
IgnoreDirectoryNames []string `mapstructure:"ignoreDirectoryNames"`
21-
IgnorePaths []string `mapstructure:"ignorePaths"`
20+
IgnoreDirectoryNames []string `mapstructure:"indexing.ignoreDirectoryNames"`
21+
IgnorePaths []string `mapstructure:"indexing.ignorePaths"`
2222

2323
// ExperimentalFeatures encapsulates experimental features users can opt into.
2424
ExperimentalFeatures ExperimentalFeatures `mapstructure:"experimentalFeatures"`

internal/settings/settings_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func TestDecodeOptions_nil(t *testing.T) {
2323

2424
func TestDecodeOptions_wrongType(t *testing.T) {
2525
_, err := DecodeOptions(map[string]interface{}{
26-
"ignorePaths": "/random/path",
26+
"indexing.ignorePaths": "/random/path",
2727
})
2828
if err == nil {
2929
t.Fatal("expected decoding of wrong type to result in error")
@@ -32,7 +32,7 @@ func TestDecodeOptions_wrongType(t *testing.T) {
3232

3333
func TestDecodeOptions_success(t *testing.T) {
3434
out, err := DecodeOptions(map[string]interface{}{
35-
"ignorePaths": []string{"/random/path"},
35+
"indexing.ignorePaths": []string{"/random/path"},
3636
})
3737
if err != nil {
3838
t.Fatal(err)
@@ -55,7 +55,7 @@ func TestValidate_IgnoreDirectoryNames_error(t *testing.T) {
5555

5656
for _, table := range tables {
5757
out, err := DecodeOptions(map[string]interface{}{
58-
"ignoreDirectoryNames": []string{table.input},
58+
"indexing.ignoreDirectoryNames": []string{table.input},
5959
})
6060
if err != nil {
6161
t.Fatal(err)
@@ -69,7 +69,7 @@ func TestValidate_IgnoreDirectoryNames_error(t *testing.T) {
6969
}
7070
func TestValidate_IgnoreDirectoryNames_success(t *testing.T) {
7171
out, err := DecodeOptions(map[string]interface{}{
72-
"ignoreDirectoryNames": []string{"directory"},
72+
"indexing.ignoreDirectoryNames": []string{"directory"},
7373
})
7474
if err != nil {
7575
t.Fatal(err)

0 commit comments

Comments
 (0)