Commit Graph

104 Commits

Author SHA1 Message Date
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
82a7726297 fix type annotation 2026-01-17 16:17:59 +05:30
loveucifer
b7e76ff90e unify typeDefinition 2026-01-17 16:17:59 +05:30
loveucifer
2a360c046e address comments 2026-01-17 16:17:59 +05:30
loveucifer
d8b8d71fae Implement textDocument/typeDefinition request 2026-01-16 18:13:12 +05:30
Alex Hoppen
61ba0c92a4 Merge pull request #2436 from loveucifer/inlay-hint-go-to-definition 2026-01-16 13:16:45 +01:00
Alex Hoppen
155b0ce003 Merge pull request #2432 from ahoppen/suppress-superseded-sourcekitd-refactorings
Don’t show sourcekitd refactoring actions that have been superseded by swift-syntax refactoring actions
2026-01-16 07:42:33 +01:00
Karan Lokchandani
55d75954e5 Add if let to guard transform (#2420)
fixes: https://github.com/swiftlang/sourcekit-lsp/issues/1569

mostly works but not sure what to do with many edge cases and has a todo
for switch statements, also this will probably have conflicts with
https://github.com/swiftlang/sourcekit-lsp/pull/2406 marking as draft
till that merges and i can resolve the conflicts.


https://github.com/user-attachments/assets/a6d07f9d-6f09-4330-8cd0-2d24bd6973fb

---------

Signed-off-by: Karan <karanlokchandani@protonmail.com>
2026-01-13 22:46:54 +01:00
loveucifer
45b1598b9a Add InlayHintResolve.swift to CMakeLists.txt 2026-01-13 07:36:05 +05:30
Alex Hoppen
3b2ff3226f Merge pull request #2448 from PhantomInTheWire/fix/demorgan
Fix bugs in demorgan implementation
2026-01-12 15:02:04 +01:00
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
81610b3665 Simplify InlayHintResolveData using Position LSPAnyCodable 2026-01-11 16:52:41 +05:30
Karan
40206bc7b8 cleanup demorgan
Signed-off-by: Karan <karanlokchandani@protonmail.com>
2026-01-11 15:16:29 +05:30
Karan
babb3eaae2 Fix try fusion bug 2026-01-11 08:38:14 +05:30
Karan
04ca5078cc Fix indentation and trivia not being attached to new negation
Signed-off-by: Karan <karanlokchandani@protonmail.com>
2026-01-11 08:28:02 +05:30
Karan
50e073a876 propagate negation through try 2026-01-11 01:49:54 +05:30
Karan
b8395b5fb1 Fix trivia drop bug 2026-01-11 01:49:54 +05:30
Karan
8e21958760 Add more expr to whitelist 2026-01-11 01:49:54 +05:30
Ahmad Ayman Mansour
b8e4d2def2 Merge remote-tracking branch 'upstream/main'
# Conflicts:
#	Tests/SourceKitLSPTests/DefinitionTests.swift
2026-01-10 18:27:01 +02:00
Ahmad Ayman Mansour
80c9e43250 Skip jump-to-definition for literal values
Return empty response when cursor is on literal tokens (strings,
integers, floats, booleans, nil) since they have no declaration.

Resolves #2368

Co-Authored-By: clemo97 <lumumbaclement@gmail.com>
2026-01-10 18:21:29 +02:00
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
Alex Hoppen
29a0bdd15f Merge pull request #2395 from PhantomInTheWire/feat/add-parameterLabel-modifier 2026-01-09 10:51:23 +01:00
Alex Hoppen
2d8a44af76 Merge pull request #2422 from loveucifer/fix-language-service-shutdown-2211 2026-01-09 08:46:25 +01:00
Alex Hoppen
fc876d01a4 Merge pull request #2433 from DPrakashhh/fix/no-computed-property-for-void-2430
Fix #2430: Hide 'Convert to computed property' for Void functions
2026-01-08 16:59:14 +01:00
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
Alex Hoppen
69785ccb0a Merge pull request #2435 from PhantomInTheWire/fix/indenation-codeable-structs
Fix JSON base indentation in Create Codable structs
2026-01-08 10:58:58 +01:00
Divya Prakash
a9331eacea restored extensions and removed functions 2026-01-08 14:45:43 +05:30
Divya Prakash
e987d9478b removed: helper extension 2026-01-08 09:59:57 +05:30
loveucifer
2019ab711a mark SwiftLanguageService as immortal to skip shutdown 2026-01-08 05:01:42 +05:30
Divya Prakash
88e4d02b24 Made changes based on review 2026-01-07 21:59:46 +05:30
Karan
ae121bc112 use node.indentationOfFirstLine to simplify 2026-01-07 13:59:09 +05:30
Karan
2a64797c1a Add more edge cases 2026-01-07 03:22:19 +05:30
Karan
e40a6a4e5a Refactor initialIndentation in BasicFormat
Signed-off-by: Karan <karanlokchandani@protonmail.com>
2026-01-07 02:52:47 +05:30
Karan
9046173872 Fix to use file indentation and not json identation
Signed-off-by: Karan <karanlokchandani@protonmail.com>
2026-01-07 02:29:58 +05:30
Karan
28fb997071 Minor test and header fix 2026-01-07 01:02:15 +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
Karan
fb98b7b032 Fix JSON base indentation in Create Codable structs
Signed-off-by: Karan <karanlokchandani@protonmail.com>
2026-01-06 18:05:28 +05:30
Karan
874aeb0c88 collect all valid code actions 2026-01-06 16:47:22 +05:30
Karan
906421662b refactor to avoid cast calls
Signed-off-by: Karan <karanlokchandani@protonmail.com>
2026-01-06 16:04:30 +05:30
Karan
80657b1827 reduce access level of DeMorganTransformer to package 2026-01-06 15:46:50 +05:30
Karan
60da2439cb feat(swift-language-service): implement De Morgan's Law code action
Signed-off-by: Karan <karanlokchandani@protonmail.com>
2026-01-06 15:18:38 +05:30
Divya Prakash
f095486c91 Fix #2430: Hide 'Convert to computed property' for Void functions 2026-01-06 14:15:00 +05:30
Alex Hoppen
529c9fa7e2 Don’t show sourcekitd refactoring actions that have been superseded by swift-syntax refactoring actions
For now, this is only the action to add thousands separators to integer literals but hopefully this list will grow as we translate more refactoring actions to swift-syntax.
2026-01-06 09:07:38 +01:00
loveucifer
934073dfdc some more mappings 2026-01-05 18:46:56 +05:30
loveucifer
d64cc0b463 map semantic refactoring kinds to specific LSP code action kinds 2026-01-04 21:00:59 +05:30
Alex Hoppen
7495f5532f Merge pull request #2387 from DPrakashh/feature/snippets-2118
[#2118] Implement keyword snippets for control-flow keywords (if/for/while/etc.)
2025-12-21 12:05:49 +01:00