-
Notifications
You must be signed in to change notification settings - Fork 676
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into changelog-for-2873
- Loading branch information
Showing
10 changed files
with
173 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import * as vscode from 'vscode'; | ||
import * as path from 'path'; | ||
|
||
import { should, expect } from 'chai'; | ||
import { activateCSharpExtension } from './integrationHelpers'; | ||
import testAssetWorkspace from './testAssets/testAssetWorkspace'; | ||
import poll from './poll'; | ||
|
||
const chai = require('chai'); | ||
chai.use(require('chai-arrays')); | ||
chai.use(require('chai-fs')); | ||
|
||
suite(`DiagnosticProvider: ${testAssetWorkspace.description}`, function () { | ||
let fileUri: vscode.Uri; | ||
|
||
suiteSetup(async function () { | ||
should(); | ||
|
||
await testAssetWorkspace.restore(); | ||
await activateCSharpExtension(); | ||
|
||
let fileName = 'diagnostics.cs'; | ||
let projectDirectory = testAssetWorkspace.projects[0].projectDirectoryPath; | ||
let filePath = path.join(projectDirectory, fileName); | ||
fileUri = vscode.Uri.file(filePath); | ||
|
||
await vscode.commands.executeCommand("vscode.open", fileUri); | ||
}); | ||
|
||
suiteTeardown(async () => { | ||
await testAssetWorkspace.cleanupWorkspace(); | ||
}); | ||
|
||
test("Returns any diagnostics from file", async function () { | ||
let result = await poll(() => vscode.languages.getDiagnostics(fileUri), 10*1000, 500); | ||
expect(result.length).to.be.greaterThan(0); | ||
}); | ||
|
||
test("Return unnecessary tag in case of unnesessary using", async function () { | ||
let result = await poll(() => vscode.languages.getDiagnostics(fileUri), 15*1000, 500); | ||
|
||
let cs8019 = result.find(x => x.message.includes("CS8019")); | ||
expect(cs8019).to.not.be.undefined; | ||
expect(cs8019.tags).to.include(vscode.DiagnosticTag.Unnecessary); | ||
}); | ||
|
||
test("Return fadeout diagnostics like unused usings based on roslyn analyzers", async function () { | ||
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 ide0005 = result.find(x => x.message.includes("IDE0005")); | ||
expect(ide0005).to.not.be(undefined); | ||
expect(ide0005.tags).to.include(vscode.DiagnosticTag.Unnecessary); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
class C {} |
12 changes: 12 additions & 0 deletions
12
test/integrationTests/testAssets/singleCsproj/diagnostics.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System.IO; | ||
|
||
namespace Foo | ||
{ | ||
public class FooBar | ||
{ | ||
public void FooBarBar() | ||
{ | ||
var notUsed = 3; | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
test/integrationTests/testAssets/slnWithCsproj/.vscode/settings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"omnisharp.defaultLaunchSolution": "b_SecondInOrder_SlnFile.sln", | ||
"omnisharp.path": "latest", | ||
"csharp.maxProjectFileCountForDiagnosticAnalysis": 1000, | ||
"csharp.maxProjectFileCountForDiagnosticAnalysis": 1000 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
class C {} |
12 changes: 12 additions & 0 deletions
12
test/integrationTests/testAssets/slnWithCsproj/src/app/diagnostics.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System.IO; | ||
|
||
namespace Foo | ||
{ | ||
public class FooBar | ||
{ | ||
public void FooBarBar() | ||
{ | ||
var notUsed = 3; | ||
} | ||
} | ||
} |