Is there any plugin like gitlens for perforce? - visual-studio-code

GITLENS is pretty cool plugin I found for Visual Studio Code which give all the information about who and when the changes were made in the file. Is there any similar plugin to GITLENS for Perforce ?
The plugin could be for any other IDE as well.

The extension Perforce for VS Code has annotations that can show which changes were made and which user made them.
You can enable annotations for every file by setting the configuration perforce.annotate.enable to true.
perforce.annotate.changelist and perforce.annotate.user can be set to true to output changelist numbers for each line and the user who modified the line respectively.

If you are using a new extension Perforce for VS Code, You can use the command perforce.annotate
By default, it comes with a keybinding alt+p n (it works only when editor text is in focus). You can also search for Perforce: Annotate in Command Palette.

Related

How to change the diff tool used by VSCode for git?

I would like to use the difftastic diff tool, which ignores whitespace changes in code (amongst other useful functionalities), and I have set my .gitconfig to use difft (the binary file of difftastic) as my preferred external diff tool using this command:
git config --global diff.external difft
And, my .gitconfig has these lines in it:
[diff]
external = difft
However, the VSCode text editor still shows whitespace diffs. I have searched for a way to change the diff tool in VSCode to no avail, the only results are "How to set VSCode as the default merge/diff tool for git".
To clarify, I would like to change the diff tool used by the vscode text editor section as well as the diff viewer. I do not want to change the tool used by the commandline git command itself. In the image I've linked, it shows changes for whitespace, which should not be happening if difft is set as the diff tool.
You can change the tool Git uses to "diff" two files: https://git-scm.com/docs/git-difftool (this is Git functionality - it has nothing directly to do with VSCode).
You can substitute a custom editor for the built-in the Visual Studio code editor: https://code.visualstudio.com/api/extension-guides/custom-editors.
You can add a custom "diff" plugin to Visual Studio, for example, "Partial Diff": https://marketplace.visualstudio.com/items?itemName=ryu1kn.partial-diff.
What you CANNOT do is swap in a custom app to change the "diff" functionality of the default VSCode editor.
Visual Studio Code does not use an external utility to compute the diff. The necessary algorithms are directly implemented in VS Code and you don't have any control over them.
Using an arbitrary external utility would most likely not result in a good user experience either. If VS Code cannot understand the generated diff, it would not be able to display the output with the diff editor and you would lose features like syntax highlighting.
However, I may have an alternative solution to your original problem (using difftastic in VS Code). I am currently working on my own extension that adds a semantic diff mode to VS Code. It supports fewer languages than difftastic, but has additional features like moved code detection:
If that is what you are looking for, you can find the extension (SemanticDiff) in the Visual Studio Code Marketplace.

Recent Locations in vscode (Like in IntelliJ)

I like the feature Recent Locations of IntelliJ.
For other reasons I will use vscode (for golang).
Is there a similar feature in vscode?
I want to see a list of the my recent locations (optional filtered, so that only the locaions are visible, which where recently changed).
After a break (like lunch), this feature is really handy. It helps you to connect to your work before the break.
Especially the "show changed only" is very helpful.
If you use git, you get most of what you request here. Vscode has a git extension in the sidebar that shows you what files you have changed, as in unstaged and staged changes.
You can also jump between location, with alt+left/right arrow. This is independent from git. It just remembers your last cursor positions.
If you are willing to use an extension, there is one that seems to do what you are asking for, judging by its name: https://marketplace.visualstudio.com/items?itemName=percygrunwald.vscode-intellij-recent-files
#guettli They are different editors, so it will be hard to always find the exact same feature. I think there is nothing like recent locations in vsCode, at least when i'm writing this. Will there be something like that in the future? Probably.
Ctrl-P will display a list of recently opened files, and by selecting one of the files it will go to the last location when editing the file. To see the changes in a file(w/ git) you can right-click it and select the "view timeline" or view the changes with the git button. Not exactly what you asked for but may be useful.
This function is called "navigate Back", you find it also in the Key Bindings for Visual Studio Code and more accessible within vscode from the keybindings UI.
Ctrl+P will display a list of recently opened files in Vscode
You can use Timeline option at the right-bottom corner of the vscode for comparing previous file and current changes of the file that is in currently opened
You can even compare the files with options on right clicking the file
You can get more about code navigations in this video https://www.youtube.com/watch?v=MuQmMsIpI04

Is there any way to highlight a file in the Visual Studio Code explorer?

As a reminder, I would like to be able to highlight a file (in Explorer) that I have made important changes to. Highlighting it would make it easy to find again!
Visual Studio Code still doesn't provide such a feature. If you have source control, it will allow you to track modified files unless it is not available yet.

Fuzzy file opening in vscode

I am exploring vscode after using atom for a long while. One of the things I'm missing is an equivalent of the lovely package advanced-open-file. Is there something similar to this in vscode?
I found the advanced-new-file extension, but it is only helpful when it comes to new files. I would like to be able to quickly open files from all over my local files (not only the workspace).
Edit: I found the option of workbench.action.quickOpen; but it doesn't allow opening files from the whole file system.
Sorry, but currently the answer is no. The problem is that input box doesn't provide a way to listen to key events:
GitHub issue,
so even the extensions can't do that currently. Here's the comment from advanced-new-file extension creator:
Because VSCode extensions don't yet have the ability to do type-ahead autocomplete within the text input box (See https://github.com/Microsoft/vscode/issues/426), we work around this limitation and provide autocomplete using a two-step workflow of selecting existing path, then providing new filename/path relative to the selection.
The good news is that there is a new API addressing this issue, but it's currently in 'proposed' state and can't be used for published extensions.
One workaround could be typing code -r some/path in integrated terminal and using 'tab' for autocomplete.
The Fuzzy search extension seems to work for me.
It adds a new action to the command palette which allows you to search for files in the current project and open them.

Visual studio code extension: How can I add error markers to files in the explorer?

I have written a validator for my vscode extension, which uses a DiagnosticCollection to set errors for files. This works and the errors are shown when a file is opened.
I would now like to mark files in the explorer, so that it is easy to find files with errors. Here is an example]of how it looks in Eclipse:
Is it possible to do this in a vscode extension? Is there already an extension doing this?
Unfortunately, you can't do that.
There is an open issue asking something related to Git, but not as open as you want. Maybe using the API described in this another issue you could create a new panel with the marked files.
It is still experimental, BTW...