Skip to content

Commit 7e0eefd

Browse files
Cleanup warnings and bump minor versions (#760)
* Updated to system.reactive, collections.immutable and nerdbank.streams * Cleanup existing warnings * disabled more warnings
1 parent aacb0ba commit 7e0eefd

File tree

261 files changed

+6284
-4094
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

261 files changed

+6284
-4094
lines changed

.build/Build.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using Nuke.Common.Tools.DotNet;
77
using Nuke.Common.Tools.GitVersion;
88
using Nuke.Common.Tools.MSBuild;
9-
using Rocket.Surgery.Nuke;
109
using Rocket.Surgery.Nuke.DotNetCore;
1110

1211
[PublicAPI]
@@ -37,7 +36,10 @@ public partial class Solution : NukeBuild,
3736
/// - Microsoft VisualStudio https://nuke.build/visualstudio
3837
/// - Microsoft VSCode https://nuke.build/vscode
3938
/// </summary>
40-
public static int Main() => Execute<Solution>(x => x.Default);
39+
public static int Main()
40+
{
41+
return Execute<Solution>(x => x.Default);
42+
}
4143

4244
[OptionalGitRepository] public GitRepository? GitRepository { get; }
4345

.lintstagedrc.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,8 @@ function cleanupcode(filenames) {
1919

2020
module.exports = {
2121
'*.cs': filenames => {
22-
return [`echo "'${filenames.join(`' '`)}'" | dotnet format --include -`].concat(cleanupcode(filenames));
22+
return [`echo "'${filenames.join(`' '`)}'" | dotnet format --include -`]; //.concat(cleanupcode(filenames));
2323
},
24-
'*.{csproj,targets,props,xml}': filenames =>
25-
forEachChunk(filenames, chunk => [`prettier --write '${chunk.join(`' '`)}'`]),
26-
'*.{js,ts,jsx,tsx,json,yml,yaml}': filenames =>
27-
forEachChunk(filenames, chunk => [`prettier --write '${chunk.join(`' '`)}'`]),
24+
'*.{csproj,targets,props,xml}': filenames => forEachChunk(filenames, chunk => [`prettier --write '${chunk.join(`' '`)}'`]),
25+
'*.{js,ts,jsx,tsx,json,yml,yaml}': filenames => forEachChunk(filenames, chunk => [`prettier --write '${chunk.join(`' '`)}'`]),
2826
};

Directory.Build.targets

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@
3535
<PackageReference Update="XunitXml.TestLogger" Version="3.0.70" />
3636
<PackageReference Update="coverlet.collector" Version="3.1.2" />
3737
<PackageReference Update="coverlet.msbuild" Version="3.1.2" />
38-
<PackageReference Update="System.Reactive" Version="4.4.1" />
39-
<PackageReference Update="System.Collections.Immutable" Version="1.7.1" />
38+
<PackageReference Update="System.Reactive" Version="5.0.0" />
39+
<PackageReference Update="System.Collections.Immutable" Version="5.0.0" />
4040
<PackageReference Update="System.Threading.Channels" Version="4.7.1" />
4141
<PackageReference Update="Microsoft.Reactive.Testing" Version="4.4.1" />
4242
<PackageReference Update="MediatR" Version="8.1.0" />
4343
<PackageReference Update="Bogus" Version="34.0.1" />
4444
<PackageReference Update="Snapper" Version="2.3.1" />
4545
<PackageReference Update="Xunit.SkippableFact" Version="1.4.13" />
46-
<PackageReference Update="Nerdbank.Streams" Version="2.6.81" />
46+
<PackageReference Update="Nerdbank.Streams" Version="2.8.57" />
4747
<PackageReference Update="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.0.1" />
4848
<PackageReference Update="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3" />
4949
<PackageReference Update="DryIoc.Internal" Version="4.8.6" />

sample/SampleServer/Program.cs

+40-18
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,16 @@
88
using OmniSharp.Extensions.LanguageServer.Server;
99
using Serilog;
1010

11+
// ReSharper disable UnusedParameter.Local
12+
1113
namespace SampleServer
1214
{
1315
internal class Program
1416
{
15-
private static void Main(string[] args) => MainAsync(args).Wait();
17+
private static void Main(string[] args)
18+
{
19+
MainAsync(args).Wait();
20+
}
1621

1722
private static async Task MainAsync(string[] args)
1823
{
@@ -51,9 +56,11 @@ private static async Task MainAsync(string[] args)
5156
.WithHandler<SemanticTokensHandler>()
5257
.WithServices(x => x.AddLogging(b => b.SetMinimumLevel(LogLevel.Trace)))
5358
.WithServices(
54-
services => {
59+
services =>
60+
{
5561
services.AddSingleton(
56-
provider => {
62+
provider =>
63+
{
5764
var loggerFactory = provider.GetService<ILoggerFactory>();
5865
var logger = loggerFactory.CreateLogger<Foo>();
5966

@@ -63,20 +70,24 @@ private static async Task MainAsync(string[] args)
6370
}
6471
);
6572
services.AddSingleton(
66-
new ConfigurationItem {
73+
new ConfigurationItem
74+
{
6775
Section = "typescript",
6876
}
6977
).AddSingleton(
70-
new ConfigurationItem {
78+
new ConfigurationItem
79+
{
7180
Section = "terminal",
7281
}
7382
);
7483
}
7584
)
7685
.OnInitialize(
77-
async (server, request, token) => {
86+
async (server, request, token) =>
87+
{
7888
var manager = server.WorkDoneManager.For(
79-
request, new WorkDoneProgressBegin {
89+
request, new WorkDoneProgressBegin
90+
{
8091
Title = "Server is starting...",
8192
Percentage = 10,
8293
}
@@ -86,17 +97,20 @@ private static async Task MainAsync(string[] args)
8697
await Task.Delay(2000).ConfigureAwait(false);
8798

8899
manager.OnNext(
89-
new WorkDoneProgressReport {
100+
new WorkDoneProgressReport
101+
{
90102
Percentage = 20,
91103
Message = "loading in progress"
92104
}
93105
);
94106
}
95107
)
96108
.OnInitialized(
97-
async (server, request, response, token) => {
109+
async (server, request, response, token) =>
110+
{
98111
workDone.OnNext(
99-
new WorkDoneProgressReport {
112+
new WorkDoneProgressReport
113+
{
100114
Percentage = 40,
101115
Message = "loading almost done",
102116
}
@@ -105,7 +119,8 @@ private static async Task MainAsync(string[] args)
105119
await Task.Delay(2000).ConfigureAwait(false);
106120

107121
workDone.OnNext(
108-
new WorkDoneProgressReport {
122+
new WorkDoneProgressReport
123+
{
109124
Message = "loading done",
110125
Percentage = 100,
111126
}
@@ -114,8 +129,10 @@ private static async Task MainAsync(string[] args)
114129
}
115130
)
116131
.OnStarted(
117-
async (languageServer, token) => {
118-
using var manager = await languageServer.WorkDoneManager.Create(new WorkDoneProgressBegin { Title = "Doing some work..." }).ConfigureAwait(false);
132+
async (languageServer, token) =>
133+
{
134+
using var manager = await languageServer.WorkDoneManager.Create(new WorkDoneProgressBegin { Title = "Doing some work..." })
135+
.ConfigureAwait(false);
119136

120137
manager.OnNext(new WorkDoneProgressReport { Message = "doing things..." });
121138
await Task.Delay(10000).ConfigureAwait(false);
@@ -125,9 +142,11 @@ private static async Task MainAsync(string[] args)
125142

126143
var logger = languageServer.Services.GetService<ILogger<Foo>>();
127144
var configuration = await languageServer.Configuration.GetConfiguration(
128-
new ConfigurationItem {
145+
new ConfigurationItem
146+
{
129147
Section = "typescript",
130-
}, new ConfigurationItem {
148+
}, new ConfigurationItem
149+
{
131150
Section = "terminal",
132151
}
133152
).ConfigureAwait(false);
@@ -138,15 +157,15 @@ private static async Task MainAsync(string[] args)
138157
baseConfig.Add(config.Key, config.Value);
139158
}
140159

141-
logger.LogInformation("Base Config: {Config}", baseConfig);
160+
logger.LogInformation("Base Config: {@Config}", baseConfig);
142161

143162
var scopedConfig = new JObject();
144163
foreach (var config in configuration.AsEnumerable())
145164
{
146165
scopedConfig.Add(config.Key, config.Value);
147166
}
148167

149-
logger.LogInformation("Scoped Config: {Config}", scopedConfig);
168+
logger.LogInformation("Scoped Config: {@Config}", scopedConfig);
150169
}
151170
)
152171
).ConfigureAwait(false);
@@ -165,6 +184,9 @@ public Foo(ILogger<Foo> logger)
165184
_logger = logger;
166185
}
167186

168-
public void SayFoo() => _logger.LogInformation("Fooooo!");
187+
public void SayFoo()
188+
{
189+
_logger.LogInformation("Fooooo!");
190+
}
169191
}
170192
}

sample/SampleServer/SemanticTokensHandler.cs

+27-16
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities;
1010
using OmniSharp.Extensions.LanguageServer.Protocol.Document;
1111
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
12-
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
1312

1413
namespace SampleServer
1514
{
@@ -18,8 +17,10 @@ public class SemanticTokensHandler : SemanticTokensHandlerBase
1817
{
1918
private readonly ILogger _logger;
2019

21-
public SemanticTokensHandler(ILogger<SemanticTokensHandler> logger) =>
20+
public SemanticTokensHandler(ILogger<SemanticTokensHandler> logger)
21+
{
2222
_logger = logger;
23+
}
2324

2425
public override async Task<SemanticTokens?> Handle(
2526
SemanticTokensParams request, CancellationToken cancellationToken
@@ -57,7 +58,7 @@ CancellationToken cancellationToken
5758
var content = await File.ReadAllTextAsync(DocumentUri.GetFileSystemPath(identifier), cancellationToken).ConfigureAwait(false);
5859
await Task.Yield();
5960

60-
foreach (var (line, text) in content.Split('\n').Select((text, line) => (line, text)))
61+
foreach (var (line, text) in content.Split('\n').Select((text, line) => ( line, text )))
6162
{
6263
var parts = text.TrimEnd().Split(';', ' ', '.', '"', '(', ')');
6364
var index = 0;
@@ -73,8 +74,10 @@ CancellationToken cancellationToken
7374
}
7475

7576
protected override Task<SemanticTokensDocument>
76-
GetSemanticTokensDocument(ITextDocumentIdentifierParams @params, CancellationToken cancellationToken) =>
77-
Task.FromResult(new SemanticTokensDocument(RegistrationOptions.Legend));
77+
GetSemanticTokensDocument(ITextDocumentIdentifierParams @params, CancellationToken cancellationToken)
78+
{
79+
return Task.FromResult(new SemanticTokensDocument(RegistrationOptions.Legend));
80+
}
7881

7982

8083
private IEnumerable<T> RotateEnum<T>(IEnumerable<T> values)
@@ -86,17 +89,25 @@ private IEnumerable<T> RotateEnum<T>(IEnumerable<T> values)
8689
}
8790
}
8891

89-
protected override SemanticTokensRegistrationOptions CreateRegistrationOptions(SemanticTokensCapability capability, ClientCapabilities clientCapabilities) => new SemanticTokensRegistrationOptions {
90-
DocumentSelector = DocumentSelector.ForLanguage("csharp"),
91-
Legend = new SemanticTokensLegend() {
92-
TokenModifiers = capability.TokenModifiers,
93-
TokenTypes = capability.TokenTypes
94-
},
95-
Full = new SemanticTokensCapabilityRequestFull {
96-
Delta = true
97-
},
98-
Range = true
99-
};
92+
protected override SemanticTokensRegistrationOptions CreateRegistrationOptions(
93+
SemanticTokensCapability capability, ClientCapabilities clientCapabilities
94+
)
95+
{
96+
return new SemanticTokensRegistrationOptions
97+
{
98+
DocumentSelector = DocumentSelector.ForLanguage("csharp"),
99+
Legend = new SemanticTokensLegend
100+
{
101+
TokenModifiers = capability.TokenModifiers,
102+
TokenTypes = capability.TokenTypes
103+
},
104+
Full = new SemanticTokensCapabilityRequestFull
105+
{
106+
Delta = true
107+
},
108+
Range = true
109+
};
110+
}
100111
}
101112
#pragma warning restore 618
102113
}

0 commit comments

Comments
 (0)