Skip to content

Commit e54c091

Browse files
committed
Use the right SendEvent call in server implementations
This change fixes broken language and debug server tests by switching to a different SendEvent implementation which ensures that the event is being sent from the correct thread. A true fix will be needed in the future to ensure that all SendEvent implementations will use the correct thread for sending event messages.
1 parent 8a23174 commit e54c091

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/PowerShellEditorServices.Protocol/Server/DebugAdapter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ protected Task LaunchScript(RequestContext<object> requestContext)
9191
// Make sure remaining output is flushed before exiting
9292
await this.outputDebouncer.Flush();
9393

94-
await requestContext.SendEvent(
94+
await this.SendEvent(
9595
TerminatedEvent.Type,
9696
new TerminatedEvent());
9797

@@ -198,7 +198,7 @@ await this.editorSession.PowerShellContext.ExecuteScriptString(
198198

199199
// Send the InitializedEvent so that the debugger will continue
200200
// sending configuration requests
201-
await requestContext.SendEvent(
201+
await this.SendEvent(
202202
InitializedEvent.Type,
203203
null);
204204
}

src/PowerShellEditorServices.Protocol/Server/LanguageServer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ private async Task HandleSetPSSARulesRequest(
232232
await RunScriptDiagnostics(
233233
new ScriptFile[] { scripFile },
234234
editorSession,
235-
requestContext.SendEvent);
235+
this.SendEvent);
236236
await sendresult;
237237
}
238238

@@ -1136,7 +1136,7 @@ private Task RunScriptDiagnostics(
11361136
EditorSession editorSession,
11371137
EventContext eventContext)
11381138
{
1139-
return RunScriptDiagnostics(filesToAnalyze, editorSession, eventContext.SendEvent);
1139+
return RunScriptDiagnostics(filesToAnalyze, editorSession, this.SendEvent);
11401140
}
11411141

11421142
private Task RunScriptDiagnostics(

0 commit comments

Comments
 (0)