Skip to content

Commit b3b5487

Browse files
authored
Add support for Python(ty) (#4785)
* feat(clients): add LSP support for Python(ty) language Introduce a new client for the Python(ty) programming language in `lsp-mode`. This includes the ability to start the `ty` language server and provides integration with `python-mode`. * feat(python): add support for Python(ty) language server Added configuration and documentation for the Python(ty) language server, including links to its repository and installation instructions. Updated the changelog and navigation in the documentation to reflect the new support. * feat(lsp): add support for lsp-python-ty
1 parent bc46df5 commit b3b5487

File tree

5 files changed

+62
-1
lines changed

5 files changed

+62
-1
lines changed

CHANGELOG.org

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
* Add ~lsp-nix-nixd-server-arguments~ to allow passing arguments to the ~nixd~ LSP.
3939
* Improve the lsp-ocaml client (see [[https://github.com/emacs-lsp/lsp-mode/issues/4731][#4731]] for the follow-up issue. MRs: [[https://github.com/emacs-lsp/lsp-mode/pull/4741][#4741]], [[https://github.com/emacs-lsp/lsp-mode/pull/4732][#4732]])
4040
* Add support for ~source.removeUnusedImports~ for lsp-javascript
41+
* Add Python(ty) support
4142

4243
** 9.0.0
4344
* Add language server config for QML (Qt Modeling Language) using qmlls.

clients/lsp-python-ty.el

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
;;; lsp-python-ty.el --- description -*- lexical-binding: t; -*-
2+
3+
;; Copyright (C) 2025 emacs-lsp maintainers
4+
5+
;; Author: emacs-lsp maintainers
6+
;; Keywords: lsp, python
7+
8+
;; This program is free software; you can redistribute it and/or modify
9+
;; it under the terms of the GNU General Public License as published by
10+
;; the Free Software Foundation, either version 3 of the License, or
11+
;; (at your option) any later version.
12+
13+
;; This program is distributed in the hope that it will be useful,
14+
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
;; GNU General Public License for more details.
17+
18+
;; You should have received a copy of the GNU General Public License
19+
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
20+
21+
;;; Commentary:
22+
23+
;; LSP Clients for the Python(ty) Programming Language.
24+
25+
;;; Code:
26+
27+
(require 'lsp-mode)
28+
29+
(defgroup lsp-python-ty nil
30+
"LSP support for Python(ty)."
31+
:group 'lsp-mode
32+
:link '(url-link "https://github.com/astral-sh/ty"))
33+
34+
(defcustom lsp-python-ty-clients-server-command '("ty" "server")
35+
"Command to start the python-ty language server."
36+
:group 'lsp-python-ty
37+
:risky t
38+
:type '(repeat string))
39+
40+
(lsp-register-client
41+
(make-lsp-client :new-connection (lsp-stdio-connection lsp-python-ty-clients-server-command)
42+
:major-modes '(python-mode)
43+
:server-id 'lsp-python-ty))
44+
45+
46+
(lsp-consistency-check lsp-python-ty)
47+
48+
(provide 'lsp-python-ty)
49+
;;; lsp-python-ty.el ends here

docs/lsp-clients.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -940,6 +940,16 @@
940940
"installation-url": "https://github.com/emacs-lsp/lsp-python-ms",
941941
"debugger": "Yes"
942942
},
943+
{
944+
"name": "python-ty",
945+
"full-name": "Python (ty)",
946+
"server-name": "LSP support for Python(ty).",
947+
"server-url": "https://github.com/astral-sh/ty",
948+
"client-name": "lsp-python-ty",
949+
"client-url": "https://github.com/astral-sh/ty",
950+
"installation-url": "https://github.com/astral-sh/ty",
951+
"debugger": "Yes"
952+
},
943953
{
944954
"name": "qml-ls",
945955
"full-name": "QML (Qt Modeling Language)",

lsp-mode.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ As defined by the Language Server Protocol 3.16."
186186
lsp-matlab lsp-mdx lsp-meson lsp-metals lsp-mint lsp-mojo lsp-move lsp-mssql
187187
lsp-nextflow lsp-nginx lsp-nim lsp-nix lsp-nushell lsp-ocaml lsp-openscad
188188
lsp-pascal lsp-perl lsp-perlnavigator lsp-php lsp-pls lsp-postgres
189-
lsp-purescript lsp-pwsh lsp-pyls lsp-pylsp lsp-pyright lsp-python-ms
189+
lsp-purescript lsp-pwsh lsp-pyls lsp-pylsp lsp-pyright lsp-python-ms lsp-python-ty
190190
lsp-qml lsp-r lsp-racket lsp-remark lsp-rf lsp-roc lsp-roslyn lsp-rubocop
191191
lsp-ruby-lsp lsp-ruby-syntax-tree lsp-ruff lsp-rust lsp-semgrep lsp-shader
192192
lsp-solargraph lsp-solidity lsp-sonarlint lsp-sorbet lsp-sourcekit

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ nav:
150150
- Python (Pyright): https://emacs-lsp.github.io/lsp-pyright
151151
- Python (Microsoft): https://emacs-lsp.github.io/lsp-python-ms
152152
- Python (Ruff): page/lsp-ruff.md
153+
- Python (ty): https://github.com/astral-sh/ty
153154
- QML: page/lsp-qml.md
154155
- R: page/lsp-r.md
155156
- Racket (jeapostrophe): page/lsp-racket-langserver.md

0 commit comments

Comments
 (0)