Skip to content

Commit

Permalink
Merge pull request #646 from DustinCampbell/cleanup-test-projects
Browse files Browse the repository at this point in the history
Clean up!
  • Loading branch information
DustinCampbell authored Sep 27, 2016
2 parents 1fe1df2 + 0306cbe commit be0c664
Show file tree
Hide file tree
Showing 62 changed files with 269 additions and 191 deletions.
9 changes: 8 additions & 1 deletion OmniSharp.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25123.0
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{2C348365-A9D8-459E-9276-56FC46AAEE31}"
EndProject
Expand Down Expand Up @@ -58,6 +58,8 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "OmniSharp.DotNetTest", "src
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "OmniSharp.DotNetTest.Tests", "tests\OmniSharp.DotNetTest.Tests\OmniSharp.DotNetTest.Tests.xproj", "{F6195E7B-8002-42AE-BF86-E78DBC769A47}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "OmniSharp.DotNet.Tests", "tests\OmniSharp.DotNet.Tests\OmniSharp.DotNet.Tests.xproj", "{A645D475-3448-4473-88CA-E3C3B31E33CA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -140,6 +142,10 @@ Global
{F6195E7B-8002-42AE-BF86-E78DBC769A47}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F6195E7B-8002-42AE-BF86-E78DBC769A47}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F6195E7B-8002-42AE-BF86-E78DBC769A47}.Release|Any CPU.Build.0 = Release|Any CPU
{A645D475-3448-4473-88CA-E3C3B31E33CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A645D475-3448-4473-88CA-E3C3B31E33CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A645D475-3448-4473-88CA-E3C3B31E33CA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A645D475-3448-4473-88CA-E3C3B31E33CA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -164,5 +170,6 @@ Global
{55C2439D-826F-4CDB-A6F7-B4A2818A6A3B} = {35E025BF-BBB2-4FAC-9F4B-37CBA083EE47}
{33A68F57-B234-4481-AEDE-03D51756B35A} = {2C348365-A9D8-459E-9276-56FC46AAEE31}
{F6195E7B-8002-42AE-BF86-E78DBC769A47} = {35E025BF-BBB2-4FAC-9F4B-37CBA083EE47}
{A645D475-3448-4473-88CA-E3C3B31E33CA} = {35E025BF-BBB2-4FAC-9F4B-37CBA083EE47}
EndGlobalSection
EndGlobal
3 changes: 3 additions & 0 deletions build.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
],
"OmniSharp.DotNetTest.Tests": [
"netcoreapp1.0"
],
"OmniSharp.Tests": [
"netcoreapp1.0"
]
},
"Frameworks": [
Expand Down
3 changes: 1 addition & 2 deletions src/OmniSharp.Abstractions/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"warningsAsErrors": true
},
"dependencies": {
"Newtonsoft.Json": "8.0.3",
"Newtonsoft.Json": "9.0.1",
"Microsoft.CodeAnalysis": "2.0.0-beta3",
"Microsoft.Composition": "1.0.30",
"Microsoft.Extensions.Caching.Memory": "1.0.0",
Expand Down Expand Up @@ -34,7 +34,6 @@
"netstandard1.6": {
"imports": [
"dotnet5.4",
"dnxcore50",
"portable-net45+win8"
],
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion src/OmniSharp.DotNet/DotNetProjectSystem.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using System.Collections.Immutable;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Composition;
using System.IO;
using System.Linq;
Expand Down
3 changes: 1 addition & 2 deletions src/OmniSharp.DotNet/Models/DotNetWorkspaceInformation.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Microsoft.DotNet.ProjectModel;
using System.Collections.Generic;
using System.Collections.Generic;
using OmniSharp.DotNet.Cache;

namespace OmniSharp.DotNet.Models
Expand Down
1 change: 0 additions & 1 deletion src/OmniSharp.DotNet/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"netstandard1.6": {
"imports": [
"dotnet5.6",
"dnxcore50",
"portable-net45+win8"
],
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion src/OmniSharp.DotNetTest/Helpers/TestFeaturesDiscover.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
using System.Linq;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using OmniSharp.Models;
using OmniSharp.Abstractions.Services;
using OmniSharp.Models;

namespace OmniSharp.DotNetTest.Helpers
{
Expand Down
1 change: 0 additions & 1 deletion src/OmniSharp.DotNetTest/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"netstandard1.6": {
"imports": [
"dotnet5.6",
"dnxcore50",
"portable-net45+win8"
],
"dependencies": {
Expand Down
1 change: 0 additions & 1 deletion src/OmniSharp.Host/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"netstandard1.6": {
"imports": [
"dotnet5.6",
"dnxcore50",
"portable-net45+win8"
],
"dependencies": {
Expand Down
3 changes: 1 addition & 2 deletions src/OmniSharp.Plugins/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"dependencies": {
"OmniSharp.Abstractions": "1.0.0",
"Newtonsoft.Json": "8.0.3"
"Newtonsoft.Json": "9.0.1"
},
"frameworks": {
"net451": {
Expand All @@ -16,7 +16,6 @@
"netstandard1.6": {
"imports": [
"dotnet5.4",
"dnxcore50",
"portable-net45+win8"
],
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ namespace OmniSharp.Roslyn.CSharp.Services.Refactoring.V2
{
public static class CodeActionHelper
{
private const string RemoveUnnecessaryUsingsProviderName = "Microsoft.CodeAnalysis.CSharp.CodeFixes.RemoveUnusedUsings.RemoveUnnecessaryUsingsCodeFixProvider";

public static async Task<IEnumerable<CodeAction>> GetActions(OmnisharpWorkspace workspace, IEnumerable<ICodeActionProvider> codeActionProviders, ILogger logger, ICodeActionRequest request)
{
var actions = new List<CodeAction>();
Expand All @@ -26,10 +28,19 @@ public static async Task<IEnumerable<CodeAction>> GetActions(OmnisharpWorkspace
}

var refactoringContext = await GetRefactoringContext(originalDocument, request, actions);
if (refactoringContext != null)
{
await CollectRefactoringActions(codeActionProviders, logger, refactoringContext.Value);
}

var codeFixContext = await GetCodeFixContext(originalDocument, request, actions);
await CollectRefactoringActions(codeActionProviders, logger, refactoringContext);
await CollectCodeFixActions(codeActionProviders, logger, codeFixContext);
if (codeFixContext != null)
{
await CollectCodeFixActions(codeActionProviders, logger, codeFixContext.Value);
}

actions.Reverse();

return actions;
}

Expand Down Expand Up @@ -235,10 +246,9 @@ private static TextSpan GetTextSpan(ICodeActionRequest request, SourceText sourc
"ICSharpCode.NRefactory6.CSharp.Refactoring.ConditionIsAlwaysTrueOrFalseFixProvider"
};

private static async Task CollectCodeFixActions(IEnumerable<ICodeActionProvider> codeActionProviders, ILogger logger, CodeFixContext? fixContext)
private static async Task CollectCodeFixActions(IEnumerable<ICodeActionProvider> codeActionProviders, ILogger logger, CodeFixContext context)
{
if (!fixContext.HasValue)
return;
var diagnosticIds = context.Diagnostics.Select(d => d.Id).ToArray();

foreach (var provider in codeActionProviders)
{
Expand All @@ -249,9 +259,20 @@ private static async Task CollectCodeFixActions(IEnumerable<ICodeActionProvider>
continue;
}

// TODO: This is a horrible hack! However, remove unnecessary usings only
// responds for diagnostics that are produced by its diagnostic analyzer.
// We need to provide a *real* diagnostic engine to address this.
if (codeFix.ToString() != RemoveUnnecessaryUsingsProviderName)
{
if (!diagnosticIds.Any(id => codeFix.FixableDiagnosticIds.Contains(id)))
{
continue;
}
}

try
{
await codeFix.RegisterCodeFixesAsync(fixContext.Value);
await codeFix.RegisterCodeFixesAsync(context);
}
catch
{
Expand All @@ -261,11 +282,8 @@ private static async Task CollectCodeFixActions(IEnumerable<ICodeActionProvider>
}
}

private static async Task CollectRefactoringActions(IEnumerable<ICodeActionProvider> codeActionProviders, ILogger logger, CodeRefactoringContext? refactoringContext)
private static async Task CollectRefactoringActions(IEnumerable<ICodeActionProvider> codeActionProviders, ILogger logger, CodeRefactoringContext context)
{
if (!refactoringContext.HasValue)
return;

foreach (var provider in codeActionProviders)
{
foreach (var refactoring in provider.Refactorings)
Expand All @@ -277,7 +295,7 @@ private static async Task CollectRefactoringActions(IEnumerable<ICodeActionProvi

try
{
await refactoring.ComputeRefactoringsAsync(refactoringContext.Value);
await refactoring.ComputeRefactoringsAsync(context);
}
catch
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Composition;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using OmniSharp.Services;
using OmniSharp.Models;
using System.Collections.Concurrent;
using Microsoft.Extensions.Logging;
using OmniSharp.Models;
using OmniSharp.Services;

namespace OmniSharp.Workers.Diagnostics
{
Expand Down
8 changes: 3 additions & 5 deletions src/OmniSharp.ScriptCs/Extensions/ScriptcsExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using Microsoft.CodeAnalysis;
using ScriptCs;
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using ScriptCs;

namespace OmniSharp.ScriptCs.Extensions
{
Expand Down
2 changes: 1 addition & 1 deletion src/OmniSharp.ScriptCs/ScriptCsContext.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Microsoft.CodeAnalysis;
using System.Collections.Generic;
using System.Composition;
using Microsoft.CodeAnalysis;

namespace OmniSharp.ScriptCs
{
Expand Down
2 changes: 0 additions & 2 deletions src/OmniSharp.ScriptCs/ScriptCsContextModel.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Microsoft.CodeAnalysis;
using System.Collections.Generic;
using System.Composition;
using System.Linq;
using OmniSharp.Roslyn.Models;

Expand Down
6 changes: 3 additions & 3 deletions src/OmniSharp.ScriptCs/ScriptCsProjectSystem.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Composition;
using System.IO;
using System.Linq;
Expand All @@ -12,13 +13,12 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using OmniSharp.Models.v1;
using OmniSharp.ScriptCs.Extensions;
using OmniSharp.Services;
using ScriptCs;
using ScriptCs.Contracts;
using LogLevel = ScriptCs.Contracts.LogLevel;
using ScriptCs.Hosting;
using OmniSharp.ScriptCs.Extensions;
using System.Collections.Immutable;
using LogLevel = ScriptCs.Contracts.LogLevel;

namespace OmniSharp.ScriptCs
{
Expand Down
3 changes: 1 addition & 2 deletions src/OmniSharp.Stdio/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@
"OmniSharp.Abstractions": "1.0.0",
"Microsoft.AspNetCore.Hosting": "1.0.0",
"Microsoft.AspNetCore.Http.Features": "1.0.0",
"Newtonsoft.Json": "8.0.3"
"Newtonsoft.Json": "9.0.1"
},
"frameworks": {
"net451": {},
"netstandard1.6": {
"imports": [
"dotnet5.4",
"dnxcore50",
"portable-net45+win8"
],
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion src/OmniSharp/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
},
"netcoreapp1.0": {
"imports": [
"dnxcore50",
"dotnet5.4",
"portable-net45+win8"
],
"dependencies": {
Expand Down
21 changes: 21 additions & 0 deletions tests/OmniSharp.DotNet.Tests/OmniSharp.DotNet.Tests.xproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0.25420" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.25420</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>a645d475-3448-4473-88ca-e3c3b31e33ca</ProjectGuid>
<RootNamespace>OmniSharp.DotNet.Tests</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
15 changes: 7 additions & 8 deletions tests/OmniSharp.DotNet.Tests/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,17 @@
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.4",
"portable-net45+win8"
],
"dependencies": {
"dotnet-test-xunit": "2.2.0-preview2-build1029",
"Microsoft.NETCore.App": {
"version": "1.0.0",
"type": "platform"
}
},
"imports": [
"netstandardapp1.5",
"dnxcore50",
"portable-net45+win8"
]
},
"dotnet-test-xunit": "2.2.0-preview2-build1029"
}
}
},
"testRunner": "xunit"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>

<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
Loading

0 comments on commit be0c664

Please sign in to comment.