|
3 | 3 | * Licensed under the MIT License. See License.txt in the project root for license information. |
4 | 4 | * ------------------------------------------------------------------------------------------ */ |
5 | 5 | import { |
6 | | - workspace as Workspace, window as Window, languages as Languages, LogLevel, version as VSCodeVersion, TextDocument, Disposable, |
| 6 | + workspace as Workspace, window as Window, LogLevel, version as VSCodeVersion, TextDocument, Disposable, |
7 | 7 | FileSystemWatcher as VFileSystemWatcher, DiagnosticCollection, Diagnostic as VDiagnostic, Uri, CancellationToken, WorkspaceEdit as VWorkspaceEdit, |
8 | 8 | MessageItem, WorkspaceFolder as VWorkspaceFolder, env as Env, TextDocumentShowOptions, CancellationError, CancellationTokenSource, FileCreateEvent, |
9 | 9 | FileRenameEvent, FileDeleteEvent, FileWillCreateEvent, FileWillRenameEvent, FileWillDeleteEvent, CompletionItemProvider, HoverProvider, SignatureHelpProvider, |
@@ -49,7 +49,7 @@ import * as UUID from './utils/uuid'; |
49 | 49 | import { ProgressPart } from './progressPart'; |
50 | 50 | import { |
51 | 51 | DynamicFeature, ensure, FeatureClient, LSPCancellationError, TextDocumentSendFeature, RegistrationData, StaticFeature, |
52 | | - TextDocumentProviderFeature, WorkspaceProviderFeature, type VisibleDocuments |
| 52 | + TextDocumentProviderFeature, WorkspaceProviderFeature, DefaultDiagnosticCollectionProvider, DiagnosticCollectionSource, type VisibleDocuments |
53 | 53 | } from './features'; |
54 | 54 |
|
55 | 55 | import { DiagnosticFeature, DiagnosticProviderMiddleware, DiagnosticProviderShape, $DiagnosticPullOptions, DiagnosticFeatureShape } from './diagnostic'; |
@@ -735,6 +735,7 @@ export abstract class BaseLanguageClient implements FeatureClient<Middleware, La |
735 | 735 | // interval: clientOptions.suspend?.interval ? Math.max(clientOptions.suspend.interval, defaultInterval) : defaultInterval |
736 | 736 | // }, |
737 | 737 | diagnosticPullOptions: clientOptions.diagnosticPullOptions ?? { onChange: true, onSave: false }, |
| 738 | + diagnosticCollectionProvider: clientOptions.diagnosticCollectionProvider ?? new DefaultDiagnosticCollectionProvider(), |
738 | 739 | notebookDocumentOptions: clientOptions.notebookDocumentOptions ?? { }, |
739 | 740 | textSynchronization: this.createTextSynchronizationOptions(clientOptions.textSynchronization) |
740 | 741 | }; |
@@ -866,7 +867,7 @@ export abstract class BaseLanguageClient implements FeatureClient<Middleware, La |
866 | 867 | return undefined; |
867 | 868 | } |
868 | 869 | if (this._diagnostics === undefined) { |
869 | | - this._diagnostics = Languages.createDiagnosticCollection(this._clientOptions.diagnosticCollectionName ?? this._id); |
| 870 | + this._diagnostics = this._clientOptions.diagnosticCollectionProvider.create(this._clientOptions.diagnosticCollectionName ?? this._id, DiagnosticCollectionSource.push); |
870 | 871 | } |
871 | 872 | return this._diagnostics; |
872 | 873 | } |
@@ -1672,7 +1673,7 @@ export abstract class BaseLanguageClient implements FeatureClient<Middleware, La |
1672 | 1673 | this._diagnostics = null; |
1673 | 1674 | } |
1674 | 1675 | if (this._diagnostics !== null) { |
1675 | | - this._diagnostics.dispose(); |
| 1676 | + this._clientOptions.diagnosticCollectionProvider.dispose(this._diagnostics, DiagnosticCollectionSource.push); |
1676 | 1677 | this._diagnostics = null; |
1677 | 1678 | } |
1678 | 1679 | } |
|
0 commit comments