Skip to content

Commit 8332631

Browse files
Fix UNC intellisense backslash (#1044)
* fix UNC intellisense backslash * use here string * here everywhere
1 parent 00a5e6d commit 8332631

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
@@ -2010,8 +2010,13 @@ private static CompletionItem CreateCompletionItem(
20102010
// This causes the editing cursor to be placed *before* the final quote after completion,
20112011
// which makes subsequent path completions work. See this part of the LSP spec for details:
20122012
// https://microsoft.github.io/language-server-protocol/specification#textDocument_completion
2013-
int len = completionDetails.CompletionText.Length;
2014-
completionText = completionDetails.CompletionText.Insert(len - 1, "$0");
2013+
2014+
// Since we want to use a "tab stop" we need to escape a few things for Textmate to render properly.
2015+
var sb = new StringBuilder(completionDetails.CompletionText)
2016+
.Replace(@"\", @"\\")
2017+
.Replace(@"}", @"\}")
2018+
.Replace(@"$", @"\$");
2019+
completionText = sb.Insert(sb.Length - 1, "$0").ToString();
20152020
insertTextFormat = InsertTextFormat.Snippet;
20162021
}
20172022

0 commit comments

Comments
 (0)