Skip to content

Commit 7ff85b9

Browse files
committed
Add comment to address PR feedback
1 parent a384e72 commit 7ff85b9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/PowerShellEditorServices.Protocol/Server/LanguageServer.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1962,6 +1962,12 @@ private static CompletionItem CreateCompletionItem(
19621962
(completionDetails.CompletionType == CompletionType.Folder)) &&
19631963
(completionText.EndsWith("\"") || completionText.EndsWith("'")))
19641964
{
1965+
// Insert a final "tab stop" as identified by $0 in the snippet provided for completion.
1966+
// For paths, we take the path return by PowerShell e.g. 'C:\Program Files' and insert
1967+
// the tab stop marker before the closing quote char e.g. 'C:\Program Files$0'.
1968+
// This causes the editing cursor to be placed *before* the final quote after the completion,
1969+
// which makes subsequent path completions work. See this part of the LSP spec for details:
1970+
// https://microsoft.github.io/language-server-protocol/specification#textDocument_completion
19651971
int len = completionDetails.CompletionText.Length;
19661972
completionText = completionDetails.CompletionText.Insert(len - 1, "$0");
19671973
insertTextFormat = InsertTextFormat.Snippet;

0 commit comments

Comments
 (0)