File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
src/PowerShellEditorServices/Services/TextDocument/Handlers Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 55
66using System ;
77using System . Management . Automation ;
8+ using System . Text ;
89using System . Text . RegularExpressions ;
910using System . Threading ;
1011using System . Threading . Tasks ;
@@ -251,8 +252,13 @@ private static CompletionItem CreateCompletionItem(
251252 // This causes the editing cursor to be placed *before* the final quote after completion,
252253 // which makes subsequent path completions work. See this part of the LSP spec for details:
253254 // https://microsoft.github.io/language-server-protocol/specification#textDocument_completion
254- int len = completionDetails . CompletionText . Length ;
255- completionText = completionDetails . CompletionText . Insert ( len - 1 , "$0" ) ;
255+
256+ // Since we want to use a "tab stop" we need to escape a few things for Textmate to render properly.
257+ var sb = new StringBuilder ( completionDetails . CompletionText )
258+ . Replace ( @"\" , @"\\" )
259+ . Replace ( @"}" , @"\}" )
260+ . Replace ( @"$" , @"\$" ) ;
261+ completionText = sb . Insert ( sb . Length - 1 , "$0" ) . ToString ( ) ;
256262 insertTextFormat = InsertTextFormat . Snippet ;
257263 }
258264
You can’t perform that action at this time.
0 commit comments