Merge pull request #3311 from henryju/feature/feed_diagnostic_code
Feed VSCode diagnostic code to Roslyn diagnostic id
This commit is contained in:
Коммит
fe9a2f86bd
|
@ -335,6 +335,8 @@ class DiagnosticsProvider extends AbstractSupport {
|
||||||
let message = `${quickFix.Text} [${quickFix.Projects.map(n => this._asProjectLabel(n)).join(', ')}]`;
|
let message = `${quickFix.Text} [${quickFix.Projects.map(n => this._asProjectLabel(n)).join(', ')}]`;
|
||||||
|
|
||||||
let diagnostic = new vscode.Diagnostic(toRange(quickFix), message, display.severity);
|
let diagnostic = new vscode.Diagnostic(toRange(quickFix), message, display.severity);
|
||||||
|
diagnostic.source = 'csharp';
|
||||||
|
diagnostic.code = quickFix.Id;
|
||||||
|
|
||||||
if (display.isFadeout) {
|
if (display.isFadeout) {
|
||||||
diagnostic.tags = [vscode.DiagnosticTag.Unnecessary];
|
diagnostic.tags = [vscode.DiagnosticTag.Unnecessary];
|
||||||
|
|
|
@ -44,7 +44,7 @@ suite(`DiagnosticProvider: ${testAssetWorkspace.description}`, function () {
|
||||||
test("Return unnecessary tag in case of unnesessary using", async function () {
|
test("Return unnecessary tag in case of unnesessary using", async function () {
|
||||||
let result = await poll(() => vscode.languages.getDiagnostics(fileUri), 15*1000, 500);
|
let result = await poll(() => vscode.languages.getDiagnostics(fileUri), 15*1000, 500);
|
||||||
|
|
||||||
let cs8019 = result.find(x => x.message.includes("CS8019"));
|
let cs8019 = result.find(x => x.source == "csharp" && x.code == "CS8019");
|
||||||
expect(cs8019).to.not.be.undefined;
|
expect(cs8019).to.not.be.undefined;
|
||||||
expect(cs8019.tags).to.include(vscode.DiagnosticTag.Unnecessary);
|
expect(cs8019.tags).to.include(vscode.DiagnosticTag.Unnecessary);
|
||||||
});
|
});
|
||||||
|
@ -53,8 +53,8 @@ suite(`DiagnosticProvider: ${testAssetWorkspace.description}`, function () {
|
||||||
this.skip(); // Remove this once https://github.com/OmniSharp/omnisharp-roslyn/issues/1458 is resolved.
|
this.skip(); // Remove this once https://github.com/OmniSharp/omnisharp-roslyn/issues/1458 is resolved.
|
||||||
let result = await poll(() => vscode.languages.getDiagnostics(fileUri), 15*1000, 500);
|
let result = await poll(() => vscode.languages.getDiagnostics(fileUri), 15*1000, 500);
|
||||||
|
|
||||||
let ide0005 = result.find(x => x.message.includes("IDE0005"));
|
let ide0005 = result.find(x => x.source == "csharp" && x.code == "IDE0005");
|
||||||
expect(ide0005).to.not.be(undefined);
|
expect(ide0005).to.not.be.undefined;
|
||||||
expect(ide0005.tags).to.include(vscode.DiagnosticTag.Unnecessary);
|
expect(ide0005.tags).to.include(vscode.DiagnosticTag.Unnecessary);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Загрузка…
Ссылка в новой задаче