mirror of
https://github.com/jbranchaud/til
synced 2026-07-06 01:00:35 +00:00
Add Enable Pyright Type Checking In Cursor as a Python TIL
This commit is contained in:
@@ -10,7 +10,7 @@ working across different projects via [VisualMode](https://www.visualmode.dev/).
|
||||
|
||||
For a steady stream of TILs, [sign up for my newsletter](https://visualmode.kit.com/newsletter).
|
||||
|
||||
_1806 TILs and counting..._
|
||||
_1807 TILs and counting..._
|
||||
|
||||
See some of the other learning resources I work on:
|
||||
|
||||
@@ -1072,6 +1072,7 @@ If you've learned something here, support my efforts writing daily TILs by
|
||||
- [Define Typed Class Interface With Protocol](python/define-typed-class-interface-with-protocol.md)
|
||||
- [Dunder Methods](python/dunder-methods.md)
|
||||
- [Easy Key-Value Aggregates With defaultdict](python/easy-key-value-aggregates-with-defaultdict.md)
|
||||
- [Enable Pyright Type Checking In Cursor](python/enable-pyright-type-checking-in-cursor.md)
|
||||
- [Get Absolute Seconds From `timedelta` Object](python/get-absolute-seconds-from-timedelta-object.md)
|
||||
- [Get Quotient And Remainder In One Operation](python/get-quotient-and-remainder-in-one-operation.md)
|
||||
- [Install With PIP For Specific Interpreter](python/install-with-pip-for-specific-interpreter.md)
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
# Enable Pyright Type Checking In Cursor
|
||||
|
||||
In most ways [Cursor](https://cursor.com/), a clone of VS Code, behaves like VS
|
||||
Code and uses the same extensions as VS Code. It even offers to clone all your
|
||||
existing extensions and setup from VS Code when you first install it.
|
||||
|
||||
However, the Pyright type checking setup that I had in VS Code stopped working
|
||||
when I opened up the same Python project in Cursor. It seems that to get Pyright
|
||||
to reliably work with forks of VS Code, you need to use a compatible fork like
|
||||
[Based Pyright](https://docs.basedpyright.com/latest/).
|
||||
|
||||
Once I installed _Based Pyright_ from the extension marketplace, I was able to
|
||||
enable it in `.vscode/settings.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
...,
|
||||
"basedpyright.analysis.typeCheckingMode": "basic"
|
||||
}
|
||||
```
|
||||
|
||||
I may have needed to restart Cursor at this point, I cannot remember exactly.
|
||||
However, once this setup was in place the helpful type checking errors started
|
||||
appearing as red squiggles.
|
||||
Reference in New Issue
Block a user