Commit Graph

10 Commits

Author SHA1 Message Date
Alex Hoppen
c34d9e20fe Interpret the working directories in compile_commands.json relative to the directory that contains compile_commands.json
Fixes #1908
2025-10-30 08:38:08 +01:00
Alex Hoppen
2305dfab7a Don't escape slashes in various JSONEncoders
This makes the JSON easier to work with, especially for paths.
2025-03-03 07:55:09 -08:00
Ben Barham
96247c0472 Add sendable annotation to userInfo closure
swift-foundation recently landed a change (in
swiftlang/swift-foundation#764) which requires `any Sendable` values in
`JSONEncoder.userInfo`. This causes a build failure:
```
JSONRPCConnection.swift:370:50: error: type '(RequestID) -> Optional<any ResponseType.Type>' does not conform to the 'Sendable' protocol
368 |
369 |     // Setup callback for response type.
370 |     decoder.userInfo[.responseTypeCallbackKey] = { (id: RequestID) -> ResponseType.Type? in
    |                                                  |- error: type '(RequestID) -> Optional<any ResponseType.Type>' does not conform to the 'Sendable' protocol
    |                                                  `- note: a function type must be marked '@Sendable' to conform to 'Sendable'
371 |       guard let outstanding = self.outstandingRequests[id] else {
372 |         logger.error("Unknown request for \(id, privacy: .public)")
```

Make the closure sendable, which is safe as we're only reading from
`outstandingRequests` (where all our writes are guarded by the same
queue that the decoding is on).
2025-02-17 08:31:07 -08:00
Alex Hoppen
c4e246b351 Add BSP definitions for task start, progress and finish notifications 2024-11-05 21:58:28 -08:00
Alex Hoppen
5d1eb73a68 Revert "Add an extra percent encoding layer when encoding DocumentURIs to LSP requests"
This reverts commit b2c17c748d.

The workaround isn’t needed anymore because we have a proper fix in the VS Code extension: https://github.com/swiftlang/vscode-swift/pull/1026
2024-09-10 14:51:28 -07:00
Alex Hoppen
b2c17c748d Add an extra percent encoding layer when encoding DocumentURIs to LSP requests
The URI standard RFC 3986 is ambiguous about whether percent encoding and their represented characters are considered equivalent. VS Code considers them equivalent and treats them the same:

```js
vscode.Uri.parse("x://a?b=xxxx%3Dyyyy").toString() -> 'x://a?b%3Dxxxx%3Dyyyy'
vscode.Uri.parse("x://a?b=xxxx%3Dyyyy").toString(/*skipEncoding=*/true) -> 'x://a?b=xxxx=yyyy'
```

This causes issues because SourceKit-LSP's macro expansion URLs encoded by URLComponents use `=` do denote the separation of a key and a value in the outer query. The value of the `parent` key may itself contain query items, which use the escaped form '%3D'. Simplified, such a URL may look like `scheme://host?parent=scheme://host?line%3D2`.

But after running this through VS Code's URI type `=` and `%3D` get canonicalized and are indistinguishable.

To avoid this ambiguity, always percent escape the characters we use to distinguish URL query parameters, producing the following URL: `scheme://host?parent%3Dscheme://host%3Fline%253D2`.
2024-08-19 21:41:50 -07:00
Alex Hoppen
1ef71cf663 Merge LSPTestSupport and SKTestSupport 2024-07-25 09:11:13 -07:00
Alex Hoppen
05ecd26d08 Reorganize the repository into a set of bare LSP modules and SourceKit modules
We will be able to split the LSP modules off later. These LSP modules
will provide the ability to write custom LSP servers and clients in
Swift. The sourcekit-lsp repository will build on top of this new
package to provide an LSP implementation that creates a language server
for Swift and C-based-languages.
2019-11-14 10:35:06 -08:00
Abdullah Selek
360f88b6db Use Void over () on SKTestSupport files. 2018-12-08 18:32:12 +00:00
Ben Langmuir
aabf57a252 Import SourceKit-LSP sources 2018-11-13 15:50:48 -08:00