Commit Graph

541 Commits

Author SHA1 Message Date
Gremlinflat
cd4f7c9694 lint 2024-03-28 06:07:50 +07:00
Gremlinflat
13613723a1 fix: build errors 2024-03-28 00:19:18 +07:00
Gremlinflat
b11ad16590 fix: fix mistyped line 2024-03-27 23:35:00 +07:00
Gremlinflat
b4c2f3df02 fix: fix returning empty array 2024-03-27 23:27:06 +07:00
Gremlinflat
f97e41bfd0 feat: add mergingTokens overloading method 2024-03-27 23:25:11 +07:00
Gremlinflat
45d24a86f5 chore: fix typo on copyright 2024-03-26 15:27:28 +07:00
Gremlinflat
cae8a8b1c7 lint: fix formatting 2024-03-26 06:24:06 +07:00
Gremlinflat
f392e2ffe3 feat: clean up & finish all todo 2024-03-26 01:07:41 +07:00
Gremlinflat
315fff84f8 feat: add SyntaxHighlightingTokens wrapper struct 2024-03-25 23:43:45 +07:00
Alex Hoppen
582a1000c8 Rename SwiftPMWorkspace to SwiftPMBuildSystem
All other types that conform to `BuildSystem` (which in sourcekit-lsp terms is something that can provide compiler arguments) had the `BuildSystem` suffix. `SwiftPMWorkspace` was an oddity here and was easily confused with the `Workspace` term in LSP, which essentially represents a single root folder that is being opened.
2024-03-20 22:51:28 +01:00
Alex Hoppen
0ea35886e8 Rename sourceKitServer -> sourceKitLSPServer
I forgot to rename the variables when renaming the class from `SourceKitServer` to `SourceKitLSPServer`.
2024-03-20 22:51:28 +01:00
Alex Hoppen
ed5c7e2e39 Rename language specific language services
The naming was quite inconsistent here. Let’s rename these to `LanguageService` to highlight that they belong together.

- ToolchainLanguageServer -> LanguageService
- SwiftLanguageServer -> SwiftLanguageService
- ClangLanguageServerShim -> ClangLanguageService
2024-03-20 22:51:28 +01:00
Alex Hoppen
4b5f7ffd90 Rename SourceKitServer -> SourceKitLSPServer
This avoid ambiguities whether `SourceKitServer` handles sourcekitd or `sourcekit-lsp`.
2024-03-20 22:50:34 +01:00
Alex Hoppen
83837ce3bb Merge pull request #1138 from ahoppen/ahoppen/rename-with-multiple-index-entries
Don’t fail rename if there are multiple index entries for the same USR
2024-03-20 22:44:20 +01:00
Alex Hoppen
cd07e2f9ea Merge pull request #1137 from ahoppen/ahoppen/no-work-done-progess-if-client-doesnt-support
Don’t send `WorkDoneProgressRequest` to the client if it doesn’t support work done progress
2024-03-20 14:34:28 +01:00
Alex Hoppen
3e505ed49e Merge pull request #1136 from ahoppen/ahoppen/log-opened-build-system
Log the build system with which a workspace has been opened
2024-03-20 14:34:16 +01:00
Alex Hoppen
c753cc4bf7 Merge pull request #1126 from ahoppen/ahoppen/jsonrpc-strict-concurrency
Make the `LanguageServerProtocolJSONRPC` module build with strict concurrency enabled
2024-03-20 11:35:08 +01:00
Alex Hoppen
c75a3099cd Merge pull request #1135 from ahoppen/ahoppen/fix-leaks
Fix memory leaks
2024-03-20 09:56:43 +01:00
Alex Hoppen
f90d3c9930 If there are multiple definition occurrences and getting the cross-language name fails for one symbol, try the next definition 2024-03-20 09:50:24 +01:00
Alex Hoppen
d1b527e14c Make the LanguageServerProtocolJSONRPC module build with strict concurrency enabled 2024-03-20 08:37:39 +01:00
Alex Hoppen
3007d9f392 Naming improvements, added comments and typo fixes in connection related code
This should make the code easier to understand. No functionality change.
2024-03-20 08:30:16 +01:00
Alex Hoppen
7c46df3abe Remove clientID from request handling
The client ID was needed when a `MessageHandler` could handle messages from multiple connections. We don’t support this anymore (because it wasn’t needed) and so the client ID doesn’t need to get passed through as well.
2024-03-20 08:28:26 +01:00
Alex Hoppen
252cccc420 Don’t send WorkDoneProgressRequest to the client if it doesn’t support work done progress 2024-03-19 14:38:18 +01:00
Alex Hoppen
d331206967 Log the build system with which a workspace has been opened
I thought there was an issue with opening nested SwiftPM workspaces. Turns out there wasn’t but some logging and a test case don’t hurt.

rdar://124727086
2024-03-17 16:30:11 +00:00
Alex Hoppen
86e1878536 Fix a retain cycle
I don’t remember what the exact retain cycle was after fixing it.
2024-03-17 16:24:01 +00:00
Alex Hoppen
76684c7521 Capture the SourceKitServer weakly in reloadPackageStatusCallback
If the `SourceKitServer` doesn’t have any other references anymore the LSP client is shutting down and there’s no point status updates from package reloading anymore.
2024-03-17 06:16:06 -07:00
Alex Hoppen
968828b12a Don’t fail rename if there are multiple index entries for the same USR
The test case that I’m adding right now is that we have a lingering index entry from a file that has been moved on disk. While the proper fix here would be to ignore such an entry from the index, we should also be more resilient and not fail rename altogether just because there are multiple entries for a USR – the chances are very high that they all translate to the same Swift and Objective-C name.

rdar://123937371
2024-03-17 04:39:05 -07:00
Alex Hoppen
7b9be344f8 Merge pull request #1128 from ahoppen/ahoppen/check-compiler-version
Change `#if swift(<5.11)` to `#if compiler(<5.11)`
2024-03-14 07:15:10 -07:00
Alex Hoppen
6a0a944563 Change #if swift(<5.11) to #if compiler(<5.11)
We want to check the compiler version, not the effective language version (which is 5.10 for a Swift 6 compiler).
2024-03-12 14:48:18 -07:00
Alex Hoppen
e8d0a0d431 Make SourceKitD build with strict concurrency enabled 2024-03-12 14:46:34 -07:00
Alex Hoppen
bad10cd761 Make SourceKitDRegistry an actor 2024-03-12 14:38:00 -07:00
Alex Hoppen
6efe162497 Merge pull request #1118 from ahoppen/ahoppen/concurrent-edits
Use logic in swift-syntax to translate sequential edits to concurrent edits
2024-03-08 16:18:23 -08:00
Alex Hoppen
a6fdd1d0d8 Merge pull request #1117 from ahoppen/ahoppen/sendability
Add Sendable annotations to LanguageServerProtocol, LSPLogging and SKSupport
2024-03-07 18:27:26 -08:00
Alex Hoppen
c699da96d7 Merge pull request #1112 from ahoppen/ahoppen/test-capabilities
Report whether sourcekit-lsp supports the `workspace/tests` and `textDocument/tests` requests
2024-03-05 21:15:15 -08:00
Alex Hoppen
5e2fc40b8c Report whether sourcekit-lsp supports the workspace/tests and textDocument/tests requests
Fixes #1098
rdar://123771703
2024-03-04 23:16:20 -08:00
Alex Hoppen
9e6e52a8d3 Use logic in swift-syntax to translate sequential edits to concurrent edits
Turns out that translation of sequential to concurrent edits is not trivial to implement. Use the logic in swift-syntax that is already well-tested.

rdar://123880677
2024-03-04 22:35:51 -08:00
mustiikhalil
f7f2cea7c5 Refactor willEditDocument in favor of SourceEdits
Removes willEditDocument completion block in favor of a returning SourceEdits instead.
2024-03-05 07:00:58 +01:00
Alex Hoppen
9fcf3645e9 Fix race condition in rename
We were computing the edits for the rename locations concurrently, which means that we were executing `languageServerType(of:)` concurrently, which could incur concurrent accesses to the `languageServerTypesCache` dictionary.

Introduce an actor `LanguageServerTypesCache` that manages the cache, eliminating the race.
2024-03-04 17:29:06 -08:00
Alex Hoppen
b2b66ca3c1 Support rename of functions across class hiearchies and protocols
rdar://123536502
2024-03-02 11:10:52 -08:00
Alex Hoppen
6f94d86305 Merge pull request #1103 from ahoppen/ahoppen/call-hierarchy-look-through-protocols
Show calls to satisfied protocol requirements in call hierarchy
2024-03-02 07:29:38 -08:00
Alex Hoppen
db633b5d11 Merge pull request #1114 from ahoppen/ahoppen/no-internal-name-in-snippet
Don’t include internal parameter names in LSP snippets
2024-03-02 07:28:56 -08:00
Alex Hoppen
edfe80dcdd Merge pull request #1076 from ahoppen/ahoppen/no-implicit-references
De-duplicate results from find references
2024-03-02 00:22:01 -08:00
Alex Hoppen
a0453673f5 Don’t include internal parameter names in LSP snippets
When translating editor placeholders to snippets, we should not include internal parameter names into the snippet. The problem is that once you leave snippet editing mode (essentially by moving the cursor to any place that’s not the snippet, eg. by typing a string literal for one of the parameters or moving the cursor), all snippets become verbatim text. And then it’s impossible to tell whether `paramName: ` was an annotation inside the snippet describing the internal parameter’s name or the external parameter label.

rdar://123772474
2024-03-01 21:38:01 -08:00
Alex Hoppen
d51c92a01b Infer indentation of the current source file when expanding trailing closures
rdar://123600798
2024-03-01 17:39:01 -08:00
Alex Hoppen
8fa839ca73 Show calls to satisfied protocol requirements in call hierarchy
For example in the following, we should show `proto.foo()` as a call when computing the call hierarchy of `MyStruct.foo`. Otherwise `MyStruct.foo` does not have any calls, which is misleading.

```swift
protocol MyProtocol {
  func foo()
}
struct MyStruct: MyProtocol {
  func foo() {}
}
func test(proto: MyProtocol) {
  proto.foo()
}
```

rdar://123837232
2024-03-01 15:42:38 -08:00
Alex Hoppen
cca217741a De-duplicate results from find references
We might have duplicate results for multiple references inside a macro. In this case we only want to show the macro attribute or macro expansion expr/decl once.

Fixes #1047
rdar://122237704
2024-03-01 15:32:20 -08:00
Alex Hoppen
331f16dca7 Merge pull request #1091 from ahoppen/ahoppen/markdown-documentation
Emit raw documentation comments instead of parsing XML
2024-03-01 14:05:12 -08:00
Alex Hoppen
d64a4ab136 Merge pull request #1095 from ahoppen/ahoppen/sort-index-results
Sort results returned by the index
2024-03-01 02:21:33 -08:00
Alex Hoppen
8371d9db83 Merge pull request #1072 from ahoppen/ahoppen/expand-trailing-closure
Expand trailing closures of code completion items
2024-02-29 20:03:42 -08:00
Alex Hoppen
4dea06108a Merge pull request #1104 from ahoppen/ahoppen/file-handling-capability-logging
Add some logging for `testRecomputeFileWorkspaceMembershipOnPackageSwiftChange`
2024-02-29 16:15:06 -08:00