-
Notifications
You must be signed in to change notification settings - Fork 510
file path intellisense inside quotes, selection moves cursor outside quotes #1398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
From @vscodebot[bot] on June 29, 2018 18:47 (Experimental duplicate detection) |
I think that would be from the Powershell extension. Can you check whether it happens if you start with |
Yes, disabling the PowerShell extension removes the file path intellisense functionality. Any other form of intellisense completion stays with in the quotes, only the file path completion ends outside the quotes. |
Hi @msftrncs thanks for this. Looks like path completion isn't working in the extension. This kind of surprises me as VSCode should be passing the completion message to the language server. Can you please attach your logs? Follow these steps: and instead if you could set it to "Diagnostic" instead of "Verbose" that would be better to debug this. Thanks! |
I did one file path auto complete in this log. It appears to occur about 12:51:45:112 |
Updated findings: I didn't realize PowerShell ISE's console supported path autocomplete, when it does it, it changes the command line so that the path is enclosed in quotes if needed, and leaves the cursor after the closing quote, Further typing a backslash '\' causes auto complete suggestions showing the contents of the already specified folder to be display, and selecting one again causes the cursor to land after the quote, to which it will replace if you remove it. This doesn't happen in the integrated PowerShell console of the VS Code PowerShell Extension, so maybe that is what is broken. Furthermore, auto completion doesn't work at all if the path is behind a quote, but the closing quote is not found where as that doesn't affect ISE, it just puts the closing quote back. |
Couple of corrections to my update above, I may have mistakenly use 'console' in some places. PowerShell ISE's console supports path auto-complete with intellisense, but the standard PowerShell 5.1 console from Windows 10, nor the VS Code PowerShell extensions integrated PowerShell console support this. When I spoke of PowerShell ISE's console replacing the missing ending quote, it only does this because the path being completed is the last thing on the line and it can properly interpret the path without the ending quote mark. All the editors share this same behavior. Otherwise PowerShell ISE's console and editor both respond the same and successfully auto-complete/intellisense paths, even while the cursor is past the closing quote. I've checked the logs again after trying it in VS Code / PowerShell Extension, pressing a '\' in to the document behind a path (cursor just after the ending quote) and this is the logs:
Nothing was presented to me from intellisense. I am guessing that the extension is not considering looking backwards in to the quoted string to see if it could auto complete a path, and thus it saw nothing it could do with intellisense. Note, Column 87, line 18, is this line: (part of filling a hash table, 4 space indent at the begining) |
Sorry, noticing the logs didn't seem like they said much, I missed you said to switch the logging to 'diagnostic'. This log probably does you more good. I can clearly read that the intellisense operation occurred, and resulted in the expected file list being returned, but I don't see anything that explains why I was not presented that list. |
Hi @msftrncs, just to clarify, does this restate your problem:
|
Only in the editor, yes. |
@itfranck, something to note, quotes are not needed around the typename parameter's argument value. But this is very interesting that it affects all areas where quoted objects are being completed. The problem probably stems from each completion replaces the entire string including the quotes, as VS Code leaves the cursor after the final quote since that was the last character replaced/inserted from the completion. This then leaves things in not the most ideal state to continue further completions for the same object. I know the PowerShell (and CMD) command line handle this well, as they leave the cursor inside the quoted string, but only if you press ENTER to accept the completion from the menu (ctrl-space), or if you are using the tab completion method. VS Code might need an improved completion API so that completion generators can suggest where to leave the cursor after the replacement/completion. EDIT: Its not just that the cursor ends up past the end quote, but also that another character is required to start the next phase of the completion, such as a '\' for a filepath, or '.' for a .NET namespace. |
Working on a fix for this. Filepath fix is working. Need to consider other completions that happen inside quotes. |
While generally true, quote might be needed in some instance, such as when having a comma in your type name. Dictionaries are a good example of this. New-Object -typename 'System.Collections.Generic.Dictionary[String,String]' work. Without the quote, it get passed as an array of string. |
Yes, but in most cases you are out of the need for intellisense by then. Interesting that everything is okay while autocompleting the inner type references, which would be because those completions do not affect the quotes themselves. Myself I prefer the 5.0 and later method of |
From @msftrncs on June 29, 2018 18:47
Issue Type: Bug
Enter the following where file path intellisense is permitted (I am working in a PowerShell file with the PowerShell extension, and could not determine if VS Code or PowerShell extension provide this functionality), on a new line:
$VARIABLE =
Then start with a single or double quote (I tried both), which automatically includes the closing quote on the other side of the cursor, and then start typing a valid file path (in my case, a network path '\server\share\folder'. Intellisense starts offering completion suggestions. Pressing TAB or ENTER to accept one of the suggestions cause the suggestion to be entered in to the document, and the cursor moves to the other side of the closing quote, preventing further traversal of the file hierarchy.
I could not find any documentation that suggested that file path intellisense worked differently (I couldn't find any documentation stating that VS Code had built in file path intellisense). The same effect did not happen if I manually triggered intellisense with a variable name (pressing CTRL-SPACE after a $ while just inside the closing quote). I would think that the behavior should be consistent, regardless of even which type of file system object I selected. The cursor should remain in front of the closing quote after the selection.
VS Code version: Code 1.24.1 (24f62626b222e9a8313213fb64b10d741a326288, 2018-06-13T17:51:32.889Z)
OS version: Windows_NT x64 10.0.17134
System Info
flash_3d: unavailable_software
flash_stage3d: unavailable_software
flash_stage3d_baseline: unavailable_software
gpu_compositing: unavailable_software
multiple_raster_threads: unavailable_off
native_gpu_memory_buffers: disabled_software
rasterization: unavailable_software
video_decode: unavailable_software
video_encode: unavailable_software
vpx_decode: unavailable_software
webgl: unavailable_off
webgl2: unavailable_off
Extensions (3)
Copied from original issue: microsoft/vscode#53353
The text was updated successfully, but these errors were encountered: