Commit Graph

705 Commits

Author SHA1 Message Date
Alex Hoppen
135e8f935b Register diagnostics in currentDiagnostics when performing a diagnostic pull request
We were registering new diagnsotics in `currentDiagnostics` when the diagnostics got pushed to us by sourcekitd, but not when they were pulled using the diagnostic request.

Fixes #776
rdar://112539108
2023-07-21 08:05:42 -07:00
Alex Hoppen
531f8a9793 Don’t update Package.resolved from sourcekit-lsp
`SwiftPMWorkspace.reloadPackage` called `loadPackageGraph`, which causes package resolution and could thus update `Package.resolved`. This caused race conditions when `swift package update` was run from terminal while sourcekit-lsp is running since sourcekit-lsp was notified about the file changes and thus reloaded the pacakge to get build settings for the modified files.

Set `forceResolvedVersions` to only resolve packages based on the versions in `Package.resolved`, eliminating this problem.

Fixes https://github.com/apple/sourcekit-lsp/issues/707
rdar://105173375
2023-07-07 15:33:01 +02:00
Tristan Labelle
2f0209f69b Fix bad merge resulting in duplicated method 2023-06-12 10:49:10 -04:00
Tristan Labelle
c076bd5282 Implement pull-model documentDiagnostics 2023-06-02 13:36:07 -04:00
Tristan Labelle
ea9f173339 Add boilerplate for pull-model diagnostics 2023-06-02 13:35:00 -04:00
Adam Fowler
9ca89669b2 Swiftinterface symbol lookup
Generate swiftinterface for symbol lookup

When a symbol definition returns it is in a swiftinterface file, create textual version of swiftinterface and return that in response.

Extend OpenInterface to also seatch for a symbol

Fix warning

Syntax changes after review

Move module name split into OpenInterfaceRequest

Use group names when running open interface request

Requested changes from PR

rename symbol to symbolUSR
Cleanup OpenInterfaceRequest.init

Fix tests

Added testDefinitionInSystemModuleInterface

Use SwiftPMPackage test module
Added version of buildAndIndex that includes system symbols

Merge buildAndIndexWithSystemSymbols with buildAndIndex

Added specific test project for system swiftinterface tests

Add multiple tests for various system modules
2023-05-24 18:53:37 +01:00
Alex Hoppen
6a79fe7e93 Rename IDEUtils to SwiftIDEUtils 2023-04-22 07:59:49 -07:00
Hamish Knight
fa74ac753c Update for SwiftSyntax regex changes 2023-04-03 11:58:08 +01:00
tom doron
409ef958fd adjust to new SwiftPM API
motivation: keep up with SwiftPM APIs

changes: BuildParameters ctor is now throwing
2023-03-15 14:29:31 -07:00
Max Desiatov
cf18660031 Fix use of deprecated AbsolutePath.init (#719)
Non-throwing `AbsolutePath.init(_:)` is deprecated, we should use `AbsolutePath.init(validating:) throws` instead.
2023-03-09 15:08:56 +00:00
Saleem Abdulrasool
193789fcc9 Update CMakeLists.txt
Add `-parse-as-library` to the build for `@main`.
2023-02-09 10:28:52 -08:00
Max Desiatov
f5a30d9351 Fix uses of deprecated non-throwing AbsolutePath.init (#709)
These warnings appeared after an update to TSC deprecated this initializer.
2023-02-09 14:04:57 +00:00
Saleem Abdulrasool
31cdfd0989 Update CMakeLists.txt
Repair the Windows build after #696
2023-02-08 14:23:54 -08:00
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