Skip to content

Add LanguageKind identifiers for TextDocumentItem#6

Merged
christiankissig merged 1 commit into
masterfrom
add-language-id
Jun 3, 2026
Merged

Add LanguageKind identifiers for TextDocumentItem#6
christiankissig merged 1 commit into
masterfrom
add-language-id

Conversation

@christiankissig

Copy link
Copy Markdown
Owner

Summary

Implements languageId per LSP 3.17 — TextDocumentItem.

The spec types languageId as a free-form string but documents a table of recognised language identifiers (abap, c, cpp, python, typescript, git-commit, …). The model previously typed it as a bare str, giving callers no reference for the documented values.

Changes

  • Add a LanguageKind string enum covering every identifier in the spec's table (including the dual scss/sass and git-commit/git-rebase entries).
  • Type TextDocumentItem.languageId as LanguageKind | str, so:
    • passing a LanguageKind member is type-checked and round-trips,
    • any custom/unlisted identifier string remains valid (matching the spec's string type).
  • Document TextDocumentItem / LanguageKind; export LanguageKind from lsp_client.

Testing

  • 5 new tests: enum values, LanguageKind member, known string, custom string, and a JSON wire round-trip (serialises to the bare identifier).
  • poetry run pytest (51 passed), ruff check, ruff format --check, and mypy all clean.

🤖 Generated with Claude Code

The LSP TextDocumentItem spec types languageId as a free-form string but
documents a table of recognised language identifiers (abap, c, cpp,
python, typescript, ...). Add a LanguageKind str enum covering those
identifiers and type languageId as `LanguageKind | str` so callers get
the documented constants while custom identifiers remain valid.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@christiankissig christiankissig merged commit c9c5e1e into master Jun 3, 2026
5 checks passed
@christiankissig christiankissig deleted the add-language-id branch June 3, 2026 17:17
christiankissig added a commit that referenced this pull request Jul 7, 2026
Add LanguageKind identifiers for TextDocumentItem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant