Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Roslynator Analyzers via Nuget Package #2206

Merged
merged 2 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@
<PackageVersion Include="OmniSharp.Extensions.LanguageClient" Version="0.19.9" />
<PackageVersion Include="OmniSharp.Extensions.LanguageServer" Version="0.19.9" />
<PackageVersion Include="PowerShellStandard.Library" Version="5.1.1" />
<PackageVersion Include="Roslynator.Analyzers" Version="4.12.9">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageVersion>
<PackageVersion Include="Roslynator.CodeAnalysis.Analyzers" Version="4.12.9">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageVersion>
<PackageVersion Include="Roslynator.Formatting.Analyzers" Version="4.12.9">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageVersion>
<PackageVersion Include="System.IO.Pipes.AccessControl" Version="5.0.0" />
<PackageVersion Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" />
<PackageVersion Include="System.Security.Principal" Version="4.3.0" />
Expand All @@ -22,4 +34,4 @@
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
<PackageVersion Include="Xunit.SkippableFact" Version="1.4.13" />
</ItemGroup>
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ public void LogException(
/// <param name="ui">The PowerShell host user interface object to log output to.</param>
internal class PSHostLogger(PSHostUserInterface ui) : IObserver<(PsesLogLevel logLevel, string message)>
{

public void OnCompleted()
{
// No-op since there's nothing to close or dispose,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), PowerShellEditorServices.Common.props))\PowerShellEditorServices.Common.props" />
<Import
Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), PowerShellEditorServices.Common.props))\PowerShellEditorServices.Common.props" />

<PropertyGroup>
<TargetFrameworks>net8.0;net462</TargetFrameworks>
Expand All @@ -16,6 +17,12 @@
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" />
</ItemGroup>

<ItemGroup Label="Roslynator">
<PackageReference Include="Roslynator.Analyzers" />
<PackageReference Include="Roslynator.CodeAnalysis.Analyzers" />
<PackageReference Include="Roslynator.Formatting.Analyzers" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\PowerShellEditorServices\PowerShellEditorServices.csproj" PrivateAssets="all" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ internal class LanguageServerLoggerProvider(ILanguageServerFacade languageServer
public void Dispose() { }
}


public static class LanguageServerLoggerExtensions
{
/// <summary>
Expand Down
9 changes: 8 additions & 1 deletion src/PowerShellEditorServices/PowerShellEditorServices.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), PowerShellEditorServices.Common.props))\PowerShellEditorServices.Common.props" />
<Import
Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), PowerShellEditorServices.Common.props))\PowerShellEditorServices.Common.props" />

<PropertyGroup>
<AssemblyTitle>PowerShell Editor Services</AssemblyTitle>
Expand Down Expand Up @@ -41,6 +42,12 @@
<PackageReference Include="System.Security.Principal.Windows" />
</ItemGroup>

<ItemGroup Label="Roslynator">
<PackageReference Include="Roslynator.Analyzers" />
<PackageReference Include="Roslynator.CodeAnalysis.Analyzers" />
<PackageReference Include="Roslynator.Formatting.Analyzers" />
</ItemGroup>

<Choose>
<When Condition=" '$(LocalOmniSharp)' == 'true' ">
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,6 @@ void RunspaceChangedHandler(object s, RunspaceChangedEventArgs _)
throw new RpcErrorException(0, null, "Invalid configuration with no process ID nor custom pipe name!");
}


// Execute the Debug-Runspace command but don't await it because it
// will block the debug adapter initialization process. The
// InitializedEvent will be sent as soon as the RunspaceChanged
Expand All @@ -328,7 +327,6 @@ void RunspaceChangedHandler(object s, RunspaceChangedEventArgs _)

if (request.RunspaceId < 1)
{

throw new RpcErrorException(0, null, "A positive integer must be specified for the RunspaceId!");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,4 @@ public static StackFrame CreateStackFrame(StackFrameDetails stackFrame, long id)
Column = invocationInfo.OffsetInLine,
PresentationHint = StackFramePresentationHint.Label
};

}

Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@ public async Task<VariablesResponse> Handle(VariablesArguments request, Cancella
.ToArray()
};
}
#pragma warning disable RCS1075
catch (Exception)
{
// TODO: This shouldn't be so broad
}
#pragma warning restore RCS1075

return variablesResponse;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ public override async Task<Unit> Handle(DidChangeConfigurationParams request, Ca
return await Unit.Task.ConfigureAwait(false);
}


public event EventHandler<LanguageServerSettings> ConfigurationUpdated;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,6 @@ await PsesDebugAdapterClient.SetBreakpoints(
await PsesDebugAdapterClient.RequestConfigurationDone(new ConfigurationDoneArguments());
await PsesDebugAdapterClient.LaunchScript(filePath, Started);


// Get the stacktrace for the breakpoint
await Assert.ThrowsAsync<JsonRpcException>(() => PsesDebugAdapterClient.RequestStackTrace(
new StackTraceArguments { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ public async Task InitializeAsync()
variableScriptFile = GetDebugScript("VariableTest.ps1");
}


public async Task DisposeAsync()
{
debugService.Abort();
Expand Down
Loading