From 69ecbb10ab3d26bf16a60f22b30edefa80a54c20 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 2 Dec 2025 08:02:23 +0000 Subject: [PATCH 01/11] Always pass `-v` to `go generate` so it doesn't look like it's stuck. --- Herebyfile.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Herebyfile.mjs b/Herebyfile.mjs index b1b7e03b91..ffb41ed1cf 100644 --- a/Herebyfile.mjs +++ b/Herebyfile.mjs @@ -270,7 +270,7 @@ export const generate = task({ description: "Runs go generate on the project.", run: async () => { assertTypeScriptCloned(); - await $`go generate ./...`; + await $`go generate -v ./...`; }, }); From fb713d8bf07e5b12cd3a2461fdd323277381aaf9 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 2 Dec 2025 08:05:09 +0000 Subject: [PATCH 02/11] Initial support for `workspace/codeLens/refresh`. --- internal/lsp/server.go | 11 +++++ internal/project/client.go | 1 + internal/project/session.go | 21 +++++++++ .../projecttestutil/clientmock_generated.go | 45 +++++++++++++++++++ 4 files changed, 78 insertions(+) diff --git a/internal/lsp/server.go b/internal/lsp/server.go index e9e33669ad..189183ee96 100644 --- a/internal/lsp/server.go +++ b/internal/lsp/server.go @@ -246,6 +246,17 @@ func (s *Server) PublishDiagnostics(ctx context.Context, params *lsproto.Publish return nil } +func (s *Server) RefreshCodeLens(ctx context.Context) error { + if !s.clientCapabilities.Workspace.CodeLens.RefreshSupport { + return nil + } + + if _, err := sendClientRequest(ctx, s, lsproto.WorkspaceCodeLensRefreshInfo, nil); err != nil { + return fmt.Errorf("failed to refresh code lens: %w", err) + } + return nil +} + func (s *Server) RequestConfiguration(ctx context.Context) (*lsutil.UserPreferences, error) { caps := lsproto.GetClientCapabilities(ctx) if !caps.Workspace.Configuration { diff --git a/internal/project/client.go b/internal/project/client.go index 46b5393a05..3e871f31fa 100644 --- a/internal/project/client.go +++ b/internal/project/client.go @@ -11,4 +11,5 @@ type Client interface { UnwatchFiles(ctx context.Context, id WatcherID) error RefreshDiagnostics(ctx context.Context) error PublishDiagnostics(ctx context.Context, params *lsproto.PublishDiagnosticsParams) error + RefreshCodeLens(ctx context.Context) error } diff --git a/internal/project/session.go b/internal/project/session.go index 5c5a2c96bb..344896040a 100644 --- a/internal/project/session.go +++ b/internal/project/session.go @@ -211,7 +211,14 @@ func (s *Session) Configure(userPreferences *lsutil.UserPreferences) { s.configRWMu.Lock() defer s.configRWMu.Unlock() s.pendingConfigChanges = true + + // Inform the client to re-request certain commands + // depending on user preference changes. + oldUserPreferences := s.userPreferences s.userPreferences = userPreferences + if oldUserPreferences != userPreferences && oldUserPreferences != nil && userPreferences != nil { + s.refreshCodeLensIfNeeded(oldUserPreferences, userPreferences) + } } func (s *Session) InitializeWithConfig(userPreferences *lsutil.UserPreferences) { @@ -788,6 +795,20 @@ func (s *Session) NpmInstall(cwd string, npmInstallArgs []string) ([]byte, error return s.npmExecutor.NpmInstall(cwd, npmInstallArgs) } +func (s *Session) refreshCodeLensIfNeeded(oldPrefs *lsutil.UserPreferences, newPrefs *lsutil.UserPreferences) { + prefsDiffer := oldPrefs.ImplementationsCodeLensEnabled != newPrefs.ImplementationsCodeLensEnabled || + oldPrefs.ImplementationsCodeLensShowOnAllClassMethods != newPrefs.ImplementationsCodeLensShowOnAllClassMethods || + oldPrefs.ImplementationsCodeLensShowOnInterfaceMethods != newPrefs.ImplementationsCodeLensShowOnInterfaceMethods || + oldPrefs.ReferencesCodeLensEnabled != newPrefs.ReferencesCodeLensEnabled || + oldPrefs.ReferencesCodeLensShowOnAllFunctions != newPrefs.ReferencesCodeLensShowOnAllFunctions + + if prefsDiffer { + if err := s.client.RefreshCodeLens(context.Background()); err != nil && s.options.LoggingEnabled { + s.logger.Logf("Error refreshing code lens: %v", err) + } + } +} + func (s *Session) publishProgramDiagnostics(oldSnapshot *Snapshot, newSnapshot *Snapshot) { if !s.options.PushDiagnosticsEnabled { return diff --git a/internal/testutil/projecttestutil/clientmock_generated.go b/internal/testutil/projecttestutil/clientmock_generated.go index 2c310ceb13..7c864e5c78 100644 --- a/internal/testutil/projecttestutil/clientmock_generated.go +++ b/internal/testutil/projecttestutil/clientmock_generated.go @@ -24,6 +24,9 @@ var _ project.Client = &ClientMock{} // PublishDiagnosticsFunc: func(ctx context.Context, params *lsproto.PublishDiagnosticsParams) error { // panic("mock out the PublishDiagnostics method") // }, +// RefreshCodeLensFunc: func(ctx context.Context) error { +// panic("mock out the RefreshCodeLens method") +// }, // RefreshDiagnosticsFunc: func(ctx context.Context) error { // panic("mock out the RefreshDiagnostics method") // }, @@ -43,6 +46,9 @@ type ClientMock struct { // PublishDiagnosticsFunc mocks the PublishDiagnostics method. PublishDiagnosticsFunc func(ctx context.Context, params *lsproto.PublishDiagnosticsParams) error + // RefreshCodeLensFunc mocks the RefreshCodeLens method. + RefreshCodeLensFunc func(ctx context.Context) error + // RefreshDiagnosticsFunc mocks the RefreshDiagnostics method. RefreshDiagnosticsFunc func(ctx context.Context) error @@ -61,6 +67,11 @@ type ClientMock struct { // Params is the params argument value. Params *lsproto.PublishDiagnosticsParams } + // RefreshCodeLens holds details about calls to the RefreshCodeLens method. + RefreshCodeLens []struct { + // Ctx is the ctx argument value. + Ctx context.Context + } // RefreshDiagnostics holds details about calls to the RefreshDiagnostics method. RefreshDiagnostics []struct { // Ctx is the ctx argument value. @@ -84,6 +95,7 @@ type ClientMock struct { } } lockPublishDiagnostics sync.RWMutex + lockRefreshCodeLens sync.RWMutex lockRefreshDiagnostics sync.RWMutex lockUnwatchFiles sync.RWMutex lockWatchFiles sync.RWMutex @@ -126,6 +138,39 @@ func (mock *ClientMock) PublishDiagnosticsCalls() []struct { return calls } +// RefreshCodeLens calls RefreshCodeLensFunc. +func (mock *ClientMock) RefreshCodeLens(ctx context.Context) error { + callInfo := struct { + Ctx context.Context + }{ + Ctx: ctx, + } + mock.lockRefreshCodeLens.Lock() + mock.calls.RefreshCodeLens = append(mock.calls.RefreshCodeLens, callInfo) + mock.lockRefreshCodeLens.Unlock() + if mock.RefreshCodeLensFunc == nil { + var errOut error + return errOut + } + return mock.RefreshCodeLensFunc(ctx) +} + +// RefreshCodeLensCalls gets all the calls that were made to RefreshCodeLens. +// Check the length with: +// +// len(mockedClient.RefreshCodeLensCalls()) +func (mock *ClientMock) RefreshCodeLensCalls() []struct { + Ctx context.Context +} { + var calls []struct { + Ctx context.Context + } + mock.lockRefreshCodeLens.RLock() + calls = mock.calls.RefreshCodeLens + mock.lockRefreshCodeLens.RUnlock() + return calls +} + // RefreshDiagnostics calls RefreshDiagnosticsFunc. func (mock *ClientMock) RefreshDiagnostics(ctx context.Context) error { callInfo := struct { From 3d44a2d3666248888e9951c1183973932a976c7f Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 2 Dec 2025 18:15:59 +0000 Subject: [PATCH 03/11] Move all code lens user preferences into an embedded struct. --- internal/ls/lsutil/userpreferences.go | 22 +++++++++++++--------- internal/project/session.go | 8 +------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/internal/ls/lsutil/userpreferences.go b/internal/ls/lsutil/userpreferences.go index 9b9a7eb4a1..9971f4c563 100644 --- a/internal/ls/lsutil/userpreferences.go +++ b/internal/ls/lsutil/userpreferences.go @@ -147,11 +147,7 @@ type UserPreferences struct { // ------- CodeLens ------- - ReferencesCodeLensEnabled bool - ImplementationsCodeLensEnabled bool - ReferencesCodeLensShowOnAllFunctions bool - ImplementationsCodeLensShowOnInterfaceMethods bool - ImplementationsCodeLensShowOnAllClassMethods bool + CodeLensUserPreferences // ------- Symbols ------- @@ -165,6 +161,14 @@ type UserPreferences struct { ReportStyleChecksAsWarnings bool // !!! If this changes, we need to ask the client to recompute diagnostics } +type CodeLensUserPreferences struct { + ReferencesCodeLensEnabled bool + ImplementationsCodeLensEnabled bool + ReferencesCodeLensShowOnAllFunctions bool + ImplementationsCodeLensShowOnInterfaceMethods bool + ImplementationsCodeLensShowOnAllClassMethods bool +} + type JsxAttributeCompletionStyle string const ( @@ -702,12 +706,12 @@ func (p *UserPreferences) set(name string, value any) { case "referencescodelensenabled": p.ReferencesCodeLensEnabled = parseBoolWithDefault(value, false) case "implementationscodelensenabled": - p.ImplementationsCodeLensEnabled = parseBoolWithDefault(value, false) + p.ImplementationsEnabled = parseBoolWithDefault(value, false) case "referencescodelensshowonallfunctions": - p.ReferencesCodeLensShowOnAllFunctions = parseBoolWithDefault(value, false) + p.ReferencesShowOnAllFunctions = parseBoolWithDefault(value, false) case "implementationscodelensshowoninterfacemethods": - p.ImplementationsCodeLensShowOnInterfaceMethods = parseBoolWithDefault(value, false) + p.ImplementationsShowOnInterfaceMethods = parseBoolWithDefault(value, false) case "implementationscodelensshowonallclassmethods": - p.ImplementationsCodeLensShowOnAllClassMethods = parseBoolWithDefault(value, false) + p.ImplementationsShowOnAllClassMethods = parseBoolWithDefault(value, false) } } diff --git a/internal/project/session.go b/internal/project/session.go index 344896040a..257b41345d 100644 --- a/internal/project/session.go +++ b/internal/project/session.go @@ -796,13 +796,7 @@ func (s *Session) NpmInstall(cwd string, npmInstallArgs []string) ([]byte, error } func (s *Session) refreshCodeLensIfNeeded(oldPrefs *lsutil.UserPreferences, newPrefs *lsutil.UserPreferences) { - prefsDiffer := oldPrefs.ImplementationsCodeLensEnabled != newPrefs.ImplementationsCodeLensEnabled || - oldPrefs.ImplementationsCodeLensShowOnAllClassMethods != newPrefs.ImplementationsCodeLensShowOnAllClassMethods || - oldPrefs.ImplementationsCodeLensShowOnInterfaceMethods != newPrefs.ImplementationsCodeLensShowOnInterfaceMethods || - oldPrefs.ReferencesCodeLensEnabled != newPrefs.ReferencesCodeLensEnabled || - oldPrefs.ReferencesCodeLensShowOnAllFunctions != newPrefs.ReferencesCodeLensShowOnAllFunctions - - if prefsDiffer { + if oldPrefs.CodeLensUserPreferences != newPrefs.CodeLensUserPreferences { if err := s.client.RefreshCodeLens(context.Background()); err != nil && s.options.LoggingEnabled { s.logger.Logf("Error refreshing code lens: %v", err) } From b8857290dc66abe534b4375ee18ae2046e613d1a Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 2 Dec 2025 18:16:55 +0000 Subject: [PATCH 04/11] oops --- internal/ls/lsutil/userpreferences.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/ls/lsutil/userpreferences.go b/internal/ls/lsutil/userpreferences.go index 9971f4c563..e969cf86e2 100644 --- a/internal/ls/lsutil/userpreferences.go +++ b/internal/ls/lsutil/userpreferences.go @@ -706,12 +706,12 @@ func (p *UserPreferences) set(name string, value any) { case "referencescodelensenabled": p.ReferencesCodeLensEnabled = parseBoolWithDefault(value, false) case "implementationscodelensenabled": - p.ImplementationsEnabled = parseBoolWithDefault(value, false) + p.ImplementationsCodeLensEnabled = parseBoolWithDefault(value, false) case "referencescodelensshowonallfunctions": - p.ReferencesShowOnAllFunctions = parseBoolWithDefault(value, false) + p.ReferencesCodeLensShowOnAllFunctions = parseBoolWithDefault(value, false) case "implementationscodelensshowoninterfacemethods": - p.ImplementationsShowOnInterfaceMethods = parseBoolWithDefault(value, false) + p.ImplementationsCodeLensShowOnInterfaceMethods = parseBoolWithDefault(value, false) case "implementationscodelensshowonallclassmethods": - p.ImplementationsShowOnAllClassMethods = parseBoolWithDefault(value, false) + p.ImplementationsCodeLensShowOnAllClassMethods = parseBoolWithDefault(value, false) } } From 932dbd49245b7b2ef36e9fa4c203fd2b55125f65 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 2 Dec 2025 21:59:46 +0000 Subject: [PATCH 05/11] Move from embedding to explicit property. --- .../tests/codeLensFunctionExpressions01_test.go | 14 ++++++++------ .../tests/codeLensFunctionsAndConstants01_test.go | 14 ++++++++------ .../fourslash/tests/codeLensInterface01_test.go | 14 ++++++++------ .../fourslash/tests/codeLensOverloads01_test.go | 14 ++++++++------ .../tests/codeLensShowOnAllClassMethods_test.go | 6 ++++-- .../tests/codeLensShowOnAllFunctions_test.go | 6 ++++-- .../tests/codeLensShowOnInterfaceMethods_test.go | 6 ++++-- internal/ls/codelens.go | 6 +++--- internal/ls/lsutil/userpreferences.go | 12 ++++++------ internal/project/session.go | 2 +- 10 files changed, 54 insertions(+), 40 deletions(-) diff --git a/internal/fourslash/tests/codeLensFunctionExpressions01_test.go b/internal/fourslash/tests/codeLensFunctionExpressions01_test.go index 92768014ad..0b5f06d848 100644 --- a/internal/fourslash/tests/codeLensFunctionExpressions01_test.go +++ b/internal/fourslash/tests/codeLensFunctionExpressions01_test.go @@ -43,11 +43,13 @@ const namedFn4 = function namedFn4() {}; ` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) f.VerifyBaselineCodeLens(t, &lsutil.UserPreferences{ - ReferencesCodeLensEnabled: true, - ReferencesCodeLensShowOnAllFunctions: true, - - ImplementationsCodeLensEnabled: true, - ImplementationsCodeLensShowOnInterfaceMethods: true, - ImplementationsCodeLensShowOnAllClassMethods: true, + CodeLens: lsutil.CodeLensUserPreferences{ + ReferencesCodeLensEnabled: true, + ReferencesCodeLensShowOnAllFunctions: true, + + ImplementationsCodeLensEnabled: true, + ImplementationsCodeLensShowOnInterfaceMethods: true, + ImplementationsCodeLensShowOnAllClassMethods: true, + }, }) } diff --git a/internal/fourslash/tests/codeLensFunctionsAndConstants01_test.go b/internal/fourslash/tests/codeLensFunctionsAndConstants01_test.go index bad700760e..ef47d9f66f 100644 --- a/internal/fourslash/tests/codeLensFunctionsAndConstants01_test.go +++ b/internal/fourslash/tests/codeLensFunctionsAndConstants01_test.go @@ -40,11 +40,13 @@ console.log(bar); ` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) f.VerifyBaselineCodeLens(t, &lsutil.UserPreferences{ - ReferencesCodeLensEnabled: true, - ReferencesCodeLensShowOnAllFunctions: true, - - ImplementationsCodeLensEnabled: true, - ImplementationsCodeLensShowOnInterfaceMethods: true, - ImplementationsCodeLensShowOnAllClassMethods: true, + CodeLens: lsutil.CodeLensUserPreferences{ + ReferencesCodeLensEnabled: true, + ReferencesCodeLensShowOnAllFunctions: true, + + ImplementationsCodeLensEnabled: true, + ImplementationsCodeLensShowOnInterfaceMethods: true, + ImplementationsCodeLensShowOnAllClassMethods: true, + }, }) } diff --git a/internal/fourslash/tests/codeLensInterface01_test.go b/internal/fourslash/tests/codeLensInterface01_test.go index a1e9a42368..cb63e580a3 100644 --- a/internal/fourslash/tests/codeLensInterface01_test.go +++ b/internal/fourslash/tests/codeLensInterface01_test.go @@ -49,11 +49,13 @@ const p: Pointable = { ` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) f.VerifyBaselineCodeLens(t, &lsutil.UserPreferences{ - ReferencesCodeLensEnabled: true, - ReferencesCodeLensShowOnAllFunctions: true, - - ImplementationsCodeLensEnabled: true, - ImplementationsCodeLensShowOnInterfaceMethods: true, - ImplementationsCodeLensShowOnAllClassMethods: true, + CodeLens: lsutil.CodeLensUserPreferences{ + ReferencesCodeLensEnabled: true, + ReferencesCodeLensShowOnAllFunctions: true, + + ImplementationsCodeLensEnabled: true, + ImplementationsCodeLensShowOnInterfaceMethods: true, + ImplementationsCodeLensShowOnAllClassMethods: true, + }, }) } diff --git a/internal/fourslash/tests/codeLensOverloads01_test.go b/internal/fourslash/tests/codeLensOverloads01_test.go index 02e863c30e..9250124fb0 100644 --- a/internal/fourslash/tests/codeLensOverloads01_test.go +++ b/internal/fourslash/tests/codeLensOverloads01_test.go @@ -29,11 +29,13 @@ foo(Math.random() ? 1 : "hello"); ` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) f.VerifyBaselineCodeLens(t, &lsutil.UserPreferences{ - ReferencesCodeLensEnabled: true, - ReferencesCodeLensShowOnAllFunctions: true, - - ImplementationsCodeLensEnabled: true, - ImplementationsCodeLensShowOnInterfaceMethods: true, - ImplementationsCodeLensShowOnAllClassMethods: true, + CodeLens: lsutil.CodeLensUserPreferences{ + ReferencesCodeLensEnabled: true, + ReferencesCodeLensShowOnAllFunctions: true, + + ImplementationsCodeLensEnabled: true, + ImplementationsCodeLensShowOnInterfaceMethods: true, + ImplementationsCodeLensShowOnAllClassMethods: true, + }, }) } diff --git a/internal/fourslash/tests/codeLensShowOnAllClassMethods_test.go b/internal/fourslash/tests/codeLensShowOnAllClassMethods_test.go index 9683168764..08f25cc7f5 100644 --- a/internal/fourslash/tests/codeLensShowOnAllClassMethods_test.go +++ b/internal/fourslash/tests/codeLensShowOnAllClassMethods_test.go @@ -35,8 +35,10 @@ export abstract class ABC { ` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) f.VerifyBaselineCodeLens(t, &lsutil.UserPreferences{ - ImplementationsCodeLensEnabled: true, - ImplementationsCodeLensShowOnAllClassMethods: value, + CodeLens: lsutil.CodeLensUserPreferences{ + ImplementationsCodeLensEnabled: true, + ImplementationsCodeLensShowOnAllClassMethods: value, + }, }) }) } diff --git a/internal/fourslash/tests/codeLensShowOnAllFunctions_test.go b/internal/fourslash/tests/codeLensShowOnAllFunctions_test.go index a394b59ad9..180ed458f9 100644 --- a/internal/fourslash/tests/codeLensShowOnAllFunctions_test.go +++ b/internal/fourslash/tests/codeLensShowOnAllFunctions_test.go @@ -30,8 +30,10 @@ const f5 = function() {}; ` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) f.VerifyBaselineCodeLens(t, &lsutil.UserPreferences{ - ReferencesCodeLensEnabled: true, - ReferencesCodeLensShowOnAllFunctions: value, + CodeLens: lsutil.CodeLensUserPreferences{ + ReferencesCodeLensEnabled: true, + ReferencesCodeLensShowOnAllFunctions: value, + }, }) }) } diff --git a/internal/fourslash/tests/codeLensShowOnInterfaceMethods_test.go b/internal/fourslash/tests/codeLensShowOnInterfaceMethods_test.go index 289456a6e4..e89dce322a 100644 --- a/internal/fourslash/tests/codeLensShowOnInterfaceMethods_test.go +++ b/internal/fourslash/tests/codeLensShowOnInterfaceMethods_test.go @@ -44,8 +44,10 @@ class AbstractC implements J { ` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) f.VerifyBaselineCodeLens(t, &lsutil.UserPreferences{ - ImplementationsCodeLensEnabled: true, - ImplementationsCodeLensShowOnInterfaceMethods: value, + CodeLens: lsutil.CodeLensUserPreferences{ + ImplementationsCodeLensEnabled: true, + ImplementationsCodeLensShowOnInterfaceMethods: value, + }, }) }) } diff --git a/internal/ls/codelens.go b/internal/ls/codelens.go index 83d81d8da1..0e93e41cb8 100644 --- a/internal/ls/codelens.go +++ b/internal/ls/codelens.go @@ -15,7 +15,7 @@ import ( func (l *LanguageService) ProvideCodeLenses(ctx context.Context, documentURI lsproto.DocumentUri) (lsproto.CodeLensResponse, error) { _, file := l.getProgramAndFile(documentURI) - userPrefs := l.UserPreferences() + userPrefs := &l.UserPreferences().CodeLens if !userPrefs.ReferencesCodeLensEnabled && !userPrefs.ImplementationsCodeLensEnabled { return lsproto.CodeLensResponse{}, nil } @@ -172,7 +172,7 @@ func (l *LanguageService) newCodeLensForNode(fileUri lsproto.DocumentUri, file * } } -func isValidImplementationsCodeLensNode(node *ast.Node, userPrefs *lsutil.UserPreferences) bool { +func isValidImplementationsCodeLensNode(node *ast.Node, userPrefs *lsutil.CodeLensUserPreferences) bool { switch node.Kind { // Always show on interfaces case ast.KindInterfaceDeclaration: @@ -199,7 +199,7 @@ func isValidImplementationsCodeLensNode(node *ast.Node, userPrefs *lsutil.UserPr return false } -func isValidReferenceLensNode(node *ast.Node, userPrefs *lsutil.UserPreferences) bool { +func isValidReferenceLensNode(node *ast.Node, userPrefs *lsutil.CodeLensUserPreferences) bool { switch node.Kind { case ast.KindFunctionDeclaration: if userPrefs.ReferencesCodeLensShowOnAllFunctions { diff --git a/internal/ls/lsutil/userpreferences.go b/internal/ls/lsutil/userpreferences.go index e969cf86e2..cce6368547 100644 --- a/internal/ls/lsutil/userpreferences.go +++ b/internal/ls/lsutil/userpreferences.go @@ -147,7 +147,7 @@ type UserPreferences struct { // ------- CodeLens ------- - CodeLensUserPreferences + CodeLens CodeLensUserPreferences // ------- Symbols ------- @@ -704,14 +704,14 @@ func (p *UserPreferences) set(name string, value any) { case "reportstylechecksaswarnings": p.ReportStyleChecksAsWarnings = parseBoolWithDefault(value, true) case "referencescodelensenabled": - p.ReferencesCodeLensEnabled = parseBoolWithDefault(value, false) + p.CodeLens.ReferencesCodeLensEnabled = parseBoolWithDefault(value, false) case "implementationscodelensenabled": - p.ImplementationsCodeLensEnabled = parseBoolWithDefault(value, false) + p.CodeLens.ImplementationsCodeLensEnabled = parseBoolWithDefault(value, false) case "referencescodelensshowonallfunctions": - p.ReferencesCodeLensShowOnAllFunctions = parseBoolWithDefault(value, false) + p.CodeLens.ReferencesCodeLensShowOnAllFunctions = parseBoolWithDefault(value, false) case "implementationscodelensshowoninterfacemethods": - p.ImplementationsCodeLensShowOnInterfaceMethods = parseBoolWithDefault(value, false) + p.CodeLens.ImplementationsCodeLensShowOnInterfaceMethods = parseBoolWithDefault(value, false) case "implementationscodelensshowonallclassmethods": - p.ImplementationsCodeLensShowOnAllClassMethods = parseBoolWithDefault(value, false) + p.CodeLens.ImplementationsCodeLensShowOnAllClassMethods = parseBoolWithDefault(value, false) } } diff --git a/internal/project/session.go b/internal/project/session.go index 257b41345d..b3300ff896 100644 --- a/internal/project/session.go +++ b/internal/project/session.go @@ -796,7 +796,7 @@ func (s *Session) NpmInstall(cwd string, npmInstallArgs []string) ([]byte, error } func (s *Session) refreshCodeLensIfNeeded(oldPrefs *lsutil.UserPreferences, newPrefs *lsutil.UserPreferences) { - if oldPrefs.CodeLensUserPreferences != newPrefs.CodeLensUserPreferences { + if oldPrefs.CodeLens != newPrefs.CodeLens { if err := s.client.RefreshCodeLens(context.Background()); err != nil && s.options.LoggingEnabled { s.logger.Logf("Error refreshing code lens: %v", err) } From 862f3ae5d5feeb2a835a0ac75c263e2aed9c15bb Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 2 Dec 2025 22:16:00 +0000 Subject: [PATCH 06/11] Move inlay hints preferences into struct. --- internal/ls/inlay_hints.go | 12 +++---- internal/ls/lsutil/userpreferences.go | 50 +++++++++++++++------------ 2 files changed, 33 insertions(+), 29 deletions(-) diff --git a/internal/ls/inlay_hints.go b/internal/ls/inlay_hints.go index 215752091e..1de411522c 100644 --- a/internal/ls/inlay_hints.go +++ b/internal/ls/inlay_hints.go @@ -25,7 +25,7 @@ func (l *LanguageService) ProvideInlayHint( ctx context.Context, params *lsproto.InlayHintParams, ) (lsproto.InlayHintResponse, error) { - if !isAnyInlayHintEnabled(l.UserPreferences()) { + if !isAnyInlayHintEnabled(&l.UserPreferences().InlayHints) { return lsproto.InlayHintsOrNull{InlayHints: nil}, nil } program, file := l.getProgramAndFile(params.TextDocument.Uri) @@ -36,7 +36,7 @@ func (l *LanguageService) ProvideInlayHint( inlayHintState := &inlayHintState{ ctx: ctx, span: l.converters.FromLSPRange(file, params.Range), - preferences: l.UserPreferences(), + preferences: &l.UserPreferences().InlayHints, quotePreference: quotePreference, file: file, checker: checker, @@ -49,7 +49,7 @@ func (l *LanguageService) ProvideInlayHint( type inlayHintState struct { ctx context.Context span core.TextRange - preferences *lsutil.UserPreferences + preferences *lsutil.InlayHintsPreferences quotePreference quotePreference file *ast.SourceFile checker *checker.Checker @@ -366,12 +366,12 @@ func (s *inlayHintState) addParameterHints(text string, parameter *ast.Identifie }) } -func shouldShowParameterNameHints(preferences *lsutil.UserPreferences) bool { +func shouldShowParameterNameHints(preferences *lsutil.InlayHintsPreferences) bool { return (preferences.IncludeInlayParameterNameHints == lsutil.IncludeInlayParameterNameHintsLiterals || preferences.IncludeInlayParameterNameHints == lsutil.IncludeInlayParameterNameHintsAll) } -func shouldShowLiteralParameterNameHintsOnly(preferences *lsutil.UserPreferences) bool { +func shouldShowLiteralParameterNameHintsOnly(preferences *lsutil.InlayHintsPreferences) bool { return preferences.IncludeInlayParameterNameHints == lsutil.IncludeInlayParameterNameHintsLiterals } @@ -896,7 +896,7 @@ func (s *inlayHintState) getTypeAnnotationPosition(decl *ast.FunctionLikeDeclara return decl.ParameterList().End() } -func isAnyInlayHintEnabled(preferences *lsutil.UserPreferences) bool { +func isAnyInlayHintEnabled(preferences *lsutil.InlayHintsPreferences) bool { return preferences.IncludeInlayParameterNameHints != lsutil.IncludeInlayParameterNameHintsNone || preferences.IncludeInlayFunctionParameterTypeHints || preferences.IncludeInlayVariableTypeHints || diff --git a/internal/ls/lsutil/userpreferences.go b/internal/ls/lsutil/userpreferences.go index cce6368547..d3df2600ba 100644 --- a/internal/ls/lsutil/userpreferences.go +++ b/internal/ls/lsutil/userpreferences.go @@ -136,14 +136,7 @@ type UserPreferences struct { // ------- InlayHints ------- - IncludeInlayParameterNameHints IncludeInlayParameterNameHints - IncludeInlayParameterNameHintsWhenArgumentMatchesName bool - IncludeInlayFunctionParameterTypeHints bool - IncludeInlayVariableTypeHints bool - IncludeInlayVariableTypeHintsWhenTypeMatchesName bool - IncludeInlayPropertyDeclarationTypeHints bool - IncludeInlayFunctionLikeReturnTypeHints bool - IncludeInlayEnumMemberValueHints bool + InlayHints InlayHintsPreferences // ------- CodeLens ------- @@ -161,6 +154,17 @@ type UserPreferences struct { ReportStyleChecksAsWarnings bool // !!! If this changes, we need to ask the client to recompute diagnostics } +type InlayHintsPreferences struct { + IncludeInlayParameterNameHints IncludeInlayParameterNameHints + IncludeInlayParameterNameHintsWhenArgumentMatchesName bool + IncludeInlayFunctionParameterTypeHints bool + IncludeInlayVariableTypeHints bool + IncludeInlayVariableTypeHintsWhenTypeMatchesName bool + IncludeInlayPropertyDeclarationTypeHints bool + IncludeInlayFunctionLikeReturnTypeHints bool + IncludeInlayEnumMemberValueHints bool +} + type CodeLensUserPreferences struct { ReferencesCodeLensEnabled bool ImplementationsCodeLensEnabled bool @@ -440,18 +444,18 @@ func (p *UserPreferences) parseInlayHints(prefs any) { if enabled, ok := v["enabled"]; ok { p.set("includeInlayParameterNameHints", enabled) } - p.IncludeInlayParameterNameHintsWhenArgumentMatchesName = parseSupress(v, "supressWhenArgumentMatchesName") + p.InlayHints.IncludeInlayParameterNameHintsWhenArgumentMatchesName = parseSupress(v, "supressWhenArgumentMatchesName") case "parameterTypes": - p.IncludeInlayFunctionParameterTypeHints = parseEnabledBool(v) + p.InlayHints.IncludeInlayFunctionParameterTypeHints = parseEnabledBool(v) case "variableTypes": - p.IncludeInlayVariableTypeHints = parseEnabledBool(v) - p.IncludeInlayVariableTypeHintsWhenTypeMatchesName = parseSupress(v, "supressWhenTypeMatchesName") + p.InlayHints.IncludeInlayVariableTypeHints = parseEnabledBool(v) + p.InlayHints.IncludeInlayVariableTypeHintsWhenTypeMatchesName = parseSupress(v, "supressWhenTypeMatchesName") case "propertyDeclarationTypes": - p.IncludeInlayPropertyDeclarationTypeHints = parseEnabledBool(v) + p.InlayHints.IncludeInlayPropertyDeclarationTypeHints = parseEnabledBool(v) case "functionLikeReturnTypes": - p.IncludeInlayFunctionLikeReturnTypeHints = parseEnabledBool(v) + p.InlayHints.IncludeInlayFunctionLikeReturnTypeHints = parseEnabledBool(v) case "enumMemberValues": - p.IncludeInlayEnumMemberValueHints = parseEnabledBool(v) + p.InlayHints.IncludeInlayEnumMemberValueHints = parseEnabledBool(v) } } else { // non-vscode case @@ -678,21 +682,21 @@ func (p *UserPreferences) set(name string, value any) { case "providerefactornotapplicablereason": p.ProvideRefactorNotApplicableReason = parseBoolWithDefault(value, true) case "includeinlayparameternamehints": - p.IncludeInlayParameterNameHints = parseInlayParameterNameHints(value) + p.InlayHints.IncludeInlayParameterNameHints = parseInlayParameterNameHints(value) case "includeinlayparameternamehintswhenargumentmatchesname": - p.IncludeInlayParameterNameHintsWhenArgumentMatchesName = parseBoolWithDefault(value, false) + p.InlayHints.IncludeInlayParameterNameHintsWhenArgumentMatchesName = parseBoolWithDefault(value, false) case "includeinlayfunctionparametertypeHints": - p.IncludeInlayFunctionParameterTypeHints = parseBoolWithDefault(value, false) + p.InlayHints.IncludeInlayFunctionParameterTypeHints = parseBoolWithDefault(value, false) case "includeinlayvariabletypehints": - p.IncludeInlayVariableTypeHints = parseBoolWithDefault(value, false) + p.InlayHints.IncludeInlayVariableTypeHints = parseBoolWithDefault(value, false) case "includeinlayvariabletypehintswhentypematchesname": - p.IncludeInlayVariableTypeHintsWhenTypeMatchesName = parseBoolWithDefault(value, false) + p.InlayHints.IncludeInlayVariableTypeHintsWhenTypeMatchesName = parseBoolWithDefault(value, false) case "includeinlaypropertydeclarationtypehints": - p.IncludeInlayPropertyDeclarationTypeHints = parseBoolWithDefault(value, false) + p.InlayHints.IncludeInlayPropertyDeclarationTypeHints = parseBoolWithDefault(value, false) case "includeinlayfunctionlikereturntypehints": - p.IncludeInlayFunctionLikeReturnTypeHints = parseBoolWithDefault(value, false) + p.InlayHints.IncludeInlayFunctionLikeReturnTypeHints = parseBoolWithDefault(value, false) case "includeinlayenummembervaluehints": - p.IncludeInlayEnumMemberValueHints = parseBoolWithDefault(value, false) + p.InlayHints.IncludeInlayEnumMemberValueHints = parseBoolWithDefault(value, false) case "excludelibrarysymbolsinnavto": p.ExcludeLibrarySymbolsInNavTo = parseBoolWithDefault(value, true) case "disablesuggestions": From 74ab2cc4068236d0c67097b60969866224e0225e Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 2 Dec 2025 22:16:19 +0000 Subject: [PATCH 07/11] Update fourslash tests. --- .../fourslash/_scripts/convertFourslash.mts | 21 ++++++++++++------- .../tests/gen/inlayHintsCrash1_test.go | 2 +- .../gen/inlayHintsEnumMemberValue_test.go | 2 +- .../inlayHintsFunctionParameterTypes1_test.go | 2 +- .../inlayHintsFunctionParameterTypes2_test.go | 2 +- .../inlayHintsFunctionParameterTypes3_test.go | 2 +- .../inlayHintsFunctionParameterTypes4_test.go | 2 +- .../inlayHintsFunctionParameterTypes5_test.go | 2 +- .../tests/gen/inlayHintsImportType1_test.go | 2 +- .../tests/gen/inlayHintsImportType2_test.go | 2 +- .../inlayHintsInferredTypePredicate1_test.go | 2 +- ...inlayHintsInteractiveAnyParameter1_test.go | 2 +- ...inlayHintsInteractiveAnyParameter2_test.go | 2 +- ...InteractiveFunctionParameterTypes1_test.go | 2 +- ...InteractiveFunctionParameterTypes2_test.go | 2 +- ...InteractiveFunctionParameterTypes3_test.go | 2 +- ...InteractiveFunctionParameterTypes4_test.go | 2 +- ...InteractiveFunctionParameterTypes5_test.go | 2 +- .../inlayHintsInteractiveImportType1_test.go | 2 +- .../inlayHintsInteractiveImportType2_test.go | 2 +- ...sInteractiveInferredTypePredicate1_test.go | 2 +- ...intsInteractiveJsDocParameterNames_test.go | 2 +- .../inlayHintsInteractiveMultifile1_test.go | 2 +- ...sInteractiveMultifileFunctionCalls_test.go | 2 +- .../inlayHintsInteractiveOverloadCall_test.go | 2 +- ...eractiveParameterNamesWithComments_test.go | 2 +- ...nlayHintsInteractiveParameterNames_test.go | 2 +- ...layHintsInteractiveRestParameters1_test.go | 2 +- ...layHintsInteractiveRestParameters2_test.go | 2 +- ...layHintsInteractiveRestParameters3_test.go | 2 +- .../inlayHintsInteractiveReturnType_test.go | 2 +- ...ntsInteractiveTemplateLiteralTypes_test.go | 2 +- ...nlayHintsInteractiveVariableTypes1_test.go | 2 +- ...nlayHintsInteractiveVariableTypes2_test.go | 2 +- .../inlayHintsInteractiveWithClosures_test.go | 2 +- .../gen/inlayHintsJsDocParameterNames_test.go | 2 +- .../tests/gen/inlayHintsMultifile1_test.go | 2 +- ...HintsNoHintWhenArgumentMatchesName_test.go | 2 +- .../gen/inlayHintsNoParameterHints_test.go | 2 +- .../gen/inlayHintsNoVariableTypeHints_test.go | 2 +- .../tests/gen/inlayHintsOverloadCall1_test.go | 2 +- .../tests/gen/inlayHintsOverloadCall2_test.go | 2 +- .../gen/inlayHintsParameterNames_test.go | 2 +- .../inlayHintsPropertyDeclarations2_test.go | 2 +- .../inlayHintsPropertyDeclarations_test.go | 2 +- .../gen/inlayHintsQuotePreference1_test.go | 2 +- .../gen/inlayHintsQuotePreference2_test.go | 2 +- .../gen/inlayHintsRestParameters1_test.go | 2 +- .../gen/inlayHintsRestParameters2_test.go | 2 +- .../tests/gen/inlayHintsReturnType_test.go | 2 +- .../tests/gen/inlayHintsThisParameter_test.go | 2 +- .../gen/inlayHintsTypeMatchesName_test.go | 2 +- .../gen/inlayHintsVariableTypes1_test.go | 2 +- .../gen/inlayHintsVariableTypes2_test.go | 2 +- .../gen/inlayHintsVariableTypes3_test.go | 2 +- .../tests/gen/inlayHintsWithClosures_test.go | 2 +- .../tests/inlayHintsTupleTypeCrash_test.go | 4 +++- ...tsInteractiveParameterNamesInSpan1_test.go | 6 +++++- ...tsInteractiveParameterNamesInSpan2_test.go | 6 +++++- 59 files changed, 81 insertions(+), 66 deletions(-) diff --git a/internal/fourslash/_scripts/convertFourslash.mts b/internal/fourslash/_scripts/convertFourslash.mts index 61b789df13..265923f0af 100644 --- a/internal/fourslash/_scripts/convertFourslash.mts +++ b/internal/fourslash/_scripts/convertFourslash.mts @@ -1396,6 +1396,7 @@ function stringToTristate(s: string): string { } function parseUserPreferences(arg: ts.ObjectLiteralExpression): string | undefined { + const inlayHintPreferences: string[] = []; const preferences: string[] = []; for (const prop of arg.properties) { if (ts.isPropertyAssignment(prop)) { @@ -1438,28 +1439,28 @@ function parseUserPreferences(arg: ts.ObjectLiteralExpression): string | undefin paramHint = "lsutil.IncludeInlayParameterNameHintsAll"; break; } - preferences.push(`IncludeInlayParameterNameHints: ${paramHint}`); + inlayHintPreferences.push(`IncludeInlayParameterNameHints: ${paramHint}`); break; case "includeInlayParameterNameHintsWhenArgumentMatchesName": - preferences.push(`IncludeInlayParameterNameHintsWhenArgumentMatchesName: ${prop.initializer.getText()}`); + inlayHintPreferences.push(`IncludeInlayParameterNameHintsWhenArgumentMatchesName: ${prop.initializer.getText()}`); break; case "includeInlayFunctionParameterTypeHints": - preferences.push(`IncludeInlayFunctionParameterTypeHints: ${prop.initializer.getText()}`); + inlayHintPreferences.push(`IncludeInlayFunctionParameterTypeHints: ${prop.initializer.getText()}`); break; case "includeInlayVariableTypeHints": - preferences.push(`IncludeInlayVariableTypeHints: ${prop.initializer.getText()}`); + inlayHintPreferences.push(`IncludeInlayVariableTypeHints: ${prop.initializer.getText()}`); break; case "includeInlayVariableTypeHintsWhenTypeMatchesName": - preferences.push(`IncludeInlayVariableTypeHintsWhenTypeMatchesName: ${prop.initializer.getText()}`); + inlayHintPreferences.push(`IncludeInlayVariableTypeHintsWhenTypeMatchesName: ${prop.initializer.getText()}`); break; case "includeInlayPropertyDeclarationTypeHints": - preferences.push(`IncludeInlayPropertyDeclarationTypeHints: ${prop.initializer.getText()}`); + inlayHintPreferences.push(`IncludeInlayPropertyDeclarationTypeHints: ${prop.initializer.getText()}`); break; case "includeInlayFunctionLikeReturnTypeHints": - preferences.push(`IncludeInlayFunctionLikeReturnTypeHints: ${prop.initializer.getText()}`); + inlayHintPreferences.push(`IncludeInlayFunctionLikeReturnTypeHints: ${prop.initializer.getText()}`); break; case "includeInlayEnumMemberValueHints": - preferences.push(`IncludeInlayEnumMemberValueHints: ${prop.initializer.getText()}`); + inlayHintPreferences.push(`IncludeInlayEnumMemberValueHints: ${prop.initializer.getText()}`); break; case "interactiveInlayHints": // Ignore, deprecated @@ -1470,6 +1471,10 @@ function parseUserPreferences(arg: ts.ObjectLiteralExpression): string | undefin return undefined; } } + + if (inlayHintPreferences.length > 0) { + preferences.push(`InlayHints: lsutil.InlayHintsPreferences{${inlayHintPreferences.join(",")}}`); + } if (preferences.length === 0) { return "nil /*preferences*/"; } diff --git a/internal/fourslash/tests/gen/inlayHintsCrash1_test.go b/internal/fourslash/tests/gen/inlayHintsCrash1_test.go index 4539986ea0..d75bfcb610 100644 --- a/internal/fourslash/tests/gen/inlayHintsCrash1_test.go +++ b/internal/fourslash/tests/gen/inlayHintsCrash1_test.go @@ -22,5 +22,5 @@ function doThing(f) { f(100) }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayVariableTypeHints: true, IncludeInlayParameterNameHints: lsutil.IncludeInlayParameterNameHintsAll}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayVariableTypeHints: true, IncludeInlayParameterNameHints: lsutil.IncludeInlayParameterNameHintsAll}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsEnumMemberValue_test.go b/internal/fourslash/tests/gen/inlayHintsEnumMemberValue_test.go index 56f297f84a..1a268a6d5b 100644 --- a/internal/fourslash/tests/gen/inlayHintsEnumMemberValue_test.go +++ b/internal/fourslash/tests/gen/inlayHintsEnumMemberValue_test.go @@ -20,5 +20,5 @@ func TestInlayHintsEnumMemberValue(t *testing.T) { C = 'C', }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayEnumMemberValueHints: true}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayEnumMemberValueHints: true}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsFunctionParameterTypes1_test.go b/internal/fourslash/tests/gen/inlayHintsFunctionParameterTypes1_test.go index e6ad86f45e..d16337fb37 100644 --- a/internal/fourslash/tests/gen/inlayHintsFunctionParameterTypes1_test.go +++ b/internal/fourslash/tests/gen/inlayHintsFunctionParameterTypes1_test.go @@ -31,5 +31,5 @@ type F2 = (a: { }) => void const foo5: F2 = (a) => { }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayFunctionParameterTypeHints: true}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayFunctionParameterTypeHints: true}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsFunctionParameterTypes2_test.go b/internal/fourslash/tests/gen/inlayHintsFunctionParameterTypes2_test.go index 9470f6a255..a1e1512964 100644 --- a/internal/fourslash/tests/gen/inlayHintsFunctionParameterTypes2_test.go +++ b/internal/fourslash/tests/gen/inlayHintsFunctionParameterTypes2_test.go @@ -28,5 +28,5 @@ function f10(a = ((((new C()))))) {} function f11(a = { a: 1, b: 1 }) {} function f12(a = ((({ a: 1, b: 1 })))) {}` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayFunctionParameterTypeHints: true}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayFunctionParameterTypeHints: true}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsFunctionParameterTypes3_test.go b/internal/fourslash/tests/gen/inlayHintsFunctionParameterTypes3_test.go index 20925b00f0..3a82746979 100644 --- a/internal/fourslash/tests/gen/inlayHintsFunctionParameterTypes3_test.go +++ b/internal/fourslash/tests/gen/inlayHintsFunctionParameterTypes3_test.go @@ -27,5 +27,5 @@ class Foo { set foo(value) { this.#value = value; } }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayFunctionParameterTypeHints: true}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayFunctionParameterTypeHints: true}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsFunctionParameterTypes4_test.go b/internal/fourslash/tests/gen/inlayHintsFunctionParameterTypes4_test.go index 785aed0b31..7aadcb5247 100644 --- a/internal/fourslash/tests/gen/inlayHintsFunctionParameterTypes4_test.go +++ b/internal/fourslash/tests/gen/inlayHintsFunctionParameterTypes4_test.go @@ -24,5 +24,5 @@ class Foo { set foo(value) { this.#value = value; } }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayFunctionParameterTypeHints: true}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayFunctionParameterTypeHints: true}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsFunctionParameterTypes5_test.go b/internal/fourslash/tests/gen/inlayHintsFunctionParameterTypes5_test.go index a04873dd05..89cb257cb0 100644 --- a/internal/fourslash/tests/gen/inlayHintsFunctionParameterTypes5_test.go +++ b/internal/fourslash/tests/gen/inlayHintsFunctionParameterTypes5_test.go @@ -20,5 +20,5 @@ declare function test( test((state) => {});` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayFunctionParameterTypeHints: true}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayFunctionParameterTypeHints: true}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsImportType1_test.go b/internal/fourslash/tests/gen/inlayHintsImportType1_test.go index 4fd1af5a85..eaacea8b9e 100644 --- a/internal/fourslash/tests/gen/inlayHintsImportType1_test.go +++ b/internal/fourslash/tests/gen/inlayHintsImportType1_test.go @@ -20,5 +20,5 @@ module.exports.a = 1 const a = require('./a');` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) f.GoToFile(t, "/b.js") - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayVariableTypeHints: true}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayVariableTypeHints: true}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsImportType2_test.go b/internal/fourslash/tests/gen/inlayHintsImportType2_test.go index c11a2af3de..2f49ed7d99 100644 --- a/internal/fourslash/tests/gen/inlayHintsImportType2_test.go +++ b/internal/fourslash/tests/gen/inlayHintsImportType2_test.go @@ -23,5 +23,5 @@ const c = foo() const d = bar()` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) f.GoToFile(t, "/b.js") - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayVariableTypeHints: true, IncludeInlayFunctionLikeReturnTypeHints: true}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayVariableTypeHints: true, IncludeInlayFunctionLikeReturnTypeHints: true}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsInferredTypePredicate1_test.go b/internal/fourslash/tests/gen/inlayHintsInferredTypePredicate1_test.go index cd7c9209ef..e6d78c59db 100644 --- a/internal/fourslash/tests/gen/inlayHintsInferredTypePredicate1_test.go +++ b/internal/fourslash/tests/gen/inlayHintsInferredTypePredicate1_test.go @@ -17,5 +17,5 @@ function test(x: unknown) { return typeof x === 'number'; }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayFunctionLikeReturnTypeHints: true}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayFunctionLikeReturnTypeHints: true}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsInteractiveAnyParameter1_test.go b/internal/fourslash/tests/gen/inlayHintsInteractiveAnyParameter1_test.go index b2e6ca94e2..0a1017ac28 100644 --- a/internal/fourslash/tests/gen/inlayHintsInteractiveAnyParameter1_test.go +++ b/internal/fourslash/tests/gen/inlayHintsInteractiveAnyParameter1_test.go @@ -20,5 +20,5 @@ foo(foo); foo((1)); foo(foo(1));` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayParameterNameHints: lsutil.IncludeInlayParameterNameHintsLiterals}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayParameterNameHints: lsutil.IncludeInlayParameterNameHintsLiterals}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsInteractiveAnyParameter2_test.go b/internal/fourslash/tests/gen/inlayHintsInteractiveAnyParameter2_test.go index 4a639146a6..16e18f578d 100644 --- a/internal/fourslash/tests/gen/inlayHintsInteractiveAnyParameter2_test.go +++ b/internal/fourslash/tests/gen/inlayHintsInteractiveAnyParameter2_test.go @@ -26,5 +26,5 @@ foo(foo); foo((1)); foo(foo(1));` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayParameterNameHints: lsutil.IncludeInlayParameterNameHintsAll}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayParameterNameHints: lsutil.IncludeInlayParameterNameHintsAll}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsInteractiveFunctionParameterTypes1_test.go b/internal/fourslash/tests/gen/inlayHintsInteractiveFunctionParameterTypes1_test.go index 2d9d3d24ee..a151bb219a 100644 --- a/internal/fourslash/tests/gen/inlayHintsInteractiveFunctionParameterTypes1_test.go +++ b/internal/fourslash/tests/gen/inlayHintsInteractiveFunctionParameterTypes1_test.go @@ -50,5 +50,5 @@ foo4(p => {}) }) => void const foo5: F4 = (a) => { }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayFunctionParameterTypeHints: true}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayFunctionParameterTypeHints: true}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsInteractiveFunctionParameterTypes2_test.go b/internal/fourslash/tests/gen/inlayHintsInteractiveFunctionParameterTypes2_test.go index 0ae5484a04..f14b13a002 100644 --- a/internal/fourslash/tests/gen/inlayHintsInteractiveFunctionParameterTypes2_test.go +++ b/internal/fourslash/tests/gen/inlayHintsInteractiveFunctionParameterTypes2_test.go @@ -28,5 +28,5 @@ function f10(a = ((((new C()))))) {} function f11(a = { a: 1, b: 1 }) {} function f12(a = ((({ a: 1, b: 1 })))) {}` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayFunctionParameterTypeHints: true}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayFunctionParameterTypeHints: true}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsInteractiveFunctionParameterTypes3_test.go b/internal/fourslash/tests/gen/inlayHintsInteractiveFunctionParameterTypes3_test.go index d0fe2a46bf..c5d20930ca 100644 --- a/internal/fourslash/tests/gen/inlayHintsInteractiveFunctionParameterTypes3_test.go +++ b/internal/fourslash/tests/gen/inlayHintsInteractiveFunctionParameterTypes3_test.go @@ -27,5 +27,5 @@ class Foo { set foo(value) { this.#value = value; } }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayFunctionParameterTypeHints: true}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayFunctionParameterTypeHints: true}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsInteractiveFunctionParameterTypes4_test.go b/internal/fourslash/tests/gen/inlayHintsInteractiveFunctionParameterTypes4_test.go index 72325aa707..b725ef3ce1 100644 --- a/internal/fourslash/tests/gen/inlayHintsInteractiveFunctionParameterTypes4_test.go +++ b/internal/fourslash/tests/gen/inlayHintsInteractiveFunctionParameterTypes4_test.go @@ -24,5 +24,5 @@ class Foo { set foo(value) { this.#value = value; } }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayFunctionParameterTypeHints: true}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayFunctionParameterTypeHints: true}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsInteractiveFunctionParameterTypes5_test.go b/internal/fourslash/tests/gen/inlayHintsInteractiveFunctionParameterTypes5_test.go index ec542d8918..c0db41d9de 100644 --- a/internal/fourslash/tests/gen/inlayHintsInteractiveFunctionParameterTypes5_test.go +++ b/internal/fourslash/tests/gen/inlayHintsInteractiveFunctionParameterTypes5_test.go @@ -15,5 +15,5 @@ func TestInlayHintsInteractiveFunctionParameterTypes5(t *testing.T) { const content = `const foo: 1n = 1n; export function fn(b = foo) {}` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayFunctionParameterTypeHints: true}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayFunctionParameterTypeHints: true}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsInteractiveImportType1_test.go b/internal/fourslash/tests/gen/inlayHintsInteractiveImportType1_test.go index bfdcec6dbc..ffb8280ad3 100644 --- a/internal/fourslash/tests/gen/inlayHintsInteractiveImportType1_test.go +++ b/internal/fourslash/tests/gen/inlayHintsInteractiveImportType1_test.go @@ -20,5 +20,5 @@ module.exports.a = 1 const a = require('./a');` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) f.GoToFile(t, "/b.js") - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayVariableTypeHints: true}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayVariableTypeHints: true}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsInteractiveImportType2_test.go b/internal/fourslash/tests/gen/inlayHintsInteractiveImportType2_test.go index 70ec8d1911..9deb5c257d 100644 --- a/internal/fourslash/tests/gen/inlayHintsInteractiveImportType2_test.go +++ b/internal/fourslash/tests/gen/inlayHintsInteractiveImportType2_test.go @@ -23,5 +23,5 @@ const c = foo() const d = bar()` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) f.GoToFile(t, "/b.js") - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayVariableTypeHints: true, IncludeInlayFunctionLikeReturnTypeHints: true}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayVariableTypeHints: true, IncludeInlayFunctionLikeReturnTypeHints: true}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsInteractiveInferredTypePredicate1_test.go b/internal/fourslash/tests/gen/inlayHintsInteractiveInferredTypePredicate1_test.go index 34623d1070..e649cb27f0 100644 --- a/internal/fourslash/tests/gen/inlayHintsInteractiveInferredTypePredicate1_test.go +++ b/internal/fourslash/tests/gen/inlayHintsInteractiveInferredTypePredicate1_test.go @@ -17,5 +17,5 @@ function test(x: unknown) { return typeof x === 'number'; }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayFunctionLikeReturnTypeHints: true}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayFunctionLikeReturnTypeHints: true}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsInteractiveJsDocParameterNames_test.go b/internal/fourslash/tests/gen/inlayHintsInteractiveJsDocParameterNames_test.go index 09dba6947c..827c890a1e 100644 --- a/internal/fourslash/tests/gen/inlayHintsInteractiveJsDocParameterNames_test.go +++ b/internal/fourslash/tests/gen/inlayHintsInteractiveJsDocParameterNames_test.go @@ -28,5 +28,5 @@ y.foo(1, 2) var z = ""` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) f.GoToFile(t, "/a.js") - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayParameterNameHints: lsutil.IncludeInlayParameterNameHintsLiterals}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayParameterNameHints: lsutil.IncludeInlayParameterNameHintsLiterals}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsInteractiveMultifile1_test.go b/internal/fourslash/tests/gen/inlayHintsInteractiveMultifile1_test.go index 80bef58e2e..4f9412ffe7 100644 --- a/internal/fourslash/tests/gen/inlayHintsInteractiveMultifile1_test.go +++ b/internal/fourslash/tests/gen/inlayHintsInteractiveMultifile1_test.go @@ -25,5 +25,5 @@ async function main () { }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) f.GoToFile(t, "/b.ts") - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayVariableTypeHints: true, IncludeInlayFunctionLikeReturnTypeHints: true}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayVariableTypeHints: true, IncludeInlayFunctionLikeReturnTypeHints: true}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsInteractiveMultifileFunctionCalls_test.go b/internal/fourslash/tests/gen/inlayHintsInteractiveMultifileFunctionCalls_test.go index 0d3bd01c0f..bb286a7755 100644 --- a/internal/fourslash/tests/gen/inlayHintsInteractiveMultifileFunctionCalls_test.go +++ b/internal/fourslash/tests/gen/inlayHintsInteractiveMultifileFunctionCalls_test.go @@ -26,5 +26,5 @@ export function helperB(bParam: string) { export function helperC(cParam: string) {}` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) f.GoToFile(t, "./aaa.mts") - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayParameterNameHints: lsutil.IncludeInlayParameterNameHintsAll}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayParameterNameHints: lsutil.IncludeInlayParameterNameHintsAll}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsInteractiveOverloadCall_test.go b/internal/fourslash/tests/gen/inlayHintsInteractiveOverloadCall_test.go index 9fcb7cf42f..3a62871366 100644 --- a/internal/fourslash/tests/gen/inlayHintsInteractiveOverloadCall_test.go +++ b/internal/fourslash/tests/gen/inlayHintsInteractiveOverloadCall_test.go @@ -34,5 +34,5 @@ class Class { new Class(1) new Class(1, 2)` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayParameterNameHints: lsutil.IncludeInlayParameterNameHintsLiterals}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayParameterNameHints: lsutil.IncludeInlayParameterNameHintsLiterals}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsInteractiveParameterNamesWithComments_test.go b/internal/fourslash/tests/gen/inlayHintsInteractiveParameterNamesWithComments_test.go index 3d66eda391..481c5470cd 100644 --- a/internal/fourslash/tests/gen/inlayHintsInteractiveParameterNamesWithComments_test.go +++ b/internal/fourslash/tests/gen/inlayHintsInteractiveParameterNamesWithComments_test.go @@ -44,5 +44,5 @@ foo( 3 )` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayParameterNameHints: lsutil.IncludeInlayParameterNameHintsLiterals}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayParameterNameHints: lsutil.IncludeInlayParameterNameHintsLiterals}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsInteractiveParameterNames_test.go b/internal/fourslash/tests/gen/inlayHintsInteractiveParameterNames_test.go index 37dd18ab80..449239cbc1 100644 --- a/internal/fourslash/tests/gen/inlayHintsInteractiveParameterNames_test.go +++ b/internal/fourslash/tests/gen/inlayHintsInteractiveParameterNames_test.go @@ -52,5 +52,5 @@ function trace(message: string) {} trace(` + "`" + `${1}` + "`" + `); trace(` + "`" + `` + "`" + `);` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayParameterNameHints: lsutil.IncludeInlayParameterNameHintsLiterals}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayParameterNameHints: lsutil.IncludeInlayParameterNameHintsLiterals}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsInteractiveRestParameters1_test.go b/internal/fourslash/tests/gen/inlayHintsInteractiveRestParameters1_test.go index ee1b93b715..dad9a7d935 100644 --- a/internal/fourslash/tests/gen/inlayHintsInteractiveRestParameters1_test.go +++ b/internal/fourslash/tests/gen/inlayHintsInteractiveRestParameters1_test.go @@ -21,5 +21,5 @@ type Args3 = [number, number] declare function foo3(c: number, ...args: Args3); foo3(1, 2, 3)` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayParameterNameHints: lsutil.IncludeInlayParameterNameHintsLiterals}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayParameterNameHints: lsutil.IncludeInlayParameterNameHintsLiterals}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsInteractiveRestParameters2_test.go b/internal/fourslash/tests/gen/inlayHintsInteractiveRestParameters2_test.go index 7f5fa36d05..cf95165089 100644 --- a/internal/fourslash/tests/gen/inlayHintsInteractiveRestParameters2_test.go +++ b/internal/fourslash/tests/gen/inlayHintsInteractiveRestParameters2_test.go @@ -29,5 +29,5 @@ function foo5(...x: [number, number]) { foo(...x, 3); }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayParameterNameHints: lsutil.IncludeInlayParameterNameHintsAll}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayParameterNameHints: lsutil.IncludeInlayParameterNameHintsAll}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsInteractiveRestParameters3_test.go b/internal/fourslash/tests/gen/inlayHintsInteractiveRestParameters3_test.go index 66c1fad9d5..d3f0e51fb0 100644 --- a/internal/fourslash/tests/gen/inlayHintsInteractiveRestParameters3_test.go +++ b/internal/fourslash/tests/gen/inlayHintsInteractiveRestParameters3_test.go @@ -18,5 +18,5 @@ func TestInlayHintsInteractiveRestParameters3(t *testing.T) { const foo: [x: number, y: number] = [1, 2]; fn(...foo, 3, 4);` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayParameterNameHints: lsutil.IncludeInlayParameterNameHintsAll}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayParameterNameHints: lsutil.IncludeInlayParameterNameHintsAll}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsInteractiveReturnType_test.go b/internal/fourslash/tests/gen/inlayHintsInteractiveReturnType_test.go index e7888fdf63..50d042afb9 100644 --- a/internal/fourslash/tests/gen/inlayHintsInteractiveReturnType_test.go +++ b/internal/fourslash/tests/gen/inlayHintsInteractiveReturnType_test.go @@ -31,5 +31,5 @@ const b = function () { return 1 } const c = (b) => 1 const d = b => 1` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayFunctionLikeReturnTypeHints: true}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayFunctionLikeReturnTypeHints: true}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsInteractiveTemplateLiteralTypes_test.go b/internal/fourslash/tests/gen/inlayHintsInteractiveTemplateLiteralTypes_test.go index 5c0876565d..67548d4ad5 100644 --- a/internal/fourslash/tests/gen/inlayHintsInteractiveTemplateLiteralTypes_test.go +++ b/internal/fourslash/tests/gen/inlayHintsInteractiveTemplateLiteralTypes_test.go @@ -21,5 +21,5 @@ const lit3 = getTemplateLiteral3(); declare function getTemplateLiteral4(): ` + "`" + `${string}\` + "`" + `,${string}` + "`" + `; const lit4 = getTemplateLiteral4();` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayVariableTypeHints: true}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayVariableTypeHints: true}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsInteractiveVariableTypes1_test.go b/internal/fourslash/tests/gen/inlayHintsInteractiveVariableTypes1_test.go index 82d4c72f45..c5cb1d5d3e 100644 --- a/internal/fourslash/tests/gen/inlayHintsInteractiveVariableTypes1_test.go +++ b/internal/fourslash/tests/gen/inlayHintsInteractiveVariableTypes1_test.go @@ -33,5 +33,5 @@ const l = ((({ a: 1, b: 1 }))); const p = ([a]: Foo[]) => a; const q = ({ a }: { a: Foo }) => a;` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayVariableTypeHints: true}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayVariableTypeHints: true}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsInteractiveVariableTypes2_test.go b/internal/fourslash/tests/gen/inlayHintsInteractiveVariableTypes2_test.go index f6c2ad29fa..dc476e66b4 100644 --- a/internal/fourslash/tests/gen/inlayHintsInteractiveVariableTypes2_test.go +++ b/internal/fourslash/tests/gen/inlayHintsInteractiveVariableTypes2_test.go @@ -23,5 +23,5 @@ const [] = array; declare function foo(t: T): T const x = foo(1)` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayVariableTypeHints: true}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayVariableTypeHints: true}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsInteractiveWithClosures_test.go b/internal/fourslash/tests/gen/inlayHintsInteractiveWithClosures_test.go index 4c30b7ece0..782b69e08e 100644 --- a/internal/fourslash/tests/gen/inlayHintsInteractiveWithClosures_test.go +++ b/internal/fourslash/tests/gen/inlayHintsInteractiveWithClosures_test.go @@ -23,5 +23,5 @@ function foo2(a: (b: number) => number) { } foo2((c: number) => c + 1);` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayParameterNameHints: lsutil.IncludeInlayParameterNameHintsAll}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayParameterNameHints: lsutil.IncludeInlayParameterNameHintsAll}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsJsDocParameterNames_test.go b/internal/fourslash/tests/gen/inlayHintsJsDocParameterNames_test.go index 99b090429b..695fa231c5 100644 --- a/internal/fourslash/tests/gen/inlayHintsJsDocParameterNames_test.go +++ b/internal/fourslash/tests/gen/inlayHintsJsDocParameterNames_test.go @@ -28,5 +28,5 @@ y.foo(1, 2) var z = ""` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) f.GoToFile(t, "/a.js") - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayParameterNameHints: lsutil.IncludeInlayParameterNameHintsLiterals}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayParameterNameHints: lsutil.IncludeInlayParameterNameHintsLiterals}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsMultifile1_test.go b/internal/fourslash/tests/gen/inlayHintsMultifile1_test.go index 20572e2fe0..bf5a4431c3 100644 --- a/internal/fourslash/tests/gen/inlayHintsMultifile1_test.go +++ b/internal/fourslash/tests/gen/inlayHintsMultifile1_test.go @@ -25,5 +25,5 @@ async function main () { }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) f.GoToFile(t, "/b.ts") - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayVariableTypeHints: true, IncludeInlayFunctionLikeReturnTypeHints: true}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayVariableTypeHints: true, IncludeInlayFunctionLikeReturnTypeHints: true}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsNoHintWhenArgumentMatchesName_test.go b/internal/fourslash/tests/gen/inlayHintsNoHintWhenArgumentMatchesName_test.go index 4e27a0ff68..4117d138bf 100644 --- a/internal/fourslash/tests/gen/inlayHintsNoHintWhenArgumentMatchesName_test.go +++ b/internal/fourslash/tests/gen/inlayHintsNoHintWhenArgumentMatchesName_test.go @@ -20,5 +20,5 @@ foo(v.a, v.a); foo(v.b, v.b); foo(v.c, v.c);` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayParameterNameHints: lsutil.IncludeInlayParameterNameHintsAll, IncludeInlayParameterNameHintsWhenArgumentMatchesName: false}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayParameterNameHints: lsutil.IncludeInlayParameterNameHintsAll, IncludeInlayParameterNameHintsWhenArgumentMatchesName: false}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsNoParameterHints_test.go b/internal/fourslash/tests/gen/inlayHintsNoParameterHints_test.go index 1386c3f367..049df535e7 100644 --- a/internal/fourslash/tests/gen/inlayHintsNoParameterHints_test.go +++ b/internal/fourslash/tests/gen/inlayHintsNoParameterHints_test.go @@ -15,5 +15,5 @@ func TestInlayHintsNoParameterHints(t *testing.T) { const content = `function foo (a: number, b: number) {} foo(1, 2);` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayParameterNameHints: lsutil.IncludeInlayParameterNameHintsNone}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayParameterNameHints: lsutil.IncludeInlayParameterNameHintsNone}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsNoVariableTypeHints_test.go b/internal/fourslash/tests/gen/inlayHintsNoVariableTypeHints_test.go index cb7481017f..ba60a2e1d3 100644 --- a/internal/fourslash/tests/gen/inlayHintsNoVariableTypeHints_test.go +++ b/internal/fourslash/tests/gen/inlayHintsNoVariableTypeHints_test.go @@ -14,5 +14,5 @@ func TestInlayHintsNoVariableTypeHints(t *testing.T) { defer testutil.RecoverAndFail(t, "Panic on fourslash test") const content = `const a = 123;` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayVariableTypeHints: false}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayVariableTypeHints: false}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsOverloadCall1_test.go b/internal/fourslash/tests/gen/inlayHintsOverloadCall1_test.go index 8bf12f3ea0..2a9ffbc8c7 100644 --- a/internal/fourslash/tests/gen/inlayHintsOverloadCall1_test.go +++ b/internal/fourslash/tests/gen/inlayHintsOverloadCall1_test.go @@ -34,5 +34,5 @@ class Class { new Class(1) new Class(1, 2)` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayParameterNameHints: lsutil.IncludeInlayParameterNameHintsLiterals}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayParameterNameHints: lsutil.IncludeInlayParameterNameHintsLiterals}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsOverloadCall2_test.go b/internal/fourslash/tests/gen/inlayHintsOverloadCall2_test.go index 1010a69ec5..6cd7806242 100644 --- a/internal/fourslash/tests/gen/inlayHintsOverloadCall2_test.go +++ b/internal/fourslash/tests/gen/inlayHintsOverloadCall2_test.go @@ -30,5 +30,5 @@ func( }, );` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayParameterNameHints: lsutil.IncludeInlayParameterNameHintsAll}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayParameterNameHints: lsutil.IncludeInlayParameterNameHintsAll}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsParameterNames_test.go b/internal/fourslash/tests/gen/inlayHintsParameterNames_test.go index 57956f7d37..ceb9a42e53 100644 --- a/internal/fourslash/tests/gen/inlayHintsParameterNames_test.go +++ b/internal/fourslash/tests/gen/inlayHintsParameterNames_test.go @@ -65,5 +65,5 @@ func( true, )` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayParameterNameHints: lsutil.IncludeInlayParameterNameHintsLiterals}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayParameterNameHints: lsutil.IncludeInlayParameterNameHintsLiterals}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsPropertyDeclarations2_test.go b/internal/fourslash/tests/gen/inlayHintsPropertyDeclarations2_test.go index aae68cc833..8328adec88 100644 --- a/internal/fourslash/tests/gen/inlayHintsPropertyDeclarations2_test.go +++ b/internal/fourslash/tests/gen/inlayHintsPropertyDeclarations2_test.go @@ -28,5 +28,5 @@ class C { } }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayPropertyDeclarationTypeHints: true}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayPropertyDeclarationTypeHints: true}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsPropertyDeclarations_test.go b/internal/fourslash/tests/gen/inlayHintsPropertyDeclarations_test.go index 74563d31cc..3702e6cce0 100644 --- a/internal/fourslash/tests/gen/inlayHintsPropertyDeclarations_test.go +++ b/internal/fourslash/tests/gen/inlayHintsPropertyDeclarations_test.go @@ -27,5 +27,5 @@ class C { } }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayPropertyDeclarationTypeHints: true}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayPropertyDeclarationTypeHints: true}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsQuotePreference1_test.go b/internal/fourslash/tests/gen/inlayHintsQuotePreference1_test.go index dadb6cd887..0d26abca79 100644 --- a/internal/fourslash/tests/gen/inlayHintsQuotePreference1_test.go +++ b/internal/fourslash/tests/gen/inlayHintsQuotePreference1_test.go @@ -16,5 +16,5 @@ func TestInlayHintsQuotePreference1(t *testing.T) { const b1: '\\' = '\\'; export function fn(a = a1, b = b1) {}` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayFunctionParameterTypeHints: true, QuotePreference: lsutil.QuotePreference("double")}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{QuotePreference: lsutil.QuotePreference("double"), InlayHints: lsutil.InlayHintsPreferences{IncludeInlayFunctionParameterTypeHints: true}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsQuotePreference2_test.go b/internal/fourslash/tests/gen/inlayHintsQuotePreference2_test.go index 79a16194a2..43f09ea87b 100644 --- a/internal/fourslash/tests/gen/inlayHintsQuotePreference2_test.go +++ b/internal/fourslash/tests/gen/inlayHintsQuotePreference2_test.go @@ -16,5 +16,5 @@ func TestInlayHintsQuotePreference2(t *testing.T) { const b1: "\\" = "\\"; export function fn(a = a1, b = b1) {}` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayFunctionParameterTypeHints: true, QuotePreference: lsutil.QuotePreference("single")}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{QuotePreference: lsutil.QuotePreference("single"), InlayHints: lsutil.InlayHintsPreferences{IncludeInlayFunctionParameterTypeHints: true}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsRestParameters1_test.go b/internal/fourslash/tests/gen/inlayHintsRestParameters1_test.go index 490e23a5db..78f40e7c88 100644 --- a/internal/fourslash/tests/gen/inlayHintsRestParameters1_test.go +++ b/internal/fourslash/tests/gen/inlayHintsRestParameters1_test.go @@ -21,5 +21,5 @@ type Args3 = [number, number] declare function foo3(c: number, ...args: Args3); foo3(1, 2, 3)` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayParameterNameHints: lsutil.IncludeInlayParameterNameHintsLiterals}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayParameterNameHints: lsutil.IncludeInlayParameterNameHintsLiterals}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsRestParameters2_test.go b/internal/fourslash/tests/gen/inlayHintsRestParameters2_test.go index a87ed1068f..8d4bf6b332 100644 --- a/internal/fourslash/tests/gen/inlayHintsRestParameters2_test.go +++ b/internal/fourslash/tests/gen/inlayHintsRestParameters2_test.go @@ -29,5 +29,5 @@ function foo5(...x: [number, number]) { foo(...x, 3); }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayParameterNameHints: lsutil.IncludeInlayParameterNameHintsAll}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayParameterNameHints: lsutil.IncludeInlayParameterNameHintsAll}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsReturnType_test.go b/internal/fourslash/tests/gen/inlayHintsReturnType_test.go index 7ba162ef73..7590acb386 100644 --- a/internal/fourslash/tests/gen/inlayHintsReturnType_test.go +++ b/internal/fourslash/tests/gen/inlayHintsReturnType_test.go @@ -28,5 +28,5 @@ const b = function () { return 1 } const c = (b) => 1 const d = b => 1` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayFunctionLikeReturnTypeHints: true}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayFunctionLikeReturnTypeHints: true}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsThisParameter_test.go b/internal/fourslash/tests/gen/inlayHintsThisParameter_test.go index 2f301b0424..1cc6179343 100644 --- a/internal/fourslash/tests/gen/inlayHintsThisParameter_test.go +++ b/internal/fourslash/tests/gen/inlayHintsThisParameter_test.go @@ -24,5 +24,5 @@ declare function fn( fn(function (this, a, b) { }); fn(function (this: I, a, b) { });` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayFunctionParameterTypeHints: true}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayFunctionParameterTypeHints: true}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsTypeMatchesName_test.go b/internal/fourslash/tests/gen/inlayHintsTypeMatchesName_test.go index d1d9fe6394..95b285179b 100644 --- a/internal/fourslash/tests/gen/inlayHintsTypeMatchesName_test.go +++ b/internal/fourslash/tests/gen/inlayHintsTypeMatchesName_test.go @@ -16,5 +16,5 @@ func TestInlayHintsTypeMatchesName(t *testing.T) { function getClient(): Client { return {}; }; const client = getClient();` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayVariableTypeHints: true, IncludeInlayVariableTypeHintsWhenTypeMatchesName: false}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayVariableTypeHints: true, IncludeInlayVariableTypeHintsWhenTypeMatchesName: false}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsVariableTypes1_test.go b/internal/fourslash/tests/gen/inlayHintsVariableTypes1_test.go index 6143393855..40823de087 100644 --- a/internal/fourslash/tests/gen/inlayHintsVariableTypes1_test.go +++ b/internal/fourslash/tests/gen/inlayHintsVariableTypes1_test.go @@ -30,5 +30,5 @@ const l = ((({ a: 1, b: 1 }))); const m = () => 123; const n;` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayVariableTypeHints: true}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayVariableTypeHints: true}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsVariableTypes2_test.go b/internal/fourslash/tests/gen/inlayHintsVariableTypes2_test.go index 186cbee3cd..cbf03d813d 100644 --- a/internal/fourslash/tests/gen/inlayHintsVariableTypes2_test.go +++ b/internal/fourslash/tests/gen/inlayHintsVariableTypes2_test.go @@ -23,5 +23,5 @@ const [] = array; declare function foo(t: T): T const x = foo(1)` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayVariableTypeHints: true}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayVariableTypeHints: true}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsVariableTypes3_test.go b/internal/fourslash/tests/gen/inlayHintsVariableTypes3_test.go index 3c2a1f1c53..ccdc4fd3ec 100644 --- a/internal/fourslash/tests/gen/inlayHintsVariableTypes3_test.go +++ b/internal/fourslash/tests/gen/inlayHintsVariableTypes3_test.go @@ -25,5 +25,5 @@ interface ElementMap { declare function getCtor(tagName: K): ElementMap[K] | undefined; const div = getCtor("div");` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayVariableTypeHints: true}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayVariableTypeHints: true}}) } diff --git a/internal/fourslash/tests/gen/inlayHintsWithClosures_test.go b/internal/fourslash/tests/gen/inlayHintsWithClosures_test.go index 74972a825b..4b42977853 100644 --- a/internal/fourslash/tests/gen/inlayHintsWithClosures_test.go +++ b/internal/fourslash/tests/gen/inlayHintsWithClosures_test.go @@ -23,5 +23,5 @@ function foo2(a: (b: number) => number) { } foo2((c: number) => c + 1);` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) - f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{IncludeInlayParameterNameHints: lsutil.IncludeInlayParameterNameHintsAll}) + f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayParameterNameHints: lsutil.IncludeInlayParameterNameHintsAll}}) } diff --git a/internal/fourslash/tests/inlayHintsTupleTypeCrash_test.go b/internal/fourslash/tests/inlayHintsTupleTypeCrash_test.go index 5df5b06667..300eb3ab9e 100644 --- a/internal/fourslash/tests/inlayHintsTupleTypeCrash_test.go +++ b/internal/fourslash/tests/inlayHintsTupleTypeCrash_test.go @@ -17,6 +17,8 @@ func TestInlayHintsTupleTypeCrash(t *testing.T) { }` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{ - IncludeInlayFunctionParameterTypeHints: true, + InlayHints: lsutil.InlayHintsPreferences{ + IncludeInlayFunctionParameterTypeHints: true, + }, }) } diff --git a/internal/fourslash/tests/manual/inlayHintsInteractiveParameterNamesInSpan1_test.go b/internal/fourslash/tests/manual/inlayHintsInteractiveParameterNamesInSpan1_test.go index c74850752a..ebeda2088f 100644 --- a/internal/fourslash/tests/manual/inlayHintsInteractiveParameterNamesInSpan1_test.go +++ b/internal/fourslash/tests/manual/inlayHintsInteractiveParameterNamesInSpan1_test.go @@ -30,5 +30,9 @@ function c6 () { foo6(/*k*/1, /*l*/2); }` start := f.MarkerByName(t, "c") end := f.MarkerByName(t, "h") span := &lsproto.Range{Start: start.LSPosition, End: end.LSPosition} - f.VerifyBaselineInlayHints(t, span, &lsutil.UserPreferences{IncludeInlayParameterNameHints: "literals"}) + f.VerifyBaselineInlayHints(t, span, &lsutil.UserPreferences{ + InlayHints: lsutil.InlayHintsPreferences{ + IncludeInlayParameterNameHints: "literals", + }, + }) } diff --git a/internal/fourslash/tests/manual/inlayHintsInteractiveParameterNamesInSpan2_test.go b/internal/fourslash/tests/manual/inlayHintsInteractiveParameterNamesInSpan2_test.go index 0a2ec656d5..ea04ed13bc 100644 --- a/internal/fourslash/tests/manual/inlayHintsInteractiveParameterNamesInSpan2_test.go +++ b/internal/fourslash/tests/manual/inlayHintsInteractiveParameterNamesInSpan2_test.go @@ -30,5 +30,9 @@ foo6(/*k*/1, /*l*/2);` start := f.MarkerByName(t, "c") end := f.MarkerByName(t, "h") span := &lsproto.Range{Start: start.LSPosition, End: end.LSPosition} - f.VerifyBaselineInlayHints(t, span, &lsutil.UserPreferences{IncludeInlayParameterNameHints: "literals"}) + f.VerifyBaselineInlayHints(t, span, &lsutil.UserPreferences{ + InlayHints: lsutil.InlayHintsPreferences{ + IncludeInlayParameterNameHints: "literals", + }, + }) } From 04901089e3f0ebde596c3128520b99412b48521f Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 2 Dec 2025 22:28:05 +0000 Subject: [PATCH 08/11] supress -> suppress --- internal/ls/lsutil/userpreferences.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/ls/lsutil/userpreferences.go b/internal/ls/lsutil/userpreferences.go index d3df2600ba..055717bf8c 100644 --- a/internal/ls/lsutil/userpreferences.go +++ b/internal/ls/lsutil/userpreferences.go @@ -444,12 +444,12 @@ func (p *UserPreferences) parseInlayHints(prefs any) { if enabled, ok := v["enabled"]; ok { p.set("includeInlayParameterNameHints", enabled) } - p.InlayHints.IncludeInlayParameterNameHintsWhenArgumentMatchesName = parseSupress(v, "supressWhenArgumentMatchesName") + p.InlayHints.IncludeInlayParameterNameHintsWhenArgumentMatchesName = parseSuppress(v, "suppressWhenArgumentMatchesName") case "parameterTypes": p.InlayHints.IncludeInlayFunctionParameterTypeHints = parseEnabledBool(v) case "variableTypes": p.InlayHints.IncludeInlayVariableTypeHints = parseEnabledBool(v) - p.InlayHints.IncludeInlayVariableTypeHintsWhenTypeMatchesName = parseSupress(v, "supressWhenTypeMatchesName") + p.InlayHints.IncludeInlayVariableTypeHintsWhenTypeMatchesName = parseSuppress(v, "suppressWhenTypeMatchesName") case "propertyDeclarationTypes": p.InlayHints.IncludeInlayPropertyDeclarationTypeHints = parseEnabledBool(v) case "functionLikeReturnTypes": @@ -601,7 +601,7 @@ func parseEnabledBool(v map[string]any) bool { return false } -func parseSupress(v map[string]any, name string) bool { +func parseSuppress(v map[string]any, name string) bool { // vscode nested option if val, ok := v[name]; ok { if suppress, ok := val.(bool); ok { From e87c0eeb5431eca9d2a4aa92ee4b497654c5e322 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 2 Dec 2025 22:36:19 +0000 Subject: [PATCH 09/11] `workspace/inlayHint/refresh` --- internal/ls/inlay_hints.go | 12 +++-- internal/lsp/server.go | 11 +++++ internal/project/client.go | 1 + internal/project/session.go | 12 ++++- .../projecttestutil/clientmock_generated.go | 45 +++++++++++++++++++ 5 files changed, 72 insertions(+), 9 deletions(-) diff --git a/internal/ls/inlay_hints.go b/internal/ls/inlay_hints.go index 1de411522c..3d10aa40b5 100644 --- a/internal/ls/inlay_hints.go +++ b/internal/ls/inlay_hints.go @@ -25,9 +25,12 @@ func (l *LanguageService) ProvideInlayHint( ctx context.Context, params *lsproto.InlayHintParams, ) (lsproto.InlayHintResponse, error) { - if !isAnyInlayHintEnabled(&l.UserPreferences().InlayHints) { + userPreferences := l.UserPreferences() + inlayHintPreferences := &userPreferences.InlayHints + if !isAnyInlayHintEnabled(inlayHintPreferences) { return lsproto.InlayHintsOrNull{InlayHints: nil}, nil } + program, file := l.getProgramAndFile(params.TextDocument.Uri) quotePreference := getQuotePreference(file, l.UserPreferences()) @@ -897,10 +900,5 @@ func (s *inlayHintState) getTypeAnnotationPosition(decl *ast.FunctionLikeDeclara } func isAnyInlayHintEnabled(preferences *lsutil.InlayHintsPreferences) bool { - return preferences.IncludeInlayParameterNameHints != lsutil.IncludeInlayParameterNameHintsNone || - preferences.IncludeInlayFunctionParameterTypeHints || - preferences.IncludeInlayVariableTypeHints || - preferences.IncludeInlayPropertyDeclarationTypeHints || - preferences.IncludeInlayFunctionLikeReturnTypeHints || - preferences.IncludeInlayEnumMemberValueHints + return *preferences != lsutil.InlayHintsPreferences{} } diff --git a/internal/lsp/server.go b/internal/lsp/server.go index 189183ee96..9a88b34723 100644 --- a/internal/lsp/server.go +++ b/internal/lsp/server.go @@ -246,6 +246,17 @@ func (s *Server) PublishDiagnostics(ctx context.Context, params *lsproto.Publish return nil } +func (s *Server) RefreshInlayHints(ctx context.Context) error { + if !s.clientCapabilities.Workspace.InlayHint.RefreshSupport { + return nil + } + + if _, err := sendClientRequest(ctx, s, lsproto.WorkspaceInlayHintRefreshInfo, nil); err != nil { + return fmt.Errorf("failed to refresh inlay hints: %w", err) + } + return nil +} + func (s *Server) RefreshCodeLens(ctx context.Context) error { if !s.clientCapabilities.Workspace.CodeLens.RefreshSupport { return nil diff --git a/internal/project/client.go b/internal/project/client.go index 3e871f31fa..c7640c4b7b 100644 --- a/internal/project/client.go +++ b/internal/project/client.go @@ -11,5 +11,6 @@ type Client interface { UnwatchFiles(ctx context.Context, id WatcherID) error RefreshDiagnostics(ctx context.Context) error PublishDiagnostics(ctx context.Context, params *lsproto.PublishDiagnosticsParams) error + RefreshInlayHints(ctx context.Context) error RefreshCodeLens(ctx context.Context) error } diff --git a/internal/project/session.go b/internal/project/session.go index b3300ff896..84ecdc3d6b 100644 --- a/internal/project/session.go +++ b/internal/project/session.go @@ -212,11 +212,11 @@ func (s *Session) Configure(userPreferences *lsutil.UserPreferences) { defer s.configRWMu.Unlock() s.pendingConfigChanges = true - // Inform the client to re-request certain commands - // depending on user preference changes. + // Tell the client to re-request certain commands depending on user preference changes. oldUserPreferences := s.userPreferences s.userPreferences = userPreferences if oldUserPreferences != userPreferences && oldUserPreferences != nil && userPreferences != nil { + s.refreshInlayHintsIfNeeded(oldUserPreferences, userPreferences) s.refreshCodeLensIfNeeded(oldUserPreferences, userPreferences) } } @@ -795,6 +795,14 @@ func (s *Session) NpmInstall(cwd string, npmInstallArgs []string) ([]byte, error return s.npmExecutor.NpmInstall(cwd, npmInstallArgs) } +func (s *Session) refreshInlayHintsIfNeeded(oldPrefs *lsutil.UserPreferences, newPrefs *lsutil.UserPreferences) { + if oldPrefs.InlayHints != newPrefs.InlayHints { + if err := s.client.RefreshInlayHints(context.Background()); err != nil && s.options.LoggingEnabled { + s.logger.Logf("Error refreshing inlay hints: %v", err) + } + } +} + func (s *Session) refreshCodeLensIfNeeded(oldPrefs *lsutil.UserPreferences, newPrefs *lsutil.UserPreferences) { if oldPrefs.CodeLens != newPrefs.CodeLens { if err := s.client.RefreshCodeLens(context.Background()); err != nil && s.options.LoggingEnabled { diff --git a/internal/testutil/projecttestutil/clientmock_generated.go b/internal/testutil/projecttestutil/clientmock_generated.go index 7c864e5c78..92cd2cdfa7 100644 --- a/internal/testutil/projecttestutil/clientmock_generated.go +++ b/internal/testutil/projecttestutil/clientmock_generated.go @@ -30,6 +30,9 @@ var _ project.Client = &ClientMock{} // RefreshDiagnosticsFunc: func(ctx context.Context) error { // panic("mock out the RefreshDiagnostics method") // }, +// RefreshInlayHintsFunc: func(ctx context.Context) error { +// panic("mock out the RefreshInlayHints method") +// }, // UnwatchFilesFunc: func(ctx context.Context, id project.WatcherID) error { // panic("mock out the UnwatchFiles method") // }, @@ -52,6 +55,9 @@ type ClientMock struct { // RefreshDiagnosticsFunc mocks the RefreshDiagnostics method. RefreshDiagnosticsFunc func(ctx context.Context) error + // RefreshInlayHintsFunc mocks the RefreshInlayHints method. + RefreshInlayHintsFunc func(ctx context.Context) error + // UnwatchFilesFunc mocks the UnwatchFiles method. UnwatchFilesFunc func(ctx context.Context, id project.WatcherID) error @@ -77,6 +83,11 @@ type ClientMock struct { // Ctx is the ctx argument value. Ctx context.Context } + // RefreshInlayHints holds details about calls to the RefreshInlayHints method. + RefreshInlayHints []struct { + // Ctx is the ctx argument value. + Ctx context.Context + } // UnwatchFiles holds details about calls to the UnwatchFiles method. UnwatchFiles []struct { // Ctx is the ctx argument value. @@ -97,6 +108,7 @@ type ClientMock struct { lockPublishDiagnostics sync.RWMutex lockRefreshCodeLens sync.RWMutex lockRefreshDiagnostics sync.RWMutex + lockRefreshInlayHints sync.RWMutex lockUnwatchFiles sync.RWMutex lockWatchFiles sync.RWMutex } @@ -204,6 +216,39 @@ func (mock *ClientMock) RefreshDiagnosticsCalls() []struct { return calls } +// RefreshInlayHints calls RefreshInlayHintsFunc. +func (mock *ClientMock) RefreshInlayHints(ctx context.Context) error { + callInfo := struct { + Ctx context.Context + }{ + Ctx: ctx, + } + mock.lockRefreshInlayHints.Lock() + mock.calls.RefreshInlayHints = append(mock.calls.RefreshInlayHints, callInfo) + mock.lockRefreshInlayHints.Unlock() + if mock.RefreshInlayHintsFunc == nil { + var errOut error + return errOut + } + return mock.RefreshInlayHintsFunc(ctx) +} + +// RefreshInlayHintsCalls gets all the calls that were made to RefreshInlayHints. +// Check the length with: +// +// len(mockedClient.RefreshInlayHintsCalls()) +func (mock *ClientMock) RefreshInlayHintsCalls() []struct { + Ctx context.Context +} { + var calls []struct { + Ctx context.Context + } + mock.lockRefreshInlayHints.RLock() + calls = mock.calls.RefreshInlayHints + mock.lockRefreshInlayHints.RUnlock() + return calls +} + // UnwatchFiles calls UnwatchFilesFunc. func (mock *ClientMock) UnwatchFiles(ctx context.Context, id project.WatcherID) error { callInfo := struct { From 30d454418a0813de2fa0d9ecb4aae84e0aee48f9 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 3 Dec 2025 01:15:39 +0000 Subject: [PATCH 10/11] Add session test for refreshing code lenses and inlay hints. --- internal/project/session_test.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/internal/project/session_test.go b/internal/project/session_test.go index 164f7eea68..b1ffed559e 100644 --- a/internal/project/session_test.go +++ b/internal/project/session_test.go @@ -9,6 +9,7 @@ import ( "github.com/microsoft/typescript-go/internal/bundled" "github.com/microsoft/typescript-go/internal/core" "github.com/microsoft/typescript-go/internal/glob" + "github.com/microsoft/typescript-go/internal/ls/lsutil" "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/project" "github.com/microsoft/typescript-go/internal/testutil/projecttestutil" @@ -850,6 +851,31 @@ func TestSession(t *testing.T) { assert.Check(t, program.GetSourceFile("/home/projects/TS/p1/src/a.ts") != nil) }) }) + + t.Run("refreshes code lenses and inlay hints when relevant user preferences change", func(t *testing.T) { + t.Parallel() + files := map[string]any{ + "/src/tsconfig.json": "{}", + "/src/index.ts": "export const x = 1;", + } + session, utils := projecttestutil.Setup(files) + session.DidOpenFile(context.Background(), "file:///src/index.ts", 1, files["/src/index.ts"].(string), lsproto.LanguageKindTypeScript) + _, err := session.GetLanguageService(context.Background(), lsproto.DocumentUri("file:///src/index.ts")) + assert.NilError(t, err) + + session.Configure(&lsutil.UserPreferences{}) + + // Change user preferences for code lens and inlay hints. + newPrefs := session.UserPreferences() + newPrefs.CodeLens.ReferencesCodeLensEnabled = !newPrefs.CodeLens.ReferencesCodeLensEnabled + newPrefs.InlayHints.IncludeInlayFunctionLikeReturnTypeHints = !newPrefs.InlayHints.IncludeInlayFunctionLikeReturnTypeHints + session.Configure(newPrefs) + + codeLensRefreshCalls := utils.Client().RefreshCodeLensCalls() + inlayHintsRefreshCalls := utils.Client().RefreshInlayHintsCalls() + assert.Equal(t, len(codeLensRefreshCalls), 1, "expected one RefreshCodeLens call after code lens preference change") + assert.Equal(t, len(inlayHintsRefreshCalls), 1, "expected one RefreshInlayHints call after inlay hints preference change") + }) } func ptrTo[T any](v T) *T { From 0807dd7bed399c08de5b0bf3116fa54518621b4f Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 3 Dec 2025 01:20:36 +0000 Subject: [PATCH 11/11] Reuse locals. --- internal/ls/inlay_hints.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/ls/inlay_hints.go b/internal/ls/inlay_hints.go index b3871c3b62..d00c4fdd35 100644 --- a/internal/ls/inlay_hints.go +++ b/internal/ls/inlay_hints.go @@ -32,14 +32,14 @@ func (l *LanguageService) ProvideInlayHint( } program, file := l.getProgramAndFile(params.TextDocument.Uri) - quotePreference := getQuotePreference(file, l.UserPreferences()) + quotePreference := getQuotePreference(file, userPreferences) checker, done := program.GetTypeCheckerForFile(ctx, file) defer done() inlayHintState := &inlayHintState{ ctx: ctx, span: l.converters.FromLSPRange(file, params.Range), - preferences: &l.UserPreferences().InlayHints, + preferences: inlayHintPreferences, quotePreference: quotePreference, file: file, checker: checker,