11 Commits

Author SHA1 Message Date
loveucifer
6028898c13 Optimize index usage for typeDefinition and inlay hint resolve requests. 2026-02-08 23:20:18 +05:30
loveucifer
cccdde295c Use any LanguageService instead of closures 2026-01-30 02:47:52 +05:30
loveucifer
cf56bf2ce6 Address PR review feedback
- Add DefinitionLocations.swift to CMakeLists.txt
- Add proper documentation comments to functions in DefinitionLocations.swift
- Make indexToLSPLocation private since it's only used within the file
- Revert unrelated comment changes in InlayHintResolve.swift
- Use .only instead of .first in InlayHintResolve to avoid ambiguous types
- Refactor TypeDefinition.swift to use cleaner control flow with guard/else
- Add test for jumping to generated interface (String)
2026-01-19 17:12:33 +05:30
loveucifer
0e52fede00 unify definition locations 2026-01-18 16:28:55 +05:30
loveucifer
ceaf87b6df Run swift-format 2026-01-12 06:15:38 +05:30
loveucifer
22e7ac048f Add generated interface support for SDK types in inlay hints 2026-01-11 17:04:39 +05:30
loveucifer
3630ab970c Address review feedback for inlay hint go-to-definition
- Use cursorInfo USR lookup instead of index (more accurate)
- Add document version tracking to reject stale resolve requests
- Make InlayHintResolveData conform to LSPAnyCodable
- Reference swiftlang/swift#86432 for mangled type workaround
- cursorInfoFromTypeUSR takes DocumentSnapshot for version safety
- Remove TypeDefinition.swift (defer to follow-up PR)
- Remove unnecessary comments
- Tests work without index
2026-01-10 07:00:43 +05:30
loveucifer
564a45b03c Add go-to-definition for inlay type hints 2026-01-09 23:46:58 +05:30
loveucifer
27cf04e2ed Implement textDocument/typeDefinition request (#548)
Add support for the textDocument/typeDefinition LSP request, which
finds the type of the symbol at a given position and returns the
location of that type's definition.

This uses the same type definition lookup mechanism as the inlay hint
resolution feature, which queries cursorInfo for the new type
declaration location fields (typeDeclFilePath/Line/Column) with
fallback to index lookup using typeDeclUsr.

Fixes #548
2026-01-08 21:10:47 +05:30
loveucifer
f46a31ba3d Use new cursorInfo type declaration fields for inlay hints
update inlay hint resolution to use the new type declaration location

fields from cursorInfo, with fallback to index lookup using the new

typeDeclUsr (a proper declaration USR).

Changes i made :

- Regenerated sourcekitd_uids.swift with new keys

- InlayHintResolve.swift: Try direct location first, fallback to index

- InlayHintTests.swift: Fixed test to properly verify location

This Requires: swift/swiftlang PR## #86381  for compiler changes
2026-01-08 21:00:17 +05:30
loveucifer
8e300ee443 add go-to-definition for inlay hints (#2318)
Implements resolveProvider for inlay hints to enable navigating to type
definitions. When an inlay hint showing a type is resolved, the server
looks up the type's definition location using cursorInfo and the index.

- store variable position in InlayHint.data for resolution
- add inlayHintResolve to LanguageService protocol
- implement resolve handler using cursorInfo and index lookup
- enable resolveProvider: true in capabilities
- add test for resolve functionality

Addresses #2318
2026-01-06 19:35:06 +05:30