[SourceKit] Add a dedicated request to retrieve the diagnostics of a file

Currently, SourceKit always implicitly sends diagnostics to the client after every edit. This doesn’t match our new cancellation story because diagnostics retrieval is no request and thus can’t be cancelled.

Instead, diagnostics retrieval should be a standalone request, which returns a cancellation token like every other request and which can thus also be cancelled as such.

The indented transition path here is to change all open and edit requests to be syntactic only. When diagnostics are needed, the new diagnostics request should be used.

rdar://83391522
This commit is contained in:
Alex Hoppen
2021-10-05 19:02:08 +02:00
parent 3bd6716d04
commit 2f19d1847f
10 changed files with 169 additions and 2 deletions

View File

@@ -569,6 +569,13 @@ public:
std::function<void(const RequestResult<CursorInfoData> &)>
Receiver) override;
void
getDiagnostics(StringRef InputFile, ArrayRef<const char *> Args,
Optional<VFSOptions> VfsOptions,
SourceKitCancellationToken CancellationToken,
std::function<void(const RequestResult<DiagnosticsResult> &)>
Receiver) override;
void getNameInfo(
StringRef Filename, unsigned Offset, NameTranslatingInfo &Input,
ArrayRef<const char *> Args, SourceKitCancellationToken CancellationToken,