Skip to content
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

View is titled "none" in context menu #96

Open
benblank opened this issue Oct 20, 2023 · 6 comments
Open

View is titled "none" in context menu #96

benblank opened this issue Oct 20, 2023 · 6 comments

Comments

@benblank
Copy link

Screenshot

A cropped screenshot showing the context menu for the Git Tree Compare view, showing that it is referred to as "none" there.

Steps to reproduce

  1. Create a new, empty profile (no settings1, no extensions).
  2. Install Git Tree Compare.
  3. Open a folder which is a Git working copy.
  4. Drag the tree icon from the activity bar into e.g. the Source Control view.
  5. Right-click the "GIT TREE COMPARE" view and observe that the view is referred to as "none" in the menu (e.g. "Hide 'none'").

Notes

I haven't dug too deeply into Code extensions, but just glancing at the contributes key in package.json, this line looks pretty suspicious. 😉

Environment, per Issue Reporter

Extension version: 1.16.0
VS Code version: Code 1.83.1 (f1b07bd25dfad64b0167beb15359ae573aecd2cc, 2023-10-10T23:48:05.904Z)
OS version: Windows_NT x64 10.0.19045
Modes:

System Info
Item Value
CPUs Intel(R) Core(TM) i7-10700K CPU @ 3.80GHz (16 x 3792)
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
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) undefined
Memory (System) 31.90GB (16.03GB free)
Process Argv --new-window --profile gtc-test --crash-reporter-id ba2b27cd-e5b8-458e-b85a-c2aaa5724f50
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492cf:30256860
vslsvsres303:30308271
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscorecescf:30445987
vscod805:30301674
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
pythonvs932:30410667
py29gd2263:30856252
6c1a3589:30846784
vscaat:30438848
vsclangdf:30486550
c4g48928:30535728
dsvsc012cf:30540253
pynewext54:30695312
azure-dev_surveyone:30548225
3biah626:30602489
89544117:30613380
a9j8j154:30646983
showlangstatbar:30737416
03d35959:30757346
pythonfmttext:30731395
fixshowwlkth:30771522
showindicator:30805244
pythongtdpath:30769146
i26e3531:30792625
gsofa:30866041
pythonnosmt12:30797651
pythonidxpt:30866567
pythonnoceb:30805159
copilotsettingt:30859503
dsvsc013:30795093
dsvsc014:30804076
diffeditorv2:30821572
dsvsc015:30845448
pythontestfixtcf:30866406
pyreplss1:30865275
pythontbext0:30864172

Footnotes

  1. In my case, I still had a small number of (in theory, irrelevant) application-wide User Settings:

    Code/User/settings.json
    {
      "settingsSync.ignoredSettings": [
        "terminal.integrated.gpuAcceleration"
      ],
      "window.newWindowDimensions": "maximized",
      "window.openFoldersInNewWindow": "on",
      "window.restoreWindows": "all"
    }
    
@letmaik
Copy link
Owner

letmaik commented Oct 21, 2023

I know, it's actually a hack to make the title of the tree view display consistently no matter where it's located (in its own tab or just inside the Explorer tab). What I wanted was to always have "Git Tree Compare: " as prefix, and there was no combination of options that allowed it without resorting to the hack. I can look into it again, but it's a minor issue in my opinion.

@letmaik
Copy link
Owner

letmaik commented Oct 21, 2023

I had a look again, and the issue was with double naming...

Changing the name to Git Tree Compare has the effect that when the extension isn't activated yet, it would show like below:

image

The case above would happen either when the view is still collapsed (since starting VS Code) and not in its own view container (like above when inside the Folders container), or if the workspace folder is not a git repository. In both cases the extension wouldn't be activated.

Currently, in the cases above, it would just display "Git Tree Compare: none" instead of the double name.

image

@benblank
Copy link
Author

Hmm. Is setting the view's name in package.json perhaps optional? I wish I had time to dig into this myself; I've been wanting to learn more about creating Code extensions, anyway. If I do get some time, I'll see what I can learn.

For what it's worth, there is a tangible downside to this, though it's probably a less common situation than using Code without opening a folder or opening a folder without a git repo. In my case, I installed GTC a few months ago and dragged the view into the Source Control sidebar because it felt like a natural place for it. At some point since then I must have hidden the view because, when I went to use GTC yesterday, I simply could not find it. I must have spent almost half an hour trying to rule out user error and Code weirdness before finally noticing "none" and unhiding it just to see if it was what I was looking for.

@letmaik
Copy link
Owner

letmaik commented Oct 22, 2023

name is mandatory. The point you raise about discoverability is a good one. Probably important enough to accept the double name. I wonder if there's a similar case in another extension or some other work-around.

@benblank
Copy link
Author

I briefly scanned the other views provided by VS Code and the extensions I have installed, but only found one view which does something like this — the built-in Folders view. Its "name" in the context menu is "Folders", its title when a single folder is open shows that folder's name, and its title when no folders are opened shows "No Folders Opened".

But because it's built in, I don't know that it has anything like a contributes block. Additionally, a quick search of the source shows that it even has a completely separate "empty view". I'm not sure whether anything it's doing would be helpful to you, unfortunately, but it could be worth checking out.

@letmaik
Copy link
Owner

letmaik commented Oct 25, 2023

The empty view shows up like this:

image

To me this looks like a similar hack. The trick is that they use two separate views, but I don't think this would work well in my case since people move the main view around based on preference, and the empty view would then be independent of that and possibly somewhere else completely.

When dragging the source control view next to the empty view of the explorer/folder, and then open a folder, you end up with this mess:

image

In my mind there is something missing in VS Code's extension metadata that would maybe allow to specify the title for the context menu, or at least include the view container name as well, so that at least it would say "Git Tree Compare: none".

If you agree, I think it's worth filing a feature request for this in VS Code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants