File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
src/PowerShellEditorServices.Protocol/Server Expand file tree Collapse file tree 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(
10821082 {
10831083 var scriptFile = EditorSession . Workspace . GetFile ( requestParams . DocumentUri ) ;
10841084 var expectedFunctionLine = requestParams . TriggerPosition . Line + 2 ;
1085+
10851086 string helpLocation ;
10861087 var functionDefinitionAst = EditorSession . LanguageService . GetFunctionDefinitionForHelpComment (
10871088 scriptFile ,
10881089 requestParams . TriggerPosition . Line + 1 ,
10891090 out helpLocation ) ;
1090-
10911091 var result = new CommentHelpRequestResult ( ) ;
10921092 if ( functionDefinitionAst != null )
10931093 {
@@ -1100,7 +1100,6 @@ protected async Task HandleCommentHelpRequest(
11001100 requestParams . BlockComment ,
11011101 true ,
11021102 helpLocation ) ) ;
1103-
11041103 result . Content = analysisResults ?
11051104 . FirstOrDefault ( ) ?
11061105 . Correction ?
@@ -1109,10 +1108,11 @@ protected async Task HandleCommentHelpRequest(
11091108 . Split ( '\n ' )
11101109 . Select ( x => x . Trim ( '\r ' ) )
11111110 . ToArray ( ) ;
1112-
1113- if ( helpLocation . Equals ( "begin " , StringComparison . OrdinalIgnoreCase ) )
1111+ if ( helpLocation != null &&
1112+ ! helpLocation . Equals ( "before " , StringComparison . OrdinalIgnoreCase ) )
11141113 {
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"
11161116 result . Content = result . Content ? . Skip ( 1 ) . ToArray ( ) ;
11171117 }
11181118 }
You can’t perform that action at this time.
0 commit comments