Skip to content

astral-sh/ty-vscode

Repository files navigation

ty extension for Visual Studio Code

image image Actions status

A Visual Studio Code extension for ty, an extremely fast Python type checker and language server, written in Rust.

Warning:

This extension uses the preview version of ty and is not ready for production use.

We're working hard to make ty stable and feature-complete, but until then, expect to encounter bugs, missing features, and fatal errors.

The extension ships with ty==0.0.1a8.

Features

Currently, the extension supports the following features:

  • Showing diagnostics in the editor
  • Hover type information for symbols
  • Go to type definition
  • Inlay hints for assignment targets
  • Completions

Note:

Completions is an experimental feature and requires explicit opt-in to be enabled via the following setting in your settings.json:

{
  "ty.experimental.completions.enable": true
}

Note:

If you want to test the language server features like completions, go to type definition, etc., it's recommended to disable the language server from the Python extension (if installed) by adding the following setting to your settings.json:

{
  "python.languageServer": "None"
}

Usage

Once installed in Visual Studio Code, ty will automatically execute when you open or edit a Python or Jupyter Notebook file.

If you don't want to use ty for a specific workspace, disable this extension in VS code.

Untrusted Workspace

The extension supports untrusted workspace. For untrusted workspaces, the extension always uses the bundled ty executable, ignoring the following settings:

Settings

See settings for an enumeration of all supported settings.

Commands

Command Description
ty: Restart server Restart the ty language server
ty: Show client logs Open the "ty" output channel
ty: Show server logs Open the "ty Language Server" output channel

Requirements

This extension requires a version of the VSCode Python extension that supports Python 3.8+. ty itself is compatible with Python 3.8 to 3.13.

Getting help

See the troubleshooting guide to get more information on how to debug issues with the extension or the language server.

License

The ty extension is licensed under the MIT license (LICENSE).

About

A Visual Studio Code extension for ty.

Resources

License

Code of conduct

Stars

Watchers

Forks