12
12
using Microsoft . PowerShell . EditorServices . Services . Extension ;
13
13
using Microsoft . PowerShell . EditorServices . Services . PowerShell . Host ;
14
14
using Microsoft . PowerShell . EditorServices . Services . Template ;
15
+ using OmniSharp . Extensions . LanguageServer . Protocol . Models ;
15
16
using OmniSharp . Extensions . LanguageServer . Protocol . Server ;
16
17
using OmniSharp . Extensions . LanguageServer . Server ;
17
18
using Serilog ;
@@ -23,16 +24,13 @@ namespace Microsoft.PowerShell.EditorServices.Server
23
24
/// </summary>
24
25
internal class PsesLanguageServer
25
26
{
26
- internal ILoggerFactory LoggerFactory { get ; private set ; }
27
-
27
+ internal ILoggerFactory LoggerFactory { get ; }
28
28
internal ILanguageServer LanguageServer { get ; private set ; }
29
-
30
29
private readonly LogLevel _minimumLogLevel ;
31
30
private readonly Stream _inputStream ;
32
31
private readonly Stream _outputStream ;
33
32
private readonly HostStartupInfo _hostDetails ;
34
33
private readonly TaskCompletionSource < bool > _serverStart ;
35
-
36
34
private PsesInternalHost _psesHost ;
37
35
38
36
/// <summary>
@@ -75,13 +73,13 @@ public async Task StartAsync()
75
73
{
76
74
LanguageServer = await OmniSharp . Extensions . LanguageServer . Server . LanguageServer . From ( options =>
77
75
{
78
- options
76
+ _ = options
79
77
. WithInput ( _inputStream )
80
78
. WithOutput ( _outputStream )
81
79
. WithServices ( serviceCollection =>
82
80
{
83
81
// NOTE: This adds a lot of services!
84
- serviceCollection . AddPsesLanguageServices ( _hostDetails ) ;
82
+ _ = serviceCollection . AddPsesLanguageServices ( _hostDetails ) ;
85
83
} )
86
84
. ConfigureLogging ( builder => builder
87
85
. AddSerilog ( Log . Logger ) // TODO: Set dispose to true?
@@ -117,26 +115,26 @@ public async Task StartAsync()
117
115
// _Initialize_ request:
118
116
// https://microsoft.github.io/language-server-protocol/specifications/specification-current/#initialize
119
117
. OnInitialize (
120
- ( languageServer , request , cancellationToken ) =>
118
+ ( languageServer , request , _ ) =>
121
119
{
122
120
Log . Logger . Debug ( "Initializing OmniSharp Language Server" ) ;
123
121
124
122
IServiceProvider serviceProvider = languageServer . Services ;
125
123
126
124
_psesHost = serviceProvider . GetService < PsesInternalHost > ( ) ;
127
125
128
- var workspaceService = serviceProvider . GetService < WorkspaceService > ( ) ;
126
+ WorkspaceService workspaceService = serviceProvider . GetService < WorkspaceService > ( ) ;
129
127
130
128
// Grab the workspace path from the parameters
131
- if ( request . RootUri != null )
129
+ if ( request . RootUri is not null )
132
130
{
133
131
workspaceService . WorkspacePath = request . RootUri . GetFileSystemPath ( ) ;
134
132
}
135
- else if ( request . WorkspaceFolders != null )
133
+ else if ( request . WorkspaceFolders is not null )
136
134
{
137
135
// If RootUri isn't set, try to use the first WorkspaceFolder.
138
136
// TODO: Support multi-workspace.
139
- foreach ( var workspaceFolder in request . WorkspaceFolders )
137
+ foreach ( WorkspaceFolder workspaceFolder in request . WorkspaceFolders )
140
138
{
141
139
workspaceService . WorkspacePath = workspaceFolder . Uri . GetFileSystemPath ( ) ;
142
140
break ;
@@ -157,7 +155,7 @@ public async Task StartAsync()
157
155
public async Task WaitForShutdown ( )
158
156
{
159
157
Log . Logger . Debug ( "Shutting down OmniSharp Language Server" ) ;
160
- await _serverStart . Task . ConfigureAwait ( false ) ;
158
+ _ = await _serverStart . Task . ConfigureAwait ( false ) ;
161
159
await LanguageServer . WaitForExit . ConfigureAwait ( false ) ;
162
160
163
161
// Doing this means we're able to route through any exceptions experienced on the pipeline thread
0 commit comments