Open ntluong95 opened 3 months ago
Just to check @ntluong95 -- do you mean "slash" here? i.e. the slashes in the path?
Yes it is slash in the path
Can you say more about what you expected to happen or the problem you observed? I was digging into this and the slash direction during path completion on Windows appears to be correct:
Here is my output. I think the direction of slash should be /
instead of \
. Sometimes \
can mean escape sequence
Ah, gotcha; I misunderstood originally what you were saying. I believe the \
is normal for path normalization for Python on Windows, and this path completion comes from Jedi (read more here). If you would like to see a change in this behavior, I recommend you start a discussion over on the Jedi repo. Thanks!
IMHO this is worth fixing or working around in Positron, since the current behavior means that path autocompletion is relatively useless for Windows users. (It gives you strings that are invalid and don't actually represent the path completion desired.)
As an aside, note that Python will "sometimes" accept escape sequences and translate those to the intended string, but you usually see a warning. For example:
>>> "\s"
<stdin>:1: SyntaxWarning: invalid escape sequence '\s'
'\\s'
But you can't rely on that in general, since escape sequences that do have some meaning won't be transformed like that:
>>> "\b"
'\x08'
That's a great point; thanks.
I wanted to support the observation that inserting the windows backslash as an escape sequence also happens when I copy and paste the path from the context menu of the file explorer. Thanks for your great work!
Positron Version:
Positron Version: 2024.06.1 (system setup) build 2024.06.1-27 Code - OSS Version: 1.90.0 Commit: a893e5b282612ccb2200102957ac38d3c14e5196 Date: 2024-06-26T01:33:58.809Z Electron: 29.4.0 Chromium: 122.0.6261.156 Node.js: 20.9.0 V8: 12.2.281.27-electron.0 OS: Windows_NT x64 10.0.22621
Steps to reproduce the issue:
pd.read_csv("")
. The cursor is between the two quotation marks, then trigger the code completion for file path usingCtrl + Space
What did you expect to happen?
Normal slash direction for Windows 10 in py script Show file path in Jupyter Notebook
Were there any error messages in the output or Developer Tools console?