Skip to content

Commit

Permalink
disable genericTypes by default since it would often display redund…
Browse files Browse the repository at this point in the history
…ant information when `variableTypes` is enabled
  • Loading branch information
DetachHead committed Oct 28, 2024
1 parent 9d258d7 commit 5766654
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/configuration/language-server-settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ the following settings are exclusive to basedpyright

![](inlayHints.functionReturnTypes.png)

**basedpyright.analysis.inlayHints.genericTypes** [boolean]: Whether to show inlay hints on inferred generic types. (currently only works on `Final` and `ClassVar`):
**basedpyright.analysis.inlayHints.genericTypes** [boolean]: Whether to show inlay hints on inferred generic types. Defaults to `false`:

![](inlayHints.genericTypes.png)

Expand Down
2 changes: 1 addition & 1 deletion packages/pyright-internal/src/languageServerBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1011,7 +1011,7 @@ export abstract class LanguageServerBase implements LanguageServerInterface, Dis
callArgumentNames: inlayHintSettings?.callArgumentNames ?? true,
functionReturnTypes: inlayHintSettings?.functionReturnTypes ?? true,
variableTypes: inlayHintSettings?.variableTypes ?? true,
genericTypes: inlayHintSettings?.genericTypes ?? true,
genericTypes: inlayHintSettings?.genericTypes ?? false,
}).onInlayHints();
}, token);
}
Expand Down
7 changes: 6 additions & 1 deletion packages/pyright-internal/src/realLanguageServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,12 @@ export abstract class RealLanguageServer extends LanguageServerBase {
logLevel: LogLevel.Info,
autoImportCompletions: true,
functionSignatureDisplay: SignatureDisplayType.formatted,
inlayHints: { callArgumentNames: true, functionReturnTypes: true, variableTypes: true, genericTypes: true },
inlayHints: {
callArgumentNames: true,
functionReturnTypes: true,
variableTypes: true,
genericTypes: false,
},
};

try {
Expand Down
2 changes: 1 addition & 1 deletion packages/vscode-pyright/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1764,7 +1764,7 @@
},
"basedpyright.analysis.inlayHints.genericTypes": {
"type": "boolean",
"default": true,
"default": false,
"description": "Whether to show inlay hints on inferred generic types.",
"scope": "resource"
}
Expand Down

0 comments on commit 5766654

Please sign in to comment.