vscode icon indicating copy to clipboard operation
vscode copied to clipboard

open a file on a different path but with same name fails

Open cognominal opened this issue 1 year ago • 6 comments

Type: Bug

Motivation: I want to see in my current session the package.json file from another folder to compare it with the local package.json

I use open file or folder to open this file. It succeeds when the package.json is NOT open in the current editor. It silently fail when it is. I suppose the code compare the names instead of comparing the paths. That should be an easy fix.

VS Code version: Code - Insiders 1.87.0-insider (Universal) (8fa84589eef3538dbc763ff98dc7d5a8a0c56374, 2024-02-09T05:49:05.817Z) OS version: Darwin arm64 23.1.0 Modes:

System Info
Item Value
CPUs Apple M2 (8 x 24)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) 4, 4, 3
Memory (System) 16.00GB (0.06GB free)
Process Argv --crash-reporter-id c1c4d606-0967-44a6-9a85-266bfd87b8c9
Screen Reader no
VM 0%
Extensions: none
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805cf:30301675
vsaa593:30376534
py29gd2263:30784851
c4g48928:30535728
962ge761:30841072
pythongtdpath:30726887
welcomedialog:30812478
pythonidxpt:30768918
pythonnoceb:30776497
asynctok:30898717
dsvsc013:30777762
dsvsc014:30777825
dsvsc015:30821418
pythontestfixt:30866404
pythonregdiag2:30926734
pyreplss1:30879911
pythonmypyd1:30859725
pythoncet0:30859736
pythontbext0:30879054
accentitlementst:30870582
dsvsc016:30879898
dsvsc017:30880771
dsvsc018:30880772
8082a590:30961435
b1063948:30943794
fegfb526:30952798
7j2b6412:30951517
e3gdj431:30946825
8f97e687:30959763
ccp1r3:30958150

cognominal avatar Feb 10 '24 01:02 cognominal

It seems it happens around here in the matches function but there are so many features that I am lost https://github.com/microsoft/vscode/blob/70e606d5fce956a27366c2675c8f6b0e0c63bfb8/src/vs/workbench/common/editor/editorGroupModel.ts

Anyway the workaround is easy. So it not a big issue

cognominal avatar Feb 10 '24 02:02 cognominal

/gifPlease

bpasero avatar Feb 17 '24 12:02 bpasero

Thanks for reporting this issue! Unfortunately, it's hard for us to understand what issue you're seeing. Please help us out by providing a screen recording showing exactly what isn't working as expected. While we can work with most standard formats, .gif files are preferred as they are displayed inline on GitHub. You may find https://gifcap.dev helpful as a browser-based gif recording tool.

If the issue depends on keyboard input, you can help us by enabling screencast mode for the recording (Developer: Toggle Screencast Mode in the command palette). Lastly, please attach this file via the GitHub web interface as emailed responses will strip files out from the issue.

Happy coding!

vscodenpa avatar Feb 17 '24 12:02 vscodenpa

Thx for your help. I have not quite yet figured to correctly use gifcap.dev. So far, I know how to capture part of a chrome window for the current tab. So, I capture a session within vscode.dev which illustrates the problem. One sees a pickdialog where I paste the name of the file to open. I type return, nothing happens

Recording 2024-02-18 at 01 22 46

cognominal avatar Feb 18 '24 00:02 cognominal

In your example the you are still opening the same file, so I am not sure what else you would expect? Maybe the issue here is that the picker does not update when you paste the absolute file path?

bpasero avatar Feb 18 '24 19:02 bpasero

I open a file with the same name in a different repo, that is with a different path. If I open a file with a different name than the one of the current editor, it works fine which is an easy work around. Thx for your feedback.

On Sunday, February 18, 2024, Benjamin Pasero @.***> wrote:

In your example the you are still opening the same file, so I am not sure what else you would expect?

— Reply to this email directly, view it on GitHub https://github.com/microsoft/vscode/issues/204886#issuecomment-1951418518, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAD6MBEYADUG3XPKZCH4QLYUJHKRAVCNFSM6AAAAABDCKBUTGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNJRGQYTQNJRHA . You are receiving this because you authored the thread.Message ID: @.***>

-- cognominal stef

cognominal avatar Feb 19 '24 00:02 cognominal

@cognominal but in your recording, when you enter the path of that other file, the elements below do not seem to be changing, so when you press enter, it opens the package.json as before, can you confirm that theory? The way this dialog works is that it opens the selected file below the input field when you press enter.

bpasero avatar Feb 19 '24 07:02 bpasero

@bpasero As I said "I use open file or folder to open this file. It succeeds when the package.json is NOT open in the current editor. It silently fail when it is." I don't know if "it [re]opens the [current] package.json" or, as I said "it silently fails". As a user, I can only say that the current package.json is left untouched and the file which path i gave in the pick dialog is not opened. If I make the current file in the current editor anything but a package.json, opening a package.json with a different path works fine so the problem is just a minor inconvenience.

cognominal avatar Feb 19 '24 08:02 cognominal

Can you give me very exact steps how to reproduce from scratch so that I can try for myself?

bpasero avatar Feb 19 '24 09:02 bpasero

Sorry I did not realise that was so hard to replicate. Indeed here, I obtain different results by doing seemingly equivalent stuff. The setup is the following :

TMPDIR=~/tmp mkdir $TMPDIR mkdir $TMPDIR/a mkdir $TMPDIR/b echo '{"a": "b"}' >$TMPDIR/a/package.json echo '{"c": "d"}' >$TMPDIR/b/package.json code-insiders $TMPDIR/a

Then I interact within vsocde. I get some stuff about trusting folder when I do the described stuff below for the first time.

I had cut in advance the path of ~/tmp/b/package.json I use the command open open file or folder, erase the proposed path, paste, and type ENTER. Nothing happens.

Next, from second 14 If I do the same but by a different interaction, it opens correctly. Here is a .mov file of these interactions :

https://github.com/microsoft/vscode/assets/16176/4b13deb7-ec6d-498d-bbb8-77c589a9dad1

I realize, for whatever reason, part of the pasted path is in uppercase. On a mac, that should not make a difference. And I later replicated the same interactions with the path with the correct "case".

I don't mind if you close the issue. That does not matter to me. Anyway I hope I help you to replicate.

cognominal avatar Feb 19 '24 14:02 cognominal

Thanks, this looks to me like a bug with the simple file dialog not updating its list in this case, still showing the previous contents.

bpasero avatar Feb 19 '24 19:02 bpasero