Skip to content

docs: set Eglot :language-id so ty works with python-base-mode#3532

Merged
dhruvmanila merged 2 commits into
astral-sh:mainfrom
jpatel3:docs/emacs-language-id
May 26, 2026
Merged

docs: set Eglot :language-id so ty works with python-base-mode#3532
dhruvmanila merged 2 commits into
astral-sh:mainfrom
jpatel3:docs/emacs-language-id

Conversation

@jpatel3

@jpatel3 jpatel3 commented May 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Closes No diagnostics for LSP client that uses different language identifier #2937.
  • Adds :language-id "python" to the Eglot eglot-server-programs entry in the Emacs editor-integration docs so the recommended snippet works out of the box.
  • Eglot derives the LSP languageId from the major-mode symbol, so the previous python-base-mode entry caused Eglot to advertise documents as python-base. The ty server only accepts the python language id (text_document.rs), so users were silently getting no diagnostics.
  • Adds a short prose note explaining the constraint, so readers who copy the snippet (or adapt it for a different mode) understand why the entry is shaped this way. Fix matches the one suggested upstream in eglot#1580.

Test plan

  • Visually proof the rendered Markdown
  • Verified the snippet shape against the eglot discussion accepted answer

Closes astral-sh#2937. Eglot derives the LSP `languageId` from the major-mode
symbol, so registering ty against `python-base-mode` causes Eglot to
send `python-base`, which the ty server rejects. Adding `:language-id
"python"` to the `eglot-server-programs` entry fixes the registration
without giving up the single-entry coverage that `python-base-mode`
provides for both `python-mode` and `python-ts-mode`.
@jpatel3 jpatel3 force-pushed the docs/emacs-language-id branch from 0af76fa to 7680b4a Compare May 25, 2026 12:48

@dhruvmanila dhruvmanila left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! The explanation is useful but I think it's not really required in the setup documentation here, so I've removed it. Let me know if you think otherwise.

@dhruvmanila dhruvmanila added the documentation Improvements or additions to documentation label May 26, 2026
@dhruvmanila dhruvmanila enabled auto-merge (squash) May 26, 2026 05:19
@dhruvmanila dhruvmanila merged commit 0d8540a into astral-sh:main May 26, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No diagnostics for LSP client that uses different language identifier

2 participants