Skip to content

Commit 3da17ee

Browse files
author
Kapil Borle
committed
Handle null value returned by formatter
1 parent f09d70c commit 3da17ee

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/PowerShellEditorServices.Protocol/Server/LanguageServer.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1159,7 +1159,10 @@ protected async Task HandleDocumentFormattingRequest(
11591159
// TODO Get settings
11601160
// TODO Update settings to store code formatting settings
11611161
var scriptFile = editorSession.Workspace.GetFile(formattingParams.TextDocument.Uri);
1162-
var formattedScript = await editorSession.AnalysisService.Format(scriptFile.Contents);
1162+
1163+
// TODO raise an error event incase format returns null;
1164+
var formattedScript = await editorSession.AnalysisService.Format(scriptFile.Contents) ??
1165+
scriptFile.Contents;
11631166
var extent = scriptFile.ScriptAst.Extent;
11641167

11651168
// todo create an extension for this

0 commit comments

Comments
 (0)