Skip to content

Commit 380bf60

Browse files
fix UNC intellisense backslash
1 parent 85d5330 commit 380bf60

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/PowerShellEditorServices.Protocol/Server/LanguageServer.cs

Lines changed: 7 additions & 2 deletions
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)