File tree 1 file changed +8
-2
lines changed
src/PowerShellEditorServices/Services/TextDocument/Handlers
1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 5
5
6
6
using System ;
7
7
using System . Management . Automation ;
8
+ using System . Text ;
8
9
using System . Text . RegularExpressions ;
9
10
using System . Threading ;
10
11
using System . Threading . Tasks ;
@@ -251,8 +252,13 @@ private static CompletionItem CreateCompletionItem(
251
252
// This causes the editing cursor to be placed *before* the final quote after completion,
252
253
// which makes subsequent path completions work. See this part of the LSP spec for details:
253
254
// 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 ( ) ;
256
262
insertTextFormat = InsertTextFormat . Snippet ;
257
263
}
258
264
You can’t perform that action at this time.
0 commit comments