Commit Graph

692 Commits

Author SHA1 Message Date
Max Desiatov
95709feced Bump swift-tools-version to 5.5 (#696)
In addition to Swift Concurrency, Swift 5.5 also introduces `get throws` properties, which would allow us to fix numerous warnings related to non-throwing `AbsolutePath.init` deprecation.
2023-02-08 19:29:21 +00:00
Max Desiatov
effcb1c20a Move Platform to SwiftPM (#704) 2023-02-07 09:48:26 +00:00
Hamish Knight
3c31a0e6d9 Merge pull request #672 from hamishknight/express-yourself
Update for SwiftSyntax if/switch expression work
2023-02-03 16:40:26 +00:00
Max Desiatov
6df8f25802 SKCore: fix identifer typo in comments 2023-01-31 15:40:04 +00:00
Alex Hoppen
0a50674b80 Merge pull request #693 from ahoppen/ahoppen/remove-shutdown-request-decoding-workaround
Remove workaround for SR-16097 to decode Shutdown request
2023-01-14 08:38:33 +01:00
Alex Hoppen
66c598430a Remove workaround for SR-16097 to decode Shutdown request
rdar://92254952
2023-01-13 17:04:35 +01:00
Hamish Knight
9cb32f235f Update for SwiftSyntax if/switch expression work 2023-01-13 10:28:05 +00:00
Alex Hoppen
b7da2a6884 Ensure there are always newlines in a genrated markdown comment
Fixes #690
Fixes rdar://103911070
2023-01-11 11:17:52 +01:00
Saleem Abdulrasool
b55057a1a1 build: repair the build after the TSCUtility changes
SKSupport now requires a link against Foundation, update the build
system to track that dependency.

Co-authored-by: Max Desiatov <m_desiatov@apple.com>
2023-01-04 21:28:10 -08:00
Saleem Abdulrasool
4bbd74f105 SourceKit: sever dependency on TSCUtility
The dependency on `TSCUtility` was strictly for identifying the platform
of execution. This logic is relatively self-contained and effectively an
extension over an enumeration. Replicate this logic with updates for new
syntactic improvements. This allows us to partially reduce dependency on
swift-tools-support-core. The dependency on TSCBasic is more complicated
to remove due to the extensive use of `AbsolutePath`.

Co-authored-by: Alex Hoppen <alex@alexhoppen.de>
2023-01-02 12:30:28 -08:00
Ben Barham
f75d20f46b Merge pull request #680 from bnbarham/update-inlay-provider-registration
Update `inlayHintProvider` registration
2022-12-15 14:57:48 -08:00
Ben Barham
73af860ac2 Update inlayHintProvider registration
The LSP API allows a boolean here:
```
	/**
	 * The server provides inlay hints.
	 *
	 * @since 3.17.0
	 */
	inlayHintProvider?: boolean | InlayHintOptions
		 | InlayHintRegistrationOptions;
```

Update our server capabilities to allow this.

Resolves rdar://102913088.
2022-12-15 11:26:29 -08:00
Artem Chikin
05b03c124e Fix CMake build by adding missed new files to CMakeLists 2022-12-14 09:50:38 -08:00
Bart Whiteley
d2f7f2f3c6 Generate textual Swift interfaces for module references 2022-12-12 12:45:21 -07:00
Max Desiatov
5b16c3e19d LanguageServerProtocol: handle new files with CMake (#677)
New files not available to CMake causes build failures on Windows.
2022-12-07 17:22:42 +00:00
Alex Hoppen
ca45a7a62b Return a .serverCancelled error code if the server cancels a request
`.cancelled` should only be returned if the client requested cancellation.
2022-12-05 08:45:36 +01:00
Alex Hoppen
975286d353 Update capability definitions to LSP 3.17 2022-12-04 19:56:51 +01:00
Alex Hoppen
a4c7688cab Merge pull request #670 from ahoppen/ahoppen/scratch-path
Rename --scratch-path to --build-path
2022-12-04 18:14:57 +01:00
Alex Hoppen
fa9b5f96ac Add a test case checking that documentDependenciesUpdated works for clang
We weren’t sure if it works because it always sends 0 as the document’s version number, but everythig appears to be fine.
2022-12-02 09:53:19 +01:00
Alex Hoppen
93a8f91436 Update request and notification definitions to LSP 3.17 2022-12-01 10:44:40 +01:00
Alex Hoppen
bf00048d54 Rename --scratch-path to --build-path
Resolves #662
rdar://101628335
2022-11-24 07:32:00 +01:00
Saleem Abdulrasool
fb351c73d5 SourceKitLSP: add new dependency introduced in SwiftSyntax
Add a dependency on IDEUtils that is missing in the build.
2022-10-26 14:03:11 -07:00
Alex Hoppen
a7ae0edf6a Add dependency on IDEUtils
Reflect for the fact that SyntaxClassifier has moved to a new `IDEUtils` module.
2022-10-26 20:09:45 +02:00
Max Desiatov
4fcb624567 SKCore: use PackageModel.BuildFlags instead of TSC (#659)
As TSC would like to deprecate `BuildFlags` (https://github.com/apple/swift-tools-support-core/pull/359), let's use new `struct BuildFlags` from SwiftPM's `PackageModel`.
2022-10-25 19:31:55 +01:00
Ruslan Latypov
c94c48415d fix scripts extension comparison to include dot 2022-10-24 14:41:58 +01:00
Ruslan Latypov
8ba893118c SKCore: allow non python build servers 2022-10-21 17:43:48 +01:00
Boris Bügling
2c89019f43 Merge pull request #656 from neonichu/adopt-to-new-packagegraph-api
Adopt to new package graph API
2022-10-20 13:28:03 -07:00
Robert Widmann
4b9ab7f1bc Redo the Folding Range Request on top of the Syntax Tree
Building upon the infrastructure that requests the lexical structure of the document from SwiftSyntax, redo the folding ranges request using the tree directly. This corrects a number of inconsistencies in the tests mostly due to incorrect SourceLocations in the semantic ASTs and the line comment merging logic.
2022-10-19 23:37:11 -07:00
Boris Buegling
f9ced14804 Adopt to new package graph API
https://github.com/apple/swift-package-manager/pull/5806 adds an extra argument which requires a small change here.
2022-10-19 22:14:36 -07:00
Robert Widmann
3124c962b0 Merge pull request #651 from apple/syn-city 2022-10-19 21:39:12 -07:00
Robert Widmann
bba47a4d72 Update CMake Build to Include SwiftSyntax 2022-10-19 20:22:46 -07:00
Boris Buegling
43c072dc84 Adopt to path API changes
We are moving to a better model for TSC's path APIs in apple/swift-tools-support-core#353. The previous API is still available (but deprecated) as much as possible, but since SourceKit-LSP was using `resolveSymlinks` (which is now throwing) quite a bit, there are some changes necessary.
2022-10-18 15:28:54 -07:00
Robert Widmann
fdae671359 Refactor DocumentTokens to Use the New Parser
Re-core the "lexical" token stream on top of SwiftSyntax and call into the parser to (re-)generate these "lexical tokens" when the document changes. Leave the semantic tokens alone since they take some non-zero amount of name lookup to fully resolve references to fully replicate.
2022-10-18 00:47:20 -07:00
Boris Bügling
bf9d51e939 Remove use of deprecated option 2022-10-13 19:24:07 -07:00
Robert Widmann
0b89da4920 Implement textDocument/declaration
A declaration request is similar to a definition request, except that it is expected to return (potentially) many results across the workspace for a given reference. For example, an inline function or macro may have many declarations in the workspace, but only one "good" or canonical definition. For now, this is only implemented by forwarding the request on to clangd since I'm unfamiliar with a SourceKit query for this.

For languages like Swift that lack such a sharp declaration/definition split, we could potentially use this request to provide navigable metadata on linked definitions. For example, the declaration for a type reference would include all extensions of that type in the workspace.
2022-10-10 11:29:07 -07:00
Boris Bügling
9fa5fef647 Merge pull request #643 from apple/neonichu/no-deprecated-api
Move off deprecated SwiftPM API
2022-10-05 09:38:13 -07:00
Boris Bügling
37e051883b Update SwiftPMWorkspace.swift 2022-10-04 21:43:18 -07:00
Boris Bügling
0bd291eafe Move off deprecated SwiftPM API
`workingDirectory` has been deprecated for ~6 months and is going to be removed.
2022-09-30 11:45:23 -07:00
Saleem Abdulrasool
44414c5f1f SourceKitLSP: use AbsolutePath to compute the filename
Rather than treating the filename as an opaque string and splitting on
`/`, use `AbsolutePath` to perform the `basename` operation on the path.
This ensures that we split the path properly on platforms which do not
use the POSIX path separator `/`.
2022-09-29 13:26:37 -07:00
Saleem Abdulrasool
7dafade906 Update CMakeLists.txt
Add a dependency on TSCBasic for LanguageServerProtocol.  This dependency was added recently via an `import` and was updated in Package.swift but was missed in the CMake build.
2022-09-27 10:08:33 -07:00
Saleem Abdulrasool
e8aa1fb7f2 Merge pull request #639 from compnerd/cast
LanguageServerProtocolJSONRPC: avoid failing cast on Windows
2022-09-27 08:20:04 -07:00
Saleem Abdulrasool
223f98906e LanguageServerProtocolJSONRPC: avoid failing cast on Windows
This error code is poorly mapped on Windows and results in a runtime
failure.  Avoid the cast to improve stability.
2022-09-25 08:53:32 -07:00
Saleem Abdulrasool
89c591c16a SourceKitLSPTests: convert to native path spellings
Explicitly convert paths from POSIX spelling to native spelling in a
number of cases.  These changes help improve the test coverage on
Windows.
2022-09-24 16:09:08 -07:00
Saleem Abdulrasool
4896cc6fe7 SKCore: use resolvingSymlinks to resolve symlinks
Rather than using the `resolvingSymlinksInPath` on `URL` use
`resolvingSymlink` from tools-support-core as the semantics for the two
differ ever so slightly which matters for Windows (the former expands
symlinks on the terminal arc iterative where as the latter simply
expands the path).
2022-09-21 09:42:53 -07:00
Saleem Abdulrasool
ce24416af2 Merge pull request #630 from compnerd/explicit
explicitly import TSCBasic types
2022-09-12 09:06:07 -07:00
Saleem Abdulrasool
7d1bcee1b0 explicitly import TSCBasic types
Explicitly import interfaces from TSCBasic which now allows us to
identify all the swift-tools-support-core interfaces which are in
use in SourceKit-LSP.
2022-09-10 12:53:30 -07:00
Saleem Abdulrasool
1daa9a9f80 SKTestSupport,SourceKitLSPTests: use new swift member
Migrate to `swift` member for the swift driver rather than trying to
create it by dropping the last character in the path to the swift
compiler which may be part of the file extension.
2022-09-10 07:14:57 -07:00
Saleem Abdulrasool
efb1432f82 SKCore: introduce swift member to Toolchain
This adds a `swift` member to the `Toolchain` type to allow invocations
of the swift driver to be constructed for tests.
2022-09-09 08:57:47 -07:00
Saleem Abdulrasool
ed5f106617 SKTestSupport: form native path for root of test project
The root of the test project would be in POSIX spelling which would
cause mismatches between the formed paths and the value returned from
the LSP resulting in test failures on Windows.
2022-09-08 09:40:08 -07:00
Saleem Abdulrasool
79105208d5 SKCore,SKTestSupport: adjust test server handling
The test system depended on the shebang to locate the python
interpreter.  However, this is not a portable system.  Instead, prefer
to explicitly search for the interpreter prior to the execution.  This
enables supporting execution of the script support on all platforms. A
secondary change of the printed string is required for Windows. Python
will replace `\n` with `\r\n` resulting in `\r\n` being emitted as
`\r\r\n` on Windows breaking the expectations on the receiver.  Adjust
this by explicitly writing out a binary string to the raw underlying
buffer to avoid the translation.
2022-09-06 09:19:37 -07:00