All Projects → microsoft → Pylance Release

microsoft / Pylance Release

Licence: cc-by-4.0
Documentation and issues for Pylance

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Pylance Release

Python Language Server
Microsoft Language Server for Python
Stars: ✭ 778 (-0.51%)
Mutual labels:  language-server-protocol, language-server, code-analysis
Php Language Server
PHP Implementation of the VS Code Language Server Protocol 🆚↔🖥
Stars: ✭ 1,019 (+30.31%)
Mutual labels:  language-server-protocol, language-server, code-analysis
groovy-language-server
A language server for Groovy
Stars: ✭ 132 (-83.12%)
Mutual labels:  language-server, language-server-protocol
typescript-language-server
TypeScript & JavaScript Language Server
Stars: ✭ 1,118 (+42.97%)
Mutual labels:  language-server, language-server-protocol
atom-ide-scala
Scala & Dotty support for Atom IDE (🧟‍♂️ zombie repo)
Stars: ✭ 47 (-93.99%)
Mutual labels:  language-server, language-server-protocol
Typescript Language Server
TypeScript & JavaScript Language Server
Stars: ✭ 462 (-40.92%)
Mutual labels:  language-server-protocol, language-server
Csharp Language Server Protocol
Language Server Protocol in C#
Stars: ✭ 230 (-70.59%)
Mutual labels:  language-server-protocol, language-server
Monaco Languageclient
NPM module to connect Monaco editor with language servers
Stars: ✭ 419 (-46.42%)
Mutual labels:  language-server-protocol, language-server
Langserver Swift
A Swift implementation of the open Language Server Protocol.
Stars: ✭ 171 (-78.13%)
Mutual labels:  language-server-protocol, language-server
camel-language-server
The Apache Camel LSP server implementation
Stars: ✭ 31 (-96.04%)
Mutual labels:  language-server, language-server-protocol
toy-language-server
Example language server (LSP) implementation for a toy language
Stars: ✭ 54 (-93.09%)
Mutual labels:  language-server, language-server-protocol
Elm Language Server
Language server implementation for Elm
Stars: ✭ 298 (-61.89%)
Mutual labels:  language-server-protocol, language-server
Lua Lsp
A Lua language server
Stars: ✭ 219 (-71.99%)
Mutual labels:  language-server-protocol, language-server
Intelephense
Intellisense for PHP
Stars: ✭ 212 (-72.89%)
Mutual labels:  language-server-protocol, language-server
LanguageServer.NET
A .NET Standard server-side implementation of Language Server Protocol 2.0/3.x infrastructure library.
Stars: ✭ 78 (-90.03%)
Mutual labels:  language-server, language-server-protocol
Fsautocomplete
F# language server using Language Server Protocol
Stars: ✭ 208 (-73.4%)
Mutual labels:  language-server-protocol, language-server
language-server
Generic Language Server
Stars: ✭ 21 (-97.31%)
Mutual labels:  language-server, language-server-protocol
Elm Language Client Vscode
Improving your Elm experience since 2019
Stars: ✭ 162 (-79.28%)
Mutual labels:  language-server-protocol, language-server
Dockerfile Language Server Nodejs
A language server for Dockerfiles powered by Node.js, TypeScript, and VSCode technologies.
Stars: ✭ 170 (-78.26%)
Mutual labels:  language-server-protocol, language-server
stardog-language-servers
Language Servers for Stardog Languages
Stars: ✭ 19 (-97.57%)
Mutual labels:  language-server, language-server-protocol

Pylance

Fast, feature-rich language support for Python

This repository is for providing feedback and documentation on the Pylance language server extension in Visual Studio Code. You can use the repository to report issues or submit feature requests. The Pylance codebase is not open-source but you can contribute to Pyright to make improvements to the core typing engine that powers the Pylance experience.

Quick Start

  1. Install the Pylance extension from the marketplace.
  2. Open a Python (.py) file and the Pylance extension will activate.
  3. Select Yes when prompted to make Pylance the default language server. This will update your preferences, which you can also do manually by adding "python.languageServer": "Pylance" to your settings.json file using the text editor.

Features

Pylance provides some awesome features for Python 3, including:

  • Docstrings
  • Signature help, with type information
  • Parameter suggestions
  • Code completion
  • Auto-imports (as well as add and remove import code actions)
  • As-you-type reporting of code errors and warnings (diagnostics)
  • Code outline
  • Code navigation
  • Type checking mode
  • Native multi-root workspace support
  • IntelliCode compatibility
  • Jupyter Notebooks compatibility
  • Semantic highlighting

See the changelog for the latest release.

Settings and Customization

Pylance provides users with the ability to customize their Python language support via a host of settings which can either be placed in the settings.json file in your workspace, or edited through the Settings Editor UI.

  • pylance.insidersChannel

    • Used to control the insiders download channel.
    • Available values:
      • off (default)
      • daily
  • python.analysis.typeCheckingMode

    • Used to specify the level of type checking analysis performed.
    • Default: off
    • Available values:
      • off: No type checking analysis is conducted; unresolved imports/variables diagnostics are produced
      • basic: Non-type checking-related rules (all rules in off) + basic type checking rules
      • strict: All type checking rules at the highest severity of error (includes all rules in off and basic categories)
  • python.analysis.diagnosticMode

    • Used to allow a user to specify what files they want the language server to analyze to get problems flagged in their code.
    • Available values:
      • workspace
      • openFilesOnly (default)
  • python.analysis.stubPath

    • Used to allow a user to specify a path to a directory that contains custom type stubs. Each package's type stub file(s) are expected to be in its own subdirectory.
    • Default value: ./typings
  • python.analysis.autoSearchPaths

    • Used to automatically add search paths based on some predefined names (like src).
    • Available values:
      • true (default)
      • false
  • python.analysis.extraPaths

    • Used to specify extra search paths for import resolution. This replaces the old python.autoComplete.extraPaths setting.
    • Default value: empty array
  • python.analysis.diagnosticSeverityOverrides

    • Used to allow a user to override the severity levels for individual diagnostics should they desire.

    • Accepted severity values:

      • error (red squiggle)
      • warning (yellow squiggle)
      • information (blue squiggle)
      • none (disables the rule)
    • Available rule to use as keys can be found here

    • Example:

    {
        "python.analysis.diagnosticSeverityOverrides": {
            "reportUnboundVariable": "information",
            "reportImplicitStringConcatenation": "warning"
        }
    }
    
  • python.analysis.useLibraryCodeForTypes

    • Used to parse the source code for a package when a typestub is not found.
    • Accepted values:
      • true (default)
      • false
  • python.analysis.autoImportCompletions

    • Used to control the offering of auto-imports in completions.
    • Accepted values:
      • true (default)
      • false
  • python.analysis.completeFunctionParens

    • Add parentheses to function completions.
    • Accepted values:
      • true
      • false (default)

Semantic highlighting

Visual Studio Code uses TextMate grammars as the main tokenization engine. TextMate grammars work on a single file as input and break it up based on lexical rules expressed in regular expressions.

Semantic tokenization allows language servers to provide additional token information based on the language server's knowledge on how to resolve symbols in the context of a project. Themes can opt-in to use semantic tokens to improve and refine the syntax highlighting from grammars. The editor applies the highlighting from semantic tokens on top of the highlighting from grammars.

Here's an example of what semantic highlighting can add:

Without semantic highlighting:

 semantic highlighting disabled

With semantic highlighting:

 semantic highlighting enabled

Semantic colors can be customized in settings.json by associating the Pylance semantic token types and modifiers with the desired colors.

  • Semantic token types

    • class, enum
    • parameter, variable, property, enumMember
    • function, member
    • module
    • intrinsic
    • magicFunction (dunder methods)
    • selfParameter, clsParameter
  • Semantic token modifiers

    • declaration
    • readonly, static, abstract
    • async
    • typeHint, typeHintComment
    • decorator
    • builtin

The scope inspector tool allows you to explore what semantic tokens are present in a source file and what theme rules they match to.

Example of customizing semantic colors in settings.json:

{
    "editor.semanticTokenColorCustomizations": {
        "[One Dark Pro]": {
            // Apply to this theme only
            "enabled": true,
            "rules": {
                "magicFunction:python": "#ee0000",
                "function.declaration:python": "#990000",
                "*.decorator:python": "#0000dd",
                "*.typeHint:python": "#5500aa",
                "*.typeHintComment:python": "#aaaaaa"
            }
        }
    }
}

Troubleshooting

Known issues are documented in TROUBLESHOOTING.

Contributing

Pylance leverages Microsoft's open-source static type checking tool, Pyright, to provide performant language support for Python.

Code contributions are welcomed via the Pyright repo.

For information on getting started, refer to the CONTRIBUTING instructions.

Feedback

License

See LICENSE for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].