Skip to content

Commit 809d244

Browse files
Fix UNC intellisense backslash (#1044)
* fix UNC intellisense backslash * use here string * here everywhere
1 parent 17e8aab commit 809d244

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/PowerShellEditorServices.Protocol/Server/LanguageServer.cs

+7-2
Original file line numberDiff line numberDiff line change
@@ -1987,8 +1987,13 @@ private static CompletionItem CreateCompletionItem(
19871987
// This causes the editing cursor to be placed *before* the final quote after completion,
19881988
// which makes subsequent path completions work. See this part of the LSP spec for details:
19891989
// https://microsoft.github.io/language-server-protocol/specification#textDocument_completion
1990-
int len = completionDetails.CompletionText.Length;
1991-
completionText = completionDetails.CompletionText.Insert(len - 1, "$0");
1990+
1991+
// Since we want to use a "tab stop" we need to escape a few things for Textmate to render properly.
1992+
var sb = new StringBuilder(completionDetails.CompletionText)
1993+
.Replace(@"\", @"\\")
1994+
.Replace(@"}", @"\}")
1995+
.Replace(@"$", @"\$");
1996+
completionText = sb.Insert(sb.Length - 1, "$0").ToString();
19921997
insertTextFormat = InsertTextFormat.Snippet;
19931998
}
19941999

0 commit comments

Comments
 (0)