Skip to content

Conversation

@Techatrix
Copy link
Member

All the symbols of the LSP specification are in a single namespace which doesn't fit well with the Zig Style Guide. So this PR rewrites the code generation to create bindings with manually chosen names that make better use of namespacing and avoid redundancy in names.

Here are some examples of how the symbol names have changed:

  • CompletionItem -> completion.Item
  • SemanticTokensRangeParams -> semantic_tokens.Params.Range
  • WorkspaceFoldersChangeEvent -> workspace.folders.ChangeEvent
  • CreateFileOptions -> WorkspaceEdit.CreateFile.Options
  • ParameterInformation -> SignatureHelp.Signature.Parameter
  • ClientFoldingRangeOptions -> ClientCapabilities.TextDocument.FoldingRange.Options

The difference can be easily noticed by looking at the generated documentation from Autodoc:

Zig Autodoc of lsp-kit (old) Zig Autodoc of lsp-kit (old)
Zig Autodoc of lsp-kit (new) Zig Autodoc of lsp-kit (new)

The original names from the LSP specification can still be used from the @import("lsp").types.flat namespace if preferred.

There are also various other improvements. Here are some of them I can recall:

  • remove many occurrences of anonymous types so the symbol has an easily accessible name
  • remove many occurrences of duplicate type definitions like Declaration and Definition
  • improve field names of unions
  • updated to the upcoming LSP 3.18 specification

- `types.getRequestMetadata(method)` -> `types.requests.get(method)`
- `types.getNotificationMetadata(method)` -> `types.notifications.get(method)`
- `types.request_metadata` -> `types.requests.values()`
- `types.notification_metadata` -> `types.notifications.values()`
- convert PascalCase to snake_case
- better name for array types
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.94%. Comparing base (c46ac86) to head (20dc88a).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #28      +/-   ##
==========================================
+ Coverage   97.32%   98.94%   +1.62%     
==========================================
  Files           3        3              
  Lines        1570     1519      -51     
==========================================
- Hits         1528     1503      -25     
+ Misses         42       16      -26     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Techatrix Techatrix merged commit 7c4578f into main Nov 19, 2025
3 checks passed
@Techatrix Techatrix deleted the dev branch November 19, 2025 17:43
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.

3 participants