Commit Graph

1172 Commits

Author SHA1 Message Date
Matthew Bastien
b09c7d4d24 address review comments 2025-07-23 13:56:04 -04:00
Matthew Bastien
2f2879eb39 support function parameter and return type disambiguations in textDocument/doccDocumentation requests 2025-07-22 17:29:38 -04:00
Matthew Bastien
bfbbb2f2c5 improve token searching in findNearestSymbol(syntaxTree:position:) 2025-07-14 11:25:55 -04:00
Matthew Bastien
6b6703ed23 add subscripts and deinitializers as documentable Swift symbols 2025-07-10 15:27:31 -04:00
Matthew Bastien
4238f76a60 use Language instead of String for DoccDocumentationError.unsupportedLanguage 2025-07-10 15:00:43 -04:00
Matthew Bastien
9f907b92fd improve logic for DocumentableSymbol.findNearestSymbol(node:) 2025-07-10 15:00:19 -04:00
Matthew Bastien
31d5dfcd2d add error message for unsupported languages 2025-07-10 11:22:54 -04:00
Matthew Bastien
09baabbe12 always try to render some documentation for Swift files 2025-07-10 10:25:08 -04:00
Ben Barham
d5926bf69f Run formatting after swift-format changes 2025-06-30 17:08:05 -07:00
Hamish Knight
ec37284abb Correctly handle raw identifier test suite names
Missed this in my previous patch, make sure we also add backticks
to test suite names when they use raw identifiers.
2025-06-25 22:53:33 +01:00
Hamish Knight
b17800efb6 NFC: Add comment for swift-testing display name logic 2025-06-25 17:51:31 +01:00
Hamish Knight
1f854ddf24 Merge pull request #2187 from hamishknight/tic-tac-toe
Correctly handle raw identifiers for swift-testing
2025-06-24 18:46:52 +01:00
Anthony Latsis
052cdc6ee8 .swift-format: Enable ReturnVoidInsteadOfEmptyTuple 2025-06-23 19:47:25 +01:00
Hamish Knight
e2f45ef218 Correctly handle raw identifiers for swift-testing
Make sure we insert backticks if needed for the test identifier, and
drop the parameter names from the display name if a raw identifier
is used.
2025-06-23 17:20:21 +01:00
Alex Hoppen
6143d26f14 Merge pull request #2177 from Kila2/feature/sort_prefixmapper 2025-06-15 08:15:45 +02:00
lijunliang.9819
c375dc5062 fix sort and map execute order 2025-06-12 13:51:06 +08:00
lijunliang.9819
8ecd8f6a1e Fix the issue of indexPrefixMap being unordered, which causes the IndexStoreDB path to be unpredictable. 2025-06-11 20:11:12 +08:00
Ben Barham
3c23369f24 Handle both file paths and URLs from educational notes
sourcekitd was recently switched to returning the swift.org URL for
diagnostics groups/educational notes. Handle either an absolute path
or URL.
2025-06-10 20:26:46 -07:00
Hamish Knight
e6df9e7483 Update for new ExpandEditorPlaceholdersToLiteralClosures API
This refactoring now takes a `Syntax` parameter. We don't actually
need to change anything else to handle placeholder expansion for
macro expansion completions since they get parsed as function calls.
2025-06-04 12:32:36 +01:00
Alex Hoppen
a9094391f0 Pass cancelOnSubsequentRequest: 0 to all requests that support it
Adopt the option introduced by https://github.com/swiftlang/swift/pull/81507. SourceKit-LSP uses explicit cancellation and perform any implicit cancellation inside sourcekitd.

Fixes #2021
rdar://145871554
2025-05-15 10:42:07 +02:00
Alex Hoppen
188e174cde Merge pull request #2094 from ahoppen/contextual-sourcekitd-request
Log contextual requests that affect sourcekitd’s global state
2025-05-14 19:12:58 +02:00
Alex Hoppen
3f1568c68d Merge pull request #2144 from ahoppen/refresh-semantic-tokens
Send `workspace/semanticTokens/refresh` to client when build settings have changed
2025-05-12 19:16:42 +02:00
Alex Hoppen
69ab356b36 Log contextual requests that affect sourcekitd’s global state
This way we can log them when a sourcekitd request crashes and we can thus replay these contextual requests when diagnosing the crash.
2025-05-12 15:39:52 +02:00
Alex Hoppen
863c0e2cdf Merge pull request #2137 from ahoppen/terminate-unresponsive-clangd-sourcekitd
If sourcekitd or clangd don’t respond to a request for 5 minutes, terminate them and use crash recovery to restore behavior
2025-05-12 15:13:30 +02:00
Alex Hoppen
1bc7d85dbd Send workspace/semanticTokens/refresh to client when build settings have changed
Similar to how we send a `workspace/diagnostic/refresh` request to the client when we get new build settings, we need to send a `workspace/semanticTokens/refresh` to the client to reload semantic tokens when builds settings change. This is particularly important so that we reload semantic tokens from real build setting after a SwiftPM package has finished loading (we previously used fallback settings).

Fixes #2141
rdar://150934682
2025-05-09 13:33:35 +02:00
Alex Hoppen
14cfd50582 If sourcekitd or clangd don’t respond to a request for 5 minutes, terminate them and use crash recovery to restore behavior
This should be a last stop-gap measure in case sourcekitd or clangd get stuck, don’t respond to any requests anymore and don’t honor cancellation either. In that case we can restore SourceKit-LSP behavior by killing them and using the crash recovery logic to restore functionality.

rdar://149492159
2025-05-07 13:43:28 +02:00
Alex Hoppen
f433f58448 Miscellaneous small cleanups 2025-04-23 18:54:45 +02:00
Alex Hoppen
82c5fa9789 Remove snapshotFromDisk
The function isn’t used anymore
2025-04-23 18:54:45 +02:00
Alex Hoppen
d8aeeaffe6 Only pass key and not value to LRUCache.removeAll(where:)
The value isn’t needed here and the calls become cleaner if only the key is passed.
2025-04-23 18:54:45 +02:00
Alex Hoppen
bc4d9c78e7 Remove public modifiers from MarkdownTitleFinder 2025-04-23 18:54:45 +02:00
Alex Hoppen
1355b203c0 Use on-disk contents of a source file to get the position of a symbol occurrence
The index refers to on-disk locations and since the cursor info below also operates on the on-disk contents, we should use the on-disk contents of the file to convert the symbol occurrence location to a `Position`.
2025-04-23 18:54:45 +02:00
Alex Hoppen
024efc2fa1 Remove dependency from SourceKitLSP on swift-docc-symbolkit
This way all dependencies on the `docc` libraries are wrapped inside the `DocCDocumentation` module.
2025-04-23 18:54:45 +02:00
Alex Hoppen
bbbc93ea01 Refactor cursorInfoFromDisk to share the underlying logic of invoking cursor info 2025-04-23 18:54:42 +02:00
Matthew Bastien
4fb5323bd4 add cursorInfoFromDisk() to SwiftLanguageService 2025-04-22 15:14:36 -04:00
Matthew Bastien
2ae2e709b3 add LRUCache struct to SKUtilities 2025-04-17 13:46:01 -04:00
Matthew Bastien
c24f92d73e add documentation for certain functions 2025-04-16 15:13:04 -04:00
Matthew Bastien
c37c596562 fix newline matching 2025-04-16 14:54:55 -04:00
Matthew Bastien
131c8113d5 add logging to SwiftLanguageService.doccDocumentation(_:) 2025-04-16 14:54:55 -04:00
Matthew Bastien
1c65bda727 remove some nesting levels in DocumentationLanguageService.doccDocumentation(_:) 2025-04-16 14:54:55 -04:00
Matthew Bastien
0ea0e00c55 use LinkCompletionTools to parse SwiftDocC symbol links 2025-04-16 14:44:13 -04:00
Matthew Bastien
4e06c36c70 organize imports 2025-04-16 14:44:13 -04:00
Matthew Bastien
8c15e27959 use a helper document in cursorInfo() 2025-04-16 14:44:12 -04:00
Matthew Bastien
1ca1441054 fix some review comments 2025-04-16 14:44:12 -04:00
Matthew Bastien
0adaf2581f more robust searching for DocC catalogs 2025-04-16 14:44:12 -04:00
Matthew Bastien
a8eae3c6d8 remove protocols from DocCDocumentation module 2025-04-16 14:44:12 -04:00
Matthew Bastien
c1a6e65efd add CMake build to DocCDocumentation module 2025-04-16 14:44:11 -04:00
Matthew Bastien
49b3f531eb move SwiftDocC related functionality into its own module 2025-04-16 14:44:11 -04:00
Matthew Bastien
24118ebc78 cleanup unused code 2025-04-16 14:44:11 -04:00
Matthew Bastien
39bf4852b0 handle Markdown and Tutorial files in textDocument/doccDocumentation 2025-04-16 14:44:11 -04:00
Alex Hoppen
254b42a406 Merge pull request #2098 from ahoppen/swift-format-crashing
Don’t crash SourceKit-LSP if swift-format crashes while we write the source file to stdin
2025-03-28 14:17:51 -07:00