File tree 1 file changed +5
-5
lines changed
src/PowerShellEditorServices.Protocol/Server
1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -1082,12 +1082,12 @@ protected async Task HandleCommentHelpRequest(
1082
1082
{
1083
1083
var scriptFile = EditorSession . Workspace . GetFile ( requestParams . DocumentUri ) ;
1084
1084
var expectedFunctionLine = requestParams . TriggerPosition . Line + 2 ;
1085
+
1085
1086
string helpLocation ;
1086
1087
var functionDefinitionAst = EditorSession . LanguageService . GetFunctionDefinitionForHelpComment (
1087
1088
scriptFile ,
1088
1089
requestParams . TriggerPosition . Line + 1 ,
1089
1090
out helpLocation ) ;
1090
-
1091
1091
var result = new CommentHelpRequestResult ( ) ;
1092
1092
if ( functionDefinitionAst != null )
1093
1093
{
@@ -1100,7 +1100,6 @@ protected async Task HandleCommentHelpRequest(
1100
1100
requestParams . BlockComment ,
1101
1101
true ,
1102
1102
helpLocation ) ) ;
1103
-
1104
1103
result . Content = analysisResults ?
1105
1104
. FirstOrDefault ( ) ?
1106
1105
. Correction ?
@@ -1109,10 +1108,11 @@ protected async Task HandleCommentHelpRequest(
1109
1108
. Split ( '\n ' )
1110
1109
. Select ( x => x . Trim ( '\r ' ) )
1111
1110
. ToArray ( ) ;
1112
-
1113
- if ( helpLocation . Equals ( "begin " , StringComparison . OrdinalIgnoreCase ) )
1111
+ if ( helpLocation != null &&
1112
+ ! helpLocation . Equals ( "before " , StringComparison . OrdinalIgnoreCase ) )
1114
1113
{
1115
- // we need to trim the leading `{` that the correction sends.
1114
+ // we need to trim the leading `{` and newline when helpLocation=="begin"
1115
+ // we also need to trim the leading newline when helpLocation=="end"
1116
1116
result . Content = result . Content ? . Skip ( 1 ) . ToArray ( ) ;
1117
1117
}
1118
1118
}
You can’t perform that action at this time.
0 commit comments