Skip to content

Commit cefab98

Browse files
authored
Add configuration for basedpyright (#106)
* feat: Add variables to customize inlay hints with basedpyright * doc: Update documentation for basedpyright configuration
1 parent 327edce commit cefab98

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ lsp-mode client leveraging [pyright](https://github.com/microsoft/pyright) and [
3737
- `basedpyright.` / `pyright.disableOrganizeImports` via `lsp-pyright-disable-organize-imports`
3838
- `basedpyright.` / `pyright.disableTaggedHints` via `lsp-pyright-disable-tagged-hints`
3939
- `basedpyright.` / `python.typeCheckingMode` via `lsp-pyright-type-checking-mode`
40+
- `basedpyright.analysis.inlayHints.variableTypes` via `lsp-pyright-basedpyright-inlay-hints-variable-types`
41+
- `basedpyright.analysis.inlayHints.callArgumentNames` via `lsp-pyright-basedpyright-inlay-hints-call-argument-names`
42+
- `basedpyright.analysis.inlayHints.functionReturnTypes` via `lsp-pyright-basedpyright-inlay-hints-function-return-types`
43+
- `basedpyright.analysis.inlayHints.genericTypes` via `lsp-pyright-basedpyright-inlay-hints-generic-types`
4044
- `python.analysis.autoImportCompletions` via `lsp-pyright-auto-import-completions`
4145
- `python.analysis.diagnosticMode` via `lsp-pyright-diagnostic-mode`
4246
- `python.analysis.logLevel` via `lsp-pyright-log-level`

lsp-pyright.el

+32
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,34 @@ Only available in Emacs 27 and above."
163163
:type 'list
164164
:group 'lsp-pyright)
165165

166+
(defcustom lsp-pyright-basedpyright-inlay-hints-variable-types t
167+
"Whether to show inlay hints on assignments to variables.
168+
169+
Basedpyright only."
170+
:type 'boolean
171+
:group 'lsp-pyright)
172+
173+
(defcustom lsp-pyright-basedpyright-inlay-hints-call-argument-names t
174+
"Whether to show inlay hints on function arguments.
175+
176+
Basedpyright only."
177+
:type 'boolean
178+
:group 'lsp-pyright)
179+
180+
(defcustom lsp-pyright-basedpyright-inlay-hints-function-return-types t
181+
"Whether to show inlay hints on function return types.
182+
183+
Basedpyright only."
184+
:type 'boolean
185+
:group 'lsp-pyright)
186+
187+
(defcustom lsp-pyright-basedpyright-inlay-hints-generic-types nil
188+
"Whether to show inlay hints on inferred generic types.
189+
190+
Basedpyright only."
191+
:type 'boolean
192+
:group 'lsp-pyright)
193+
166194
(defun lsp-pyright--locate-venv ()
167195
"Look for virtual environments local to the workspace."
168196
(or lsp-pyright-venv-path
@@ -228,6 +256,10 @@ Current LSP WORKSPACE should be passed in."
228256
(,(concat lsp-pyright-langserver-command ".disableOrganizeImports") lsp-pyright-disable-organize-imports t)
229257
(,(concat lsp-pyright-langserver-command ".disableTaggedHints") lsp-pyright-disable-tagged-hints t)
230258
(,(concat lsp-pyright-langserver-command ".typeCheckingMode") lsp-pyright-type-checking-mode)
259+
("basedpyright.analysis.inlayHints.variableTypes" lsp-pyright-basedpyright-inlay-hints-variable-types t)
260+
("basedpyright.analysis.inlayHints.callArgumentNames" lsp-pyright-basedpyright-inlay-hints-call-argument-names t)
261+
("basedpyright.analysis.inlayHints.functionReturnTypes" lsp-pyright-basedpyright-inlay-hints-function-return-types t)
262+
("basedpyright.analysis.inlayHints.genericTypes" lsp-pyright-basedpyright-inlay-hints-generic-types t)
231263
("python.analysis.typeCheckingMode" lsp-pyright-type-checking-mode)
232264
("python.analysis.autoImportCompletions" lsp-pyright-auto-import-completions t)
233265
("python.analysis.diagnosticMode" lsp-pyright-diagnostic-mode)

0 commit comments

Comments
 (0)