How do I restore the stashes menu in Visual Studio Codes Source Control panel? - visual-studio-code

I can't find the Stashes (nor REMOTES, BRANCHES, FILE HISTORY) menu in the Source Control (the one you open up with Ctrl-Shift-U) tool bar.
This is how my Visual Studio Code looks like:
And this is a picture I found on the web with the menu options I'd like to restore:
I couldn't find an option to restore these menu options.
it seems like somehow GitLens, instead of replacing the Source Control panel, add his own:

You need to install (or enable if you have it disabled) the GitLens extension. That is what adds those sub-sections seen in your second screenshot.
Alternatively, if you click the ellipsis that is to the right of each of your repositories, you should see a "Stash" menu item that should also meet most of your needs.
Note that the GitLens extension is apart of the Git Extension Pack extension, which contains a few other extensions as well (including Git History, which you appear to have already).

Just for reference, in case anybody else stumbles upon this issue.
I created this issue at GitLens github repo and the solution was to right click on the original 'Source Control' icon and select the option "Reset location"
It seems it's not the first time that something like this happened.

Related

How do I stop VSCode from revealing a file in the sidebar as soon as I click on it in "Source Control => Changes"

When I have a multiple file with changes in VSCode I often want to go trough the changes without staging.
I cannot do this because as soon as I click on one file with changes in "Source Control => Changes" the file is revealed in the sidebar and I have to navigate back to "Source Control" to review the changes of another file. In the past this wasn't the case. In order to open the file regularly (without diff) I could manually go to the Explorer and the file was selected.
When files are staged I can click on them and they will not be revealed in the sidebar. This behavior is what I would also like to have for files that are not staged.
What is causing this behavior (I use VSCode v1.74.2)? In the past this wasn't the case.
Update: This behavior is caused by an extension I need (Sigasi). They made an update and for some reason this caused the described unwanted behavior.
Hello from the Sigasi support department. ;)
The Sigasi extension for VS Code comes with a dedicated Project View to bring some useful Eclipse File System features to our VS Code extension.
One of the features this Project View offers, is to link the Project View with the editor in focus. This allows to quickly spot where you are in the project file hierarchy.
This feature can easily be disabled by going to the Project View and clicking the icon that controls the link with the editor. I'm linking a screenshot showing the link with editor setting.
It seems this feature at the moment is more intrusive than intended. We plan to adjust this feature so that it isn't active if the Project View is not visible or collapsed.

What is that component on the top-right of VS Code called? How can I change the setting of it?

I'm using VS Code on Mac and I was curious about one component.
Every time I open a new python file, this component will show up on the top right of the current window? But I can't find the name of it.
That's not just "one component", but actually multiple buttons added to the editor actions toolbar from multiple extensions installed on your VS Code.
In order from left to right:
Open Changes (built-in with VS Code as part of their Version Control functions)
Run Python File in Terminal (added by Microsoft's own Python extension)
Open Changes in previous revision (added by the GitLens extension)
Show Revision Details (added by the GitLens extension)
Open Changes in next revision (added by the GitLens extension)
Toggle File Blame Annotations (added by the GitLens extension)
Split Editor (built-in with VS Code)
For GitLens, they are automatically added when it detects the currently opened file is part of a git repository. You can configure them by accessing the command palette (CMD+Shift+P on a Mac), then entering "GitLens: Open Settings". Find the "Menus & Toolbars" section:
For example, if you want to remove buttons 3., 4., and 5., uncheck "Add commands to the editor group toolbar" > "Add comparison commands". Then reload VS Code. You can configure all the other settings there.
For the green Play button, it automatically appears when you the currently active file is a Python file. AFAIK, there is no way to configure or hide/remove it other than disabling the Python extension completely (which you certainly don't want to do). There are requests on VS Code's Github page to hide it, like this: Add setting to disable icon for "Run Python File In Terminal".
For the "Open Changes" and "Split Editor" buttons, AFAIK there is no built-in way to hide/remove them. You can only control the behavior from the VS Code settings:
As mentioned in the comments, there is a feature request for VS Code to Allow hiding the buttons in the tab bar line and in the panel title bar, which includes the "Open Changes" and "Split Editor" buttons. There are users who provided workarounds at hiding the buttons using extensions. You may want to follow that thread and/or try out some of those extensions.

VSCode: How to turn off auto select in File Explorer when changing window tabs?

In VSCode, if I have an editor window tab open and I click anywhere in that editor window, the selected file in the File Explorer changes to the file being edited. I would like to prevent that behavior. This is possible in Visual Studio, but I can't seem to find a similar setting in the preferences file of VSCode.
Can anyone provide some suggestions?
This has been added, see https://github.com/Microsoft/vscode/issues/14745.
Configuration is "explorer.autoReveal": false
You can't, at least not today. The only thing you can do, is keeping the scroll position when switching tabs. See this answer for the setting: VSCode prevent file Explorer from jumping
And here is the feature request on Github: https://github.com/Microsoft/vscode/issues/14745
(Feel free to add a "Thumbs Up" via Github Reaction at the top so the request gets more attention in the future, this increases the chances that it gets implemented sooner)

Highlighting modified lines in Eclipse

In netbeans, if I open a file which is under version control the lines which are modified are highlighted in the left. (green for new lines and blue for modified lines)
Is it possible to get a similar effect in Eclipse?
Open the Preferences window
Search for "diff"
Select Quick Diff
Change the "Use this reference source" to a SCM provider (like CVS, SVN or Git)
By default, it compares to the latest version on disk, which, if you've saved the file, is no diff at all. You have to activate the comparison against a SCM repo. I'm not sure what happens if you more than one type of SCM since this is only a single selection.
With Subversive, you can do Team > Show Annotations, and it will annotate the lines with the author and date of the last modification of that line.
Right-click on the file > Team > Show annotation.
A brown tape will appear on the left-side of the code (it represents commited lines), and the modified lines will be shown in white.
In Eclipse by using its Quick Diff feature. This is easy to do:
Go to Window -> Preferences -> General -> Editors -> Text Editors ->
Quick Diff. This is the dialog from where it can be configured.
Turn on Quick Diff, by enabling the option Enable quick diff.
Choose the version control system for which Quick Diff is needed
from the dropdown Use this reference source. Git, SVN and CVS should
be present here. Mercurial appears if the MercurialEclipse plugin is
installed.
The overview ruler is the ruler to the right of the scrollbar in the
editor. If you would like to see the uncommitted lines to be marked
on it, enable the option Show differences in overview ruler.
Choose Apply and OK. Close all editor windows and reopen the source
file that you want in the editor.
You should be able to see the newly added, modified or deleted lines marked in colors in the left bar on which line numbers are usually displayed. The colors used are the ones set in the Quick Diff dialog (see above steps). You can also view these uncommitted locations marked along the overview ruler on the right.
For Eclipse Version: 2019-03 (4.11.0) Go to
Select 'window'
Select 'Preferences'
Go to General -> Editors -> Text Editors -> Quick Diff
Tick 'Enable quick diff'
Tick 'Show differences in overview ruler'
If you want to keep the changes after you save your local copy, then you need to tell the eclipse to compare the local copy with the repository version. To do that change the reference source accordingly.
EGit plugin's Quick Diff does exactly the same as netbans modified lines feature.
http://wiki.eclipse.org/EGit/User_Guide/State
There are at least two things you must do to get revision-based change highlighting (i.e., ones that do not disappear when the file is saved) to show up in Eclipse's "overview ruler" when using Git:
Prior to import, make sure that Preferences > Team > Git > Projects > Automatically Share project that are located inside Git repositories is checked or import the project into your workspace using Import... > Git > Projects from Git (as pointed out by #cornelius in a comment on another answer)
Enable Quick Diff and select "A Git Revision" as the reference source: Preferences > Editors > Text Editors > Quick Diff
In eclipse too you will get the line highlighted which is changed util you save the file.
and highlight is nothing but the change in color at the left panel of the editor before the start of that changed line.

Subclipse - marking code changes like in NetBeans

I moved recently from NetBeans to Eclipse. Since I have to work with the project checked out from SVN I installed Eclipse. My question is: how to make Subclipse indicated the changes that I introduce in the source code (downloaded from SVN) just like NetBeans? Is there any way?
In Window -> Preferences navigate to General -> Editors -> Text Editors -> Quick Diff and tick "Enable quick diff", "Show differences in overview ruler" and set "Use this reference source" to "Pristine SVN Copy".
You might also want to change the colors to match NetBeans (blue for Changes, green for Additions, red for Deletions).
Note that you'll probably need to restart Eclipse for this to take effect.
As you go on changing the code it will show your changes on the side ruler until you commit to SVN.
If you are referring to the Viewing Changes in the Source Editor section of subversion in Netbeans:
alt text http://netbeans.org/images_www/articles/60/ide/vcs/left-ui.png
Then it should be like activating the Quick diff Annotate in Subclipse:
Team -> Show Annotations option on a file
Subclipse automatically keeps track the changes that you do in Eclipse.
If you would like to see the changes, the convention in Eclipse is to go to Team -> Synchronize menu on the project.
If you want to quickly compare changes from a single file, right click on it select 'Compare With' -> 'Latest from Repository'. The resulting diff would look much like the one in Binary Nerd's first screenshot, only it will appear in Editor section and you won't have to switch perspectives.
Doesn't subclipse mark the classes and packages in the Package Explorer as being different to the version checked-in to SVN?
EDIT
You can use the compare function to see the differences. One way to do this is to open the synchronize view, right click on the desired class and choose compare (i can't remember the exact menu option, but it's something like that).
(source: tigris.org)