File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
src/PowerShellEditorServices.Protocol/Server Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -1962,6 +1962,12 @@ private static CompletionItem CreateCompletionItem(
1962
1962
( completionDetails . CompletionType == CompletionType . Folder ) ) &&
1963
1963
( completionText . EndsWith ( "\" " ) || completionText . EndsWith ( "'" ) ) )
1964
1964
{
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
1965
1971
int len = completionDetails . CompletionText . Length ;
1966
1972
completionText = completionDetails . CompletionText . Insert ( len - 1 , "$0" ) ;
1967
1973
insertTextFormat = InsertTextFormat . Snippet ;
You can’t perform that action at this time.
0 commit comments