Commit Graph

55 Commits

Author SHA1 Message Date
Alex Hoppen caa4b97c57 Merge pull request #2597 from Steffeeen/inlay-hint-performance
Cache inlay hints to avoid flickering
2026-04-30 15:37:42 +02:00
Steffeeen aa3497e96c Rename DocumentSnapshot.absolutePositionRange() to positionRange()
This matches the naming of the `position` and `absolutePosition`
methods.
2026-04-07 10:47:59 +02:00
Rintaro Ishizaki df14928358 Merge pull request #2553 from Tabonx/convert-comment-to-doc-comment
Add ConvertCommentToDocComment refactoring action
2026-03-31 09:53:26 -07:00
Rintaro Ishizaki a9566ac183 [LSPAny] Replace manual LSPAnyCodable impl with Codable-backed default
Remove hand-written `init?(fromLSPDictionary:)` / `encodeToLSPAny()`
from LSPAnyCodable types, relying instead on the default implementations
backed by `LSPAnyEncoder`/`LSPAnyDecoder`
2026-03-22 08:01:17 -07:00
Pavel Kroupa 394bc3e19e Merge branch 'main' into convert-comment-to-doc-comment
# Conflicts:
#	Tests/SourceKitLSPTests/CodeActionTests.swift
2026-03-21 21:30:43 +01:00
Pavel Kroupa a58a89c31b Add ConvertCommentToDocComment refactoring action 2026-03-15 20:32:54 +01:00
Alex Hoppen 07f8686456 Sort code actions in SyntaxRefactoringCodeActionProvider alphabetically
Also move them to the end of the file, where it’s easier to extend the list in the future.
2026-02-28 19:32:19 +01:00
Alex Hoppen 8920d78f3b Report convert-to-computed and convert-to-stored refactoring actions
These were implemented in swift-syntax but never added to the list of refactoring actions reported by SourceKit-LSP.

While at this, also fix two other things:
- Report an error if we non-exhaustively checked that we had an empty array of code actions, since this was a tautology
- Allow ignoring code actions that we don’t want to check for (needed to write sensible exhaustive checks)
- Fixed a bug that caused convert-to-zero-parameter-function to be reported when on a return statement in an accessor block
2026-02-28 19:31:36 +01:00
Alex Hoppen bc58ce982b Add infrastructure to allow easier implementation of code actions that have a non-Void context
Not really needed at the moment but may become useful in the future.
2026-02-28 19:13:32 +01:00
Karan 7435345133 Add RemoveRedundantParentheses refactoring action
Signed-off-by: Karan <karanlokchandani@protonmail.com>
2026-02-23 01:07:05 +05:30
loveucifer 5b4af90a81 Apply .indented(by:) 2026-02-15 21:53:01 +05:30
loveucifer e1f1e08cc9 some fixes 2026-02-09 16:44:58 +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 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 4d08603e30 fix trivia handling 2026-01-17 15:12:27 +05:30
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
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
loveucifer d465ba967a multiline string interpolation 2026-01-09 16:09:33 +05:30
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
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
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
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
Anthony Latsis 6b19657739 Enable ExistentialAny 2025-12-02 12:27:27 +00:00
Vladimir Gusev 9647dcc3dc Convert between computed properties and zero-parameters functions 2025-11-14 12:00:46 +03:00
Owen Voorhees f04b971726 Adopt swift-tools-protocols 2025-10-31 14:11:11 -07:00
Alex Hoppen 4c957506e8 Add a code action to remove unused imports in a source file
The idea is pretty simple: When `MemberImportVisibility` is enabled, we know that imports can only affect the current source file. So, we can just try and remove every single `import` declaration in the file, check if a new error occurred and if not, we can safely remove it.
2025-10-22 23:56:09 +02:00
Alex Hoppen aa7ff70042 Merge pull request #2300 from ahoppen/drop-6.1
Drop support for building with Swift 6.1
2025-09-22 14:16:39 +02:00
Alex Hoppen c7ca73aecb Drop support for building with Swift 6.1
Swift 6.2 has been released, so we no longer need to support building and testing SourceKit-LSP using Swift 6.1
2025-09-20 16:37:24 +02:00