Skip to content

Commit 570229d

Browse files
committed
Don't try to remap diagnostics on the client, let the server do it
1 parent fc6c9d3 commit 570229d

File tree

2 files changed

+3
-33
lines changed

2 files changed

+3
-33
lines changed

src/razor/src/diagnostics/razorDiagnosticHandler.ts

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,18 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import * as vscode from 'vscode';
7-
import {
8-
DocumentDiagnosticReport,
9-
DocumentDiagnosticParams,
10-
RequestType,
11-
FullDocumentDiagnosticReport,
12-
Range,
13-
Diagnostic,
14-
} from 'vscode-languageclient';
7+
import { DocumentDiagnosticReport, DocumentDiagnosticParams, RequestType } from 'vscode-languageclient';
158
import { RazorLanguageServerClient } from '../razorLanguageServerClient';
169
import { RoslynLanguageServer } from '../../../lsptoolshost/roslynLanguageServer';
1710
import { RazorDocumentManager } from '../document/razorDocumentManager';
1811
import { UriConverter } from '../../../lsptoolshost/uriConverter';
19-
import { LanguageKind } from '../rpc/languageKind';
2012
import { RazorLanguageServiceClient } from '../razorLanguageServiceClient';
2113
import { RazorLanguageFeatureBase } from '../razorLanguageFeatureBase';
2214
import { RazorDocumentSynchronizer } from '../document/razorDocumentSynchronizer';
2315
import { RazorLogger } from '../razorLogger';
2416

2517
export class RazorDiagnosticHandler extends RazorLanguageFeatureBase {
26-
private static readonly razorPullDiagnosticsCommand = 'razor/pullDiagnostics';
18+
private static readonly razorPullDiagnosticsCommand = 'razor/csharpPullDiagnostics';
2719
private diagnosticRequestType: RequestType<DocumentDiagnosticParams, DocumentDiagnosticReport, any> =
2820
new RequestType(RazorDiagnosticHandler.razorPullDiagnosticsCommand);
2921

@@ -63,28 +55,6 @@ export class RazorDiagnosticHandler extends RazorLanguageFeatureBase {
6355
RoslynLanguageServer.roslynPullDiagnosticCommand,
6456
request
6557
);
66-
if (response.kind === 'full') {
67-
const changedDiagnostics: FullDocumentDiagnosticReport = response as FullDocumentDiagnosticReport;
68-
const remappedDiagnostics = new Array<Diagnostic>();
69-
for (const diagnostic of changedDiagnostics.items) {
70-
const convertedRange = new vscode.Range(
71-
diagnostic.range.start.line,
72-
diagnostic.range.start.character,
73-
diagnostic.range.end.line,
74-
diagnostic.range.end.character
75-
);
76-
const remappedResponse = await this.serviceClient.mapToDocumentRanges(
77-
LanguageKind.CSharp,
78-
[convertedRange],
79-
razorDocument.uri
80-
);
81-
if (remappedResponse.ranges.length != 0) {
82-
diagnostic.range = Range.create(remappedResponse.ranges[0].start, remappedResponse.ranges[0].end);
83-
remappedDiagnostics.push(diagnostic);
84-
}
85-
}
86-
changedDiagnostics.items = remappedDiagnostics;
87-
}
8858

8959
return response;
9060
}

src/razor/src/razorLanguageServerClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ export class RazorLanguageServerClient implements vscode.Disposable {
246246
if (!options.usingOmniSharp) {
247247
args.push('--projectConfigurationFileName');
248248
args.push('project.razor.vscode.json');
249-
args.push('--SupportsDelegatedDiagnostics');
249+
args.push('--DelegateToCSharpOnDiagnosticPublish');
250250
args.push('true');
251251
args.push('--SupportsDelegatedCodeActions');
252252
args.push('true');

0 commit comments

Comments
 (0)