microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.88k stars 29.17k forks source link

Git: Cannot read property 'toString' of undefined #65188

Closed aghArdeshir closed 3 years ago

aghArdeshir commented 5 years ago

Issue Type: Bug

HI! Everything was fine until I added two keyboard shortucts to my Keyboard Shortcuts settings page (Ctrl+k, Ctrl+s)

I added:

and now when I open source control pane, I select a file & do Ctrl + Shift + G , Ctrl + S, I get this error: screenshot 2

I have done this shortcuts with a previous installation of windows 10 + code insiders and am sure it worked until yesterday morning. But I reinstalled my windows 10 yesterday (same version as before) and installed vs-code-insiders again (same version as before), But this time I'm getting this error

I also tried with my add-ons/extensions disabled, still the same error!

P.S. But the Ctrl + Shift + G , Ctrl + A shortcut (Stage All Changes) works perfectly! Strange :)

THANKS!

VS Code version: Code - Insiders 1.31.0-insider (ece3a90fb58986570d8afdfb16530c4dd8c743af, 2018-12-14T06:19:42.976Z) OS version: Windows_NT x64 10.0.17134

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 x 2808)| |GPU Status|2d_canvas: enabled
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: enabled
surface_synchronization: enabled_on
video_decode: enabled
webgl: enabled
webgl2: enabled| |Memory (System)|15.88GB (3.94GB free)| |Process Argv|| |Screen Reader|no| |VM|0%|
Extensions (7) Extension|Author (truncated)|Version ---|---|--- gitlens|eam|9.2.1 tslint|eg2|1.0.41 prettier-vscode|esb|1.7.2 camelcasenavigation|map|0.3.51 vsliveshare|ms-|0.3.1071 vscode-docker|Pet|0.4.0 vscode-icons|rob|8.0.0
joaomoreno commented 5 years ago

Unfortunately there is no support to configure the Stage Change command to a keybinding.

/duplicate #24916

vscodebot[bot] commented 5 years ago

Thanks for creating this issue! We figured it's covering the same as another one we already have. Thus, we closed this one as a duplicate. You can search for existing issues here. See also our issue reporting guidelines.

Happy Coding!

aghArdeshir commented 5 years ago

@joaomoreno Thanks for your reply! But as I mentioned I did it already in a previous installation of Windows & VS-Code (it was just last week) and it worked fine. I did the same thing exactly with Ctrl + Shift + G , Ctrl + S which staged currently selected file! So the only thing I had to do was to navigate among files in SCM pane and press Enter on each one I wanted and do Ctrl + Shift + G , Ctrl + S and that single file was staged. It was great.

And yes! I'm pretty sure

joaomoreno commented 5 years ago

Oh I missed that!

edespong commented 5 years ago

Are you sure that you are not confusing 'Stage Change' with 'Stage Changes'. The latter works as expected for me. I cannot find where the former is used.

fabb commented 4 years ago

I get the same error when I execute the "Git: Revert Change" command (VSCode 1.40, 1.39). It worked on previous VSCode versions too (I'm not sure when it broke exactly). There is no error output in the Git Log.

Screenshot 2019-11-08 at 10 20 28

aghArdeshir commented 4 years ago

@edespong sorry I missed your question.

I don't encounter this issue anymore and don't know how to reproduce it now. I don't remember that it was stage change or stage changes

wolray commented 4 years ago

I get the same error when I execute the "Git: Revert Change" command (VSCode 1.40, 1.39). It worked on previous VSCode versions too (I'm not sure when it broke exactly). There is no error output in the Git Log.

Screenshot 2019-11-08 at 10 20 28

Same on my windows 10 (VSCode 1.40.1, Git 2.21.0.windows.1)

foursixnine commented 4 years ago

I get also the same problem on Linux, insider's edition, any pointers on where to look to try and fix it?

drschwabe commented 4 years ago

Same issue here (Linux). Get the error when pressing "CTL+g" after setting that as hotkey for "Git: Stage changes" . Pressing F1 and then selecting that operation however does work as intended.

I like "CTRL+g" to stage changes it seems intuitive to me.

Though being able to map a hotkey to stage a specific block vs the entire fire would be better; in that case I'd probably map CTRL+shift+g to whole file and CTRL+g to single block.

fabb commented 4 years ago

I get the same error when I execute the "Git: Revert Change" command (VSCode 1.40, 1.39). It worked on previous VSCode versions too (I'm not sure when it broke exactly). There is no error output in the Git Log.

Screenshot 2019-11-08 at 10 20 28

I found out that the "Git: Revert Change" command only works when there is an active selection. In IntelliJ it also works without selection, and just resets the hunk at the current cursor position, which is very helpful. Should I create a separate ticket for this?

davidtranjs commented 3 years ago

Is there any update on this ? I also had this issue when binding shortcut for git.revertChange image