123 Commits

Author SHA1 Message Date
Alex Hoppen
ce86aae504 Merge pull request #2483 from ahoppen/explicitly-close-index 2026-03-01 08:18:19 +01:00
Alex Hoppen
ad4b87ce6b Merge pull request #2467 from Steffeeen/selection-range 2026-03-01 08:17:54 +01:00
Steffeeen
d748f80896 Implement support for textDocument/selectionRange
This enables hierarchical selection expansion in supported editors.

Selection ranges are computed from the AST by walking upward from the
smallest enclosing node to the root. This is implemented by AST nodes
conforming to the `SelectionRangeProvider` protocol. Most nodes use a
default implementation which returns the node's `trimmedRange`.
Other nodes are special-cased to adjust the returned selection ranges
based on other factors.
2026-02-26 09:15:01 +01:00
Karan
7435345133 Add RemoveRedundantParentheses refactoring action
Signed-off-by: Karan <karanlokchandani@protonmail.com>
2026-02-23 01:07:05 +05:30
Alex Hoppen
2f472da57b Merge pull request #2443 from loveucifer/multiline-string-interpolation
add support for multi-line string literals when converting string concatenation to string interpolation
2026-02-16 15:51:23 +01:00
Alex Hoppen
425e1322a1 Explicitly close the index when shutting down SourceKit-LSP
`IndexStoreDB` moves its index to the `saved` directory when it is deallocated. Because `IndexStoreDB` is primarily owned by `UncheckedIndex`, we rely on deallocating this object to save the index store. This is fairly brittle because various parts of the codebase may hold transient references to that object as reported in https://github.com/swiftlang/sourcekit-lsp/issues/2455#issuecomment-3873561003.

Explicitly remove the reference from `UncheckedIndex` to `IndexStoreDB`. While this still isn’t perfect because other parts of the code base may hold references to `IndexStoreDB` but those should be a lot rarer, resulting in a more consistent closing of the index.
2026-02-15 18:02:53 +01:00
loveucifer
5b4af90a81 Apply .indented(by:) 2026-02-15 21:53:01 +05:30
loveucifer
f1f46f586f Add TypeDefinition.swift to CMakeLists.txt 2026-02-10 09:23:55 +05:30
loveucifer
e1f1e08cc9 some fixes 2026-02-09 16:44:58 +05:30
loveucifer
e786a1450c swift format 2026-02-08 23:25:25 +05:30
loveucifer
6028898c13 Optimize index usage for typeDefinition and inlay hint resolve requests. 2026-02-08 23:20:18 +05:30
loveucifer
c6e54fb46a Fix multiline string support in string concatenation to interpolation refactoring 2026-02-05 13:11:40 +05:30
loveucifer
250f6f62aa Fix multiline string indentation stripping and remove duplicate test 2026-01-30 02:58:25 +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
4770e0c73e address reviewer feedback: use IndentationRemover for trivia-only indentation handling
- Replace custom stripIndentation with IndentationRemover
- Update test expectations to preserve content indentation (trivia-only)
- Add clarifying comment for trailing trivia removal
- Use Swift commas in conditions
- Simplify trailing trivia removal code
2026-01-19 16:44:37 +05:30
loveucifer
e0dcca98c4 merge upstream main 2026-01-18 16:37:39 +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
4d08603e30 fix trivia handling 2026-01-17 15:12:27 +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
loveucifer
4ece7f9eea fix trailing trivia handling 2026-01-15 08:02:34 +05:30
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
loveucifer
d465ba967a multiline string interpolation 2026-01-09 16:09:33 +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