Open rioj7 opened 11 months ago
@arathburgos05
Have you looked at the property showDirs
, it will show for now the full directories but that will be fixable when #73 is implemented.
In your example you show a double testType1/LOG
.
You ask to show a directory but then you are unable to pick the right file if you want that.
If you show a directory with showDirs
you get a directory returned on selection, with #73 implemented you can show whatever you want.
@rioj7
Thanks for your quick reply. I was using:
{
"id": "pluginRepoTestSelection",
"type": "command",
"command": "extension.commandvariable.file.pickFile",
"args": {
"description": "[Plugin] Select one test inside the plugin",
"include": "test/otherFolder/**/specifFileInsideEachTest.ext",
"showDirs": false,
"transform": {
"text": "${fileDirname}",
"find": "\\\\",
"replace": "/",
"flags": "g"
}
}
},
With your suggestion now I can simplify my code to:
{
"id": "pluginRepoTestSelection",
"type": "command",
"command": "extension.commandvariable.file.pickFile",
"args": {
"description": "[Plugin] Select one test inside the plugin",
"include": "test/otherFolder/**/specifFileInsideEachTest.ext",
"showDirs": true
}
},
This is not the same example that I shared in this Issue but it's similar. Also I would like to know if there is any way to rename the description of the label. For example: (let's to consider that after "|" it's a gray color or description for the dropdown)
Using a simple plain text like:
Avoiding usage of "${ws:}" which I would think that it's an error trying to interpolate the variable to the print.
Regards.
@arathburgos05
"showDirs": false
is the default so why add it as a property
if you use "showDirs": true
you don't get testType1/LOG/testName1/src/test.c
as a label (it should not be)
when #73 is implemented you can transform label
, description
(grey part) and value
(string returned)
you have to use the variable ${workspaceFolderBasename}
in the descriptionTransform
text
property to get your simple plain text.
I choose to show ${ws:my_test11}
to be different from a possible (relative) file path that is common at that position in QuickPick lists and View Trees. The label is a relative directory in the named workspace.
I did not use a possible legal variable name because it is a long text and it would suggest that it did not resolve the variable.
A possible workaround to display empty folders is to add a dummy file in the empty folder like __dummy__.c
and add a file pattern like **/__dummy__.c
to .gitignore
I will try to find a way to list empty folders without a workaround.
@rioj7 Yes, I agree with your understanding about #73. I think that this implementation will solve two main issues:
I know that we already have commandvariable.file.pickFile.labelMaximumLength
and commandvariable.file.pickFile.labelClipPoint
which can be continue being a complement to large strings. However, with #73 implementation user will be able to formulate shorter strings in dropdown.
Yes, that could be a workaround. I know that VSCode API doesn't include a findFolders
function. Another workaround could be to use asRelativePath
sending the "absolute path" if the path exist it will return the relative path, if not, it will return the same input (absolute path) maybe with these conditions we can validate the existence of a empty folder (or path).
Unfortunately it won't be possible to use glob patterns. But at least it would be possible to search for specific patterns. For instance: "{folder1/folder2,folder1/folder3,folder1/folder5}"
.
I know that his is not very useful, I'll continue checking on the documentation. If I find something useful I'll share it.
Thanks for the support.
@arathburgos05 maybe v1.61.0 can be used to select empty folders.
I have added the commands:
@rioj7 Thanks for the update. It is very useful :) Regards.
Taken as separate question from #73
See for example workspace structure #73
❓ Question 2
Considering the same previous case, I would like to know if there is any way to list only folders not looking for a file. For instance, if I would like to know what are the parent folders of LOG folders, something like...
*/LOG
I would expect to see:
This is just a dummy case, I have other uses in mind. I tried with include and find but it didn't work. The problem looking for a file is that this won't work if folder is empty. For the moment I have my workspace using file search and transform feature, but this could fail when folder is empty.