vscode-perforce icon indicating copy to clipboard operation
vscode-perforce copied to clipboard

Gray out ignored files. Mark unknown local files not tracked by source control.

Open KBrand101 opened this issue 1 year ago • 2 comments

Is your feature request related to a problem? Please describe. I am never really sure, if a file is included, excluded or just present in a workspace.

Describe the solution you'd like In the Explorer tab, similar to the default git integration, I would like to see the explicitly ignored files (specified in .p4ignore) to be grayed out. Also I would like to have some form of highlighting for files that are present in the workspace, but are not tracked or ignored. Maybe "Unknown" or something along those lines. This should prevent forgetting to mark files for Add.

Describe alternatives you've considered Checking manually with p4 or p4v. But this is cumbersome for larger projects.

Additional context -/-

KBrand101 avatar Sep 11 '24 12:09 KBrand101

Hi, thanks for the suggestion.

I believe this should be possible but may not be super simple.

We can adjust the file colour in the explorer using the DecorationProvider - since we already do this for files that are open in the workspace. The difficult part would be working out for each file whether it should have a colour applied, in a way that performs well in very large workspaces. This is trivial for currently open files because we already maintain a specific list of files that are open. But for files that are ignored or not tracked we don't have a specific list. Ideally we probably don't want to send off lots of commands to check whether a specific file is ignored/tracked or not (e.g. p4 reconcile). Would need some more investigation.

mjcrouch avatar Sep 11 '24 15:09 mjcrouch

First of all: Thanks for considering my request. Here are some ideas that might achieve what I was looking for.

I think the "unknown" feature could be realized by using p4 reconcile -n as you suggested. At least for me, this seems to give a precise list of the files I am looking for. This list also seems to be somewhat static/reliable and is already implemented in default tooling, so should probably perform reasonably well I think.

The "ignored" feature seems to be more complicated indeed. One idea is to use p4 reconcile -nI and the subtract p4 reconcile -n. Then use that list. Another arguably more resource intensive solution might be to run p4 ignores and try to find files matching those patterns. This would probably be the cleanest solution, as it actually uses the builtin ignore functionality in the most direct way and presents you with a list of all different cases/patterns that might exists. This could then be checked against the files in the explorer tab and only updated e.g. on restart of the ide, reload of the window or extension, if a folder gets expanded or collapsed or possibly on other file actions such as edit, save, new file, etc.

KBrand101 avatar Sep 12 '24 08:09 KBrand101