Commit Graph

182 Commits

Author SHA1 Message Date
Alex Hoppen
47b1d610a9 Never return error for diagnostics request
VS Code does not request diagnostics again for a document if the diagnostics request failed. Since sourcekit-lsp usually recovers from failures (e.g. after sourcekitd crashes), this is undesirable. Instead of returning an error, return empty results.
2024-01-12 17:22:01 -08:00
Alex Hoppen
e9697d4a2d Merge pull request #791 from ahoppen/ahoppen/reload-progress-again 2023-08-29 21:12:51 -07:00
Alex Hoppen
fc646793e1 Improve folding of line comments
Previously, the folding range of a block of line comments was ended after the newline of the last line comment, which would usually be the line of the function’s start. That caused VS Code to not show a folding range for the function body itself since it started on the same line that the line comment folding range ended.

Rewrite the trivia folding logic so that the folding range of those line comments ends on the line of the last line comment.

Fixes #803
rdar://114428202
2023-08-25 09:53:10 -07:00
Ziyang Huang
86ee25418a Rename some SyntaxClassification 2023-08-10 22:50:45 +08:00
Alex Hoppen
7604a1d389 Show a progress indicator in the editor if SourceKit-LSP is reloading packages
I noticed that the initial package loading can take ~5s. It’s good behavior to inform the client that sourcekit-lsp is busy reloading the package, showing the user that semantic functionality might not be ready yet.

https://github.com/apple/sourcekit-lsp/issues/620
rdar://112498447
2023-08-03 18:25:47 -07:00
Alex Hoppen
7385eb7a41 Merge pull request #790 from ahoppen/ahoppen/swift-syntax-deprecations
Fix deprecation warnings
2023-08-03 16:56:51 -07:00
Alex Hoppen
c0c7589547 Fix deprecation warnings
Fix deprecation warnings from SwiftSyntax and SwiftPM.
2023-08-03 09:45:29 -07:00
stevenwong
36747fe8fd Remove SyntaxClassification.objectLiteral 2023-08-03 09:14:02 +08:00
Alex Hoppen
8cb76ba22a Merge pull request #777 from ahoppen/ahoppen/code-actions-for-pulled-diags
Register diagnostics in `currentDiagnostics` when performing a diagnostic pull request
2023-07-22 20:22:44 -07:00
Alex Hoppen
8804e957f9 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-20 09:35:49 -07:00
Kim de Vos
1030c9bdbb Merge pull request #764 from kimdv/kimdv/1834-drop-keyword-suffix-from-tokenkindpoundavailablekeyword-etc 2023-07-19 08:06:55 +02:00
Alex Hoppen
8c7c32da5b Merge pull request #770 from ahoppen/ahoppen/inlayhint-edits
Don’t offer text edits from inlay hints if they are syntactically invalid
2023-07-18 16:32:05 -07:00
Alex Hoppen
6c99034367 Don’t offer text edits from inlay hints if they are syntactically invalid
Don’t offer any text edits for inlay hints displayed in closure paramters or enum case items.

Fixes #759
rdar://111559715
2023-07-18 08:09:11 -07:00
Kim de Vos
9a8392fc38 Remove Keyword suffix from Pound* 2023-07-18 14:02:48 +02:00
Ben Barham
e540e169bc Revert "Show a progress indicator in the editor if SourceKit-LSP is reloading packages" 2023-07-17 21:56:35 -07:00
Alex Hoppen
499cacca05 Merge pull request #767 from ahoppen/ahoppen/reloadpackage-progress
Show a progress indicator in the editor if SourceKit-LSP is reloading packages
2023-07-17 12:52:00 -07:00
Alex Hoppen
24317f1e97 Show a progress indicator in the editor if SourceKit-LSP is reloading packages
I noticed that the initial package loading can take ~5s. It’s good behavior to inform the client that sourcekit-lsp is busy reloading the package, showing the user that semantic functionality might not be ready yet.

https://github.com/apple/sourcekit-lsp/issues/620
rdar://111917300
2023-07-17 11:08:20 -07:00
Alex Hoppen
ab289aacca Merge pull request #761 from StevenWong12/enable_incremental_parse 2023-07-14 18:53:07 +02:00
stevenwong
f1d182e1a5 Make sourcekit-lsp parse swift source files incrementally
This feature will be used when we call `changeDocument` in SwiftLanguageServer
2023-07-14 14:41:30 +08:00
Alex Hoppen
7c15ba8731 Highlight references to actors like references to classes
We weren’t semantically highlighting references to actors because we missed the `ref_actor` case from the sourcekitd `annotations` response.

Fixes #694
rdar://104573568
2023-06-27 20:57:04 +02:00
Tristan Labelle
e91c83fd72 Remove reporting diagnostic support at SourceKitServer initialization 2023-05-31 10:30:54 -04:00
Tristan Labelle
94a62c1e33 Fixed CodeCompletion build error 2023-05-31 07:38:13 -04:00
Tristan Labelle
22234a0c44 Compilation fixes 2023-05-26 10:35:26 -04:00
Tristan Labelle
0da6291d22 Use CapabilityRegistry in ToolchainLanguageServer implementations 2023-05-26 10:35:26 -04:00
Tristan Labelle
bc444519c8 Report diagnostics support in SourceKitServer. 2023-05-26 10:35:26 -04:00
Tristan Labelle
e778ca24a6 Remove testing code 2023-05-26 10:35:26 -04:00
Tristan Labelle
542a29db2b Implement pull-model documentDiagnostics 2023-05-26 10:35:26 -04:00
Adam Fowler
07b9cc21e4 Requested changes from PR
rename symbol to symbolUSR
Cleanup OpenInterfaceRequest.init
2023-05-22 22:37:45 +01:00
Adam Fowler
0da1d40a28 Move module name split into OpenInterfaceRequest
Use group names when running open interface request
2023-05-21 10:26:00 +01:00
Adam Fowler
bbc4eeea5d Syntax changes after review 2023-05-20 16:32:59 +01:00
Adam Fowler
1aa6fe42f3 Fix warning 2023-05-16 19:34:28 +01:00
Adam Fowler
45adabb3e5 Extend OpenInterface to also seatch for a symbol 2023-05-16 19:32:29 +01:00
Adam Fowler
cf702e2269 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.
2023-05-16 19:32:15 +01:00
Alex Hoppen
0946a7856a Merge pull request #743 from tristanlabelle/pull-diagnostics-boilerplate
Add boilerplate for pull-model diagnostics
2023-05-04 09:39:49 -07:00
Tristan Labelle
1077ea39a7 Add boilerplate for pull-model diagnostics 2023-05-03 11:25:28 -04:00
Alex Hoppen
003a28d40a Rename IDEUtils to SwiftIDEUtils 2023-04-20 10:09:37 -07:00
Hamish Knight
d1015aea34 Update for SwiftSyntax regex changes 2023-03-29 21:09:36 +01: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
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
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
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
93a8f91436 Update request and notification definitions to LSP 3.17 2022-12-01 10:44:40 +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