{"slug": "pyrefly-pylance-integration-in-vs-code", "title": "Pyrefly + Pylance Integration in VS Code", "summary": "Meta's Pyrefly can now serve as the type-checking backend for Pylance in VS Code, letting users keep Pylance features such as GitHub Copilot integration while switching diagnostics from Pyright to Pyrefly. The integration runs on the new open Type Server Protocol (TSP), which Meta built with Microsoft's Python team and which defines a standard interface between an editor intelligence layer and a type checker. TSP support with Pyrefly is available to all VS Code users now, with Pylance auto-detecting a Pyrefly installation or users selecting \"Pylance + Pyrefly\" under Python > Analysis: Diagnostics Source; Meta still recommends the standalone Pyrefly VS Code extension for most users.", "body_md": "# Pyrefly + Pylance Integration in VS Code\n\nIf you use Pylance in VS Code for its completions, navigation, or GitHub Copilot integration, you can now use Pyrefly as its type checking backend. We have been working with the Microsoft Python team to make this possible. The result is a new diagnostics source option in Pylance that uses Pyrefly instead of Pyright to power the type analysis backend, keeping the Pylance experience intact.\n\n## Why this matters\n\nUntil now, Pylance has been tightly coupled to Pyright, and if you wanted Pylance's features, you got Pyright's type checking whether it matched your project or not. If you preferred Pyrefly for its performance, its inference behaviour, or its support for patterns like Pydantic and Django, you had to give up the Pylance ecosystem entirely and install the standalone [Pyrefly VS Code extension](https://marketplace.visualstudio.com/items?itemName=meta.pyrefly).\n\nThat trade-off is now gone. You can choose the type checker that fits your codebase and your team, without losing the Pylance features you depend on (like tight integration with GitHub Copilot).\n\n## How it works\n\nUnder the hood, this integration uses a new open protocol called the [Type Server Protocol (TSP)](https://github.com/microsoft/pylance-release/blob/main/docs/tsp/type-server-protocol.md), which defines a standard interface between an editor intelligence layer and a type checker. We worked together with the team at Microsoft to design and implement TSP and to ensure that Pyrefly fully supports it.\n\nYou can read more about the collaboration with Microsoft on their blog [here](https://devblogs.microsoft.com/python/announcing-tsp/).\n\n## Should you use the Pyrefly extension or the Pyrefly + Pylance integration?\n\nWe still recommend the standalone [Pyrefly VS Code extension](https://marketplace.visualstudio.com/items?itemName=meta.pyrefly) for most users. It gives you the most direct Pyrefly experience with the least overhead: diagnostics, completions, go-to-definition, hover, and refactoring actions, all powered by Pyrefly's language server with no intermediary.\n\nThe Pylance integration is the better choice if:\n\n- You rely on GitHub Copilot's integration with Pylance\n- Your team has standardised on Pylance and you want to introduce Pyrefly without changing everyone's extension setup\n- You want Pylance-specific features (its smart completion ranking, Quick Info, or environment management) alongside Pyrefly's type analysis\n\n## Try it\n\nTSP support with Pyrefly is available to all VS Code users now. The following sections describe how the experience works.\n\n### Automatic detection\n\nWhen you open a workspace, Pylance checks your Python environments for a Pyrefly installation. If it finds one, whether installed in your virtual environment or indicated by a `pyrefly.toml` or `[tool.pyrefly]` configuration in your project, you will see a notification:\n\n*Pyrefly was found in your Python environment. Would you like to use it as your source of diagnostics in Visual Studio Code?*\n\nClick **Switch to Pyrefly** and Pylance will activate Pyrefly as your diagnostics source immediately, registering the path to the Pyrefly executable automatically. No manual configuration needed. If you'd prefer to decide later, **Cancel** dismisses the notification for the session. Click **Don't ask again** to suppress it permanently. You can re-enable detection at any time in settings.\n\n### Manual setup via settings\n\nYou can also switch at any time through the Visual Studio Code Settings UI. You can paste `vscode://settings/python.analysis.enableExternalTypeServer` into any browser to open up the appropriate setting.\n\nUnder **Python > Analysis: Diagnostics Source**, you will find a dropdown with three options:\n\n- **Pylance** (Default): uses Pylance's built-in analysis.\n- **Pylance + Pyright** : explicitly routes diagnostics through Pyright.\n- **Pylance + Pyrefly** : uses Pyrefly as the diagnostics engine.\n\nWhen **Pylance + Pyrefly** is selected, Pylance will locate a Pyrefly installation in your virtual environments or download it automatically.\n\nA companion **Python > Analysis: Pyrefly Version** setting allows you to pin a specific version, point to a local executable, or leave the value empty to always use the latest release. The minimum supported version is 0.60.0.\n\n### Status bar\n\nOnce active, the status bar shows **Diagnostics Source: Pyrefly** alongside your interpreter and environment. Selecting it opens a quick menu where you can switch sources or change settings without leaving your file.\n\n## What's next and how to get involved\n\nWe're excited to see more VSCode users get access to the performance enhancements that Pyrefly can bring and we'll be continuing to work with the Microsoft Python team to make your IDE experience even better. If you have feedback on the integration we'd love to hear from you!", "url": "https://wpnews.pro/news/pyrefly-pylance-integration-in-vs-code", "canonical_source": "https://pyrefly.org/blog/pyrefly-pylance/", "published_at": "2026-10-21 00:00:00+00:00", "updated_at": "2026-10-21 14:41:59.762326+00:00", "lang": "en", "topics": ["developer-tools", "ai-tools", "ai-products"], "entities": ["Pyrefly", "Pylance", "VS Code", "Microsoft", "Meta", "Pyright", "GitHub Copilot", "Type Server Protocol"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/pyrefly-pylance-integration-in-vs-code", "markdown": "https://wpnews.pro/news/pyrefly-pylance-integration-in-vs-code.md", "text": "https://wpnews.pro/news/pyrefly-pylance-integration-in-vs-code.txt", "jsonld": "https://wpnews.pro/news/pyrefly-pylance-integration-in-vs-code.jsonld"}}