Skip to content

Commit 9fa60ff

Browse files
Merge pull request #86 from OmniSharp/public-members
[wip] export more public types
2 parents d3468c2 + c069e5b commit 9fa60ff

26 files changed

+101
-64
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,6 @@ buildlog
3535
# Build folder
3636
tools/*/
3737
/tools/packages.config.md5sum
38+
/coverage
3839

3940
.idea

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ language: csharp
22
sudo: required
33
dist: trusty
44
mono: latest
5-
dotnet: 2.0.0
5+
dotnet: 2.1.301
66
os:
77
- linux
88
cache:

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"coverage-gutters.lcovname": "*.info"
3+
}

Common.Build.props

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,19 @@
99
<Microsoft_Extensions_Logging_Version>2.0.0</Microsoft_Extensions_Logging_Version>
1010
<Microsoft_Extensions_DependencyInjection_Version>2.0.0</Microsoft_Extensions_DependencyInjection_Version>
1111
<Newtonsoft_Version>11.0.2</Newtonsoft_Version>
12-
<SourceLink_Version>2.8.1</SourceLink_Version>
13-
<System_Reactive_Version>3.1.1</System_Reactive_Version>
14-
<MediatR_Version>4.1.0</MediatR_Version>
15-
<Autofac_Version>4.8.0</Autofac_Version>
12+
<SourceLink_Version>2.8.3</SourceLink_Version>
13+
<System_Reactive_Version>4.0.0</System_Reactive_Version>
14+
<MediatR_Version>5.0.1</MediatR_Version>
15+
<MediatR_Extensions_DependencyInjection_Version>5.0.2</MediatR_Extensions_DependencyInjection_Version>
16+
<Autofac_Version>4.8.1</Autofac_Version>
1617
<Autofac_Extensions_DependencyInjection_Version>4.2.2</Autofac_Extensions_DependencyInjection_Version>
17-
<Microsoft_NET_Test_Sdk_Version>15.7.0</Microsoft_NET_Test_Sdk_Version>
18+
<Microsoft_NET_Test_Sdk_Version>15.7.2</Microsoft_NET_Test_Sdk_Version>
1819
<xunit_Version>2.3.1</xunit_Version>
19-
<FluentAssertions_Version>5.3.0</FluentAssertions_Version>
20+
<FluentAssertions_Version>5.4.1</FluentAssertions_Version>
2021
<NSubstitute_Version>3.1.0</NSubstitute_Version>
2122
<Serilog_Extensions_Logging_Version>2.0.2</Serilog_Extensions_Logging_Version>
2223
<Serilog_Sinks_XUnit_Version>1.0.5</Serilog_Sinks_XUnit_Version>
24+
<XunitXml_TestLogger_Version>2.0.0</XunitXml_TestLogger_Version>
25+
<coverlet_Version>2.0.1</coverlet_Version>
2326
</PropertyGroup>
2427
</Project>

build.cake

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,8 @@ Task("TestSetup")
5050
EnsureDirectoryExists(artifacts + "/coverage");
5151
});
5252

53-
Task("Test (No Coverage)")
53+
Task("Test (Unix)")
5454
.WithCriteria(IsRunningOnUnix)
55-
.WithCriteria(false) // TODO: Make work on travis
5655
.IsDependentOn("TestSetup")
5756
.IsDependentOn("Build")
5857
.DoesForEach(GetFiles("test/*/*.csproj"), (testProject) =>
@@ -61,27 +60,33 @@ Task("Test (No Coverage)")
6160
testProject.GetDirectory().FullPath,
6261
new DotNetCoreTestSettings() {
6362
NoBuild = true,
64-
Framework = "netcoreapp2.0",
63+
Configuration = configuration,
64+
Framework = "netcoreapp2.1",
6565
EnvironmentVariables = GitVersionEnvironmentVariables,
66-
});
66+
TestAdapterPath = ".",
67+
Logger = $"\"xunit;LogFilePath={string.Format("{0}/tests/{1}.xml", artifacts, testProject.GetFilenameWithoutExtension())}\"",
68+
ArgumentCustomization = args => args.Append("/p:CollectCoverage=true"),
69+
}
70+
);
6771
});
6872

69-
Task("Test (Coverage)")
73+
Task("Test (Windows)")
7074
.WithCriteria(IsRunningOnWindows)
7175
.IsDependentOn("TestSetup")
7276
.IsDependentOn("Build")
7377
.DoesForEach(GetFiles("test/*/*.csproj"), (testProject) =>
7478
{
7579
DotCoverCover(tool => {
76-
tool.DotNetCoreTool(
80+
tool.DotNetCoreTest(
7781
testProject.GetDirectory().FullPath,
78-
"xunit",
79-
new ProcessArgumentBuilder()
80-
.AppendSwitchQuoted("-xml", string.Format("{0}/tests/{1}.xml", artifacts, testProject.GetFilenameWithoutExtension()))
81-
.AppendSwitch("-configuration", configuration)
82-
.Append("-noshadow"),
83-
new DotNetCoreToolSettings() {
82+
new DotNetCoreTestSettings() {
83+
NoBuild = true,
84+
Configuration = configuration,
85+
Framework = "netcoreapp2.1",
8486
EnvironmentVariables = GitVersionEnvironmentVariables,
87+
TestAdapterPath = ".",
88+
Logger = $"\"xunit;LogFilePath={string.Format("{0}/tests/{1}.xml", artifacts, testProject.GetFilenameWithoutExtension())}\"",
89+
// ArgumentCustomization = args => args.Append("/p:CollectCoverage=true"),
8590
});
8691
},
8792
artifacts + "/coverage/coverage-"+ testProject.GetFilenameWithoutExtension() + ".dcvr",
@@ -120,8 +125,8 @@ Task("Test (Coverage)")
120125
});
121126

122127
Task("Test")
123-
.IsDependentOn("Test (Coverage)")
124-
.IsDependentOn("Test (No Coverage)");
128+
.IsDependentOn("Test (Unix)")
129+
.IsDependentOn("Test (Windows)");
125130

126131
Task("Pack")
127132
.WithCriteria(IsRunningOnWindows) // TODO: Make work on travis

sample/SampleServer/TextDocumentHandler.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Threading;
33
using System.Threading.Tasks;
4+
using MediatR;
45
using OmniSharp.Extensions.LanguageServer;
56
using OmniSharp.Extensions.LanguageServer.Protocol;
67
using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities;
@@ -32,14 +33,14 @@ public TextDocumentHandler(OmniSharp.Extensions.LanguageServer.Protocol.Server.I
3233

3334
public TextDocumentSyncKind Change { get; } = TextDocumentSyncKind.Full;
3435

35-
public Task Handle(DidChangeTextDocumentParams notification, CancellationToken token)
36+
public Task<Unit> Handle(DidChangeTextDocumentParams notification, CancellationToken token)
3637
{
3738
_router.Window.LogMessage(new LogMessageParams()
3839
{
3940
Type = MessageType.Log,
4041
Message = "Hello World!!!!"
4142
});
42-
return Task.CompletedTask;
43+
return Unit.Task;
4344
}
4445

4546
TextDocumentChangeRegistrationOptions IRegistration<TextDocumentChangeRegistrationOptions>.GetRegistrationOptions()
@@ -56,14 +57,15 @@ public void SetCapability(SynchronizationCapability capability)
5657
_capability = capability;
5758
}
5859

59-
public async Task Handle(DidOpenTextDocumentParams notification, CancellationToken token)
60+
public async Task<Unit> Handle(DidOpenTextDocumentParams notification, CancellationToken token)
6061
{
6162
await Task.Yield();
6263
_router.Window.LogMessage(new LogMessageParams()
6364
{
6465
Type = MessageType.Log,
6566
Message = "Hello World!!!!"
6667
});
68+
return Unit.Value;
6769
}
6870

6971
TextDocumentRegistrationOptions IRegistration<TextDocumentRegistrationOptions>.GetRegistrationOptions()
@@ -74,14 +76,14 @@ TextDocumentRegistrationOptions IRegistration<TextDocumentRegistrationOptions>.G
7476
};
7577
}
7678

77-
public Task Handle(DidCloseTextDocumentParams notification, CancellationToken token)
79+
public Task<Unit> Handle(DidCloseTextDocumentParams notification, CancellationToken token)
7880
{
79-
return Task.CompletedTask;
81+
return Unit.Task;
8082
}
8183

82-
public Task Handle(DidSaveTextDocumentParams notification, CancellationToken token)
84+
public Task<Unit> Handle(DidSaveTextDocumentParams notification, CancellationToken token)
8385
{
84-
return Task.CompletedTask;
86+
return Unit.Task;
8587
}
8688

8789
TextDocumentSaveRegistrationOptions IRegistration<TextDocumentSaveRegistrationOptions>.GetRegistrationOptions()

src/Client/LanguageClient.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
using OmniSharp.Extensions.LanguageServer.Protocol.Serialization;
1515
using OmniSharp.Extensions.LanguageServer.Protocol.Server.Capabilities;
1616
using ISerializer = OmniSharp.Extensions.LanguageServer.Protocol.Serialization.ISerializer;
17+
using Serializer = OmniSharp.Extensions.LanguageServer.Protocol.Serialization.Serializer;
1718

1819
namespace OmniSharp.Extensions.LanguageServer.Client
1920
{

src/Client/Protocol/LspConnection.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities;
1717
using OmniSharp.Extensions.LanguageServer.Protocol.Serialization;
1818
using JsonRpcMessages = OmniSharp.Extensions.JsonRpc.Server.Messages;
19+
using Serializer = OmniSharp.Extensions.LanguageServer.Protocol.Serialization.Serializer;
1920

2021
namespace OmniSharp.Extensions.LanguageServer.Client.Protocol
2122
{

src/JsonRpc/HandlerCollection.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
using System;
22
using System.Collections;
33
using System.Collections.Generic;
4+
using System.Diagnostics;
45
using System.Linq;
56
using System.Reflection;
67
using MediatR;
78

89
namespace OmniSharp.Extensions.JsonRpc
910
{
10-
class HandlerCollection : IEnumerable<IHandlerDescriptor>
11+
[DebuggerDisplay("{Method}")]
12+
public class HandlerCollection : IEnumerable<IHandlerDescriptor>
1113
{
1214
internal readonly List<HandlerInstance> _handlers = new List<HandlerInstance>();
1315

src/JsonRpc/JsonRpc.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<TargetFrameworks>netstandard2.0</TargetFrameworks>
44
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -9,7 +9,7 @@
99
<PackageReference Include="MediatR" Version="$(MediatR_Version)" />
1010
<PackageReference Include="Newtonsoft.Json" Version="$(Newtonsoft_Version)" />
1111
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="$(Microsoft_Extensions_Logging_Version)" />
12-
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="$(MediatR_Version)" />
12+
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="$(MediatR_Extensions_DependencyInjection_Version)" />
1313
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="$(Microsoft_Extensions_DependencyInjection_Version)" />
1414
</ItemGroup>
1515
</Project>

0 commit comments

Comments
 (0)