-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Hi MdAlbinHossain,
I know you have released this extension for quite a long time but I just recently discovered your Run++ extension, and it has been a lifesaver for my competitive programming workflow. Thank you for creating such a helpful tool!
However, I noticed that the extension currently only supports the ${workspaceFolder} variable, which can be limiting when working with nested folder structures and varied file names. This makes it challenging to configure input and output file paths dynamically, especially for projects with multiple subfolders.
My Use Case
To give you a better idea, here’s an example of my project structure:
- HocCpp (main workspace folder)
- MathProblem (first-level subfolder)
- Addiv (second-level subfolder)
Addiv.cpp(same name as the second-level subfolder)Addiv.INP(input file)Addiv.OUT(output file)
- Addiv (second-level subfolder)
- RealWorld (first-level subfolder)
- QUALIFY (second-level subfolder)
QUALIFY.cppQUALIFY.INPQUALIFY.OUT
- QUALIFY (second-level subfolder)
- MathProblem (first-level subfolder)
In this structure, my .cpp, .INP, and .OUT files are located in deeply nested subfolders, and their names match the second-level subfolder (e.g., Addiv.cpp, QUALIFY.cpp). With only ${workspaceFolder} available, I have to hardcode paths like ${workspaceFolder}/RealWorld/QUALIFY/QUALIFY.INP, which isn’t scalable when working on multiple problems across different subfolders.
Suggestion
To make the extension more flexible and user-friendly, I suggest adding support for additional VS Code variables that are commonly used in task configurations. These variables would allow users to dynamically reference file paths and names, making the extension more versatile for competitive programming and other workflows with complex folder structures.
Here are the variables I recommend adding:
${fileDirname}: Resolves to the directory of the currently active file. For example, if I’m working onHocCpp/RealWorld/QUALIFY/QUALIFY.cpp, this would resolve toHocCpp/RealWorld/QUALIFY/. This is particularly useful for locating.INPand.OUTfiles in the same directory as the.cppfile.${fileBasenameNoExtension}: Resolves to the name of the current file without its extension. ForQUALIFY.cpp, this would resolve toQUALIFY. This is essential for matching input/output files (e.g.,QUALIFY.INP,QUALIFY.OUT) to the source file name.${file}: Resolves to the full path of the current file (e.g.,HocCpp/RealWorld/QUALIFY/QUALIFY.cpp). This can be helpful for custom commands that need the exact file path.${relativeFileDirname}: Resolves to the relative path of the file’s directory from the workspace folder (e.g.,RealWorld/QUALIFY). This could be useful for constructing paths relative to the workspace root.
Example Configuration with Suggested Variables
With these variables, I could configure the Run++ settings like this:
- Run: Input File:
${fileDirname}/${fileBasenameNoExtension}.INP- Resolves to
HocCpp/RealWorld/QUALIFY/QUALIFY.INPforQUALIFY.cpp.
- Resolves to
- Run: Output File:
${fileDirname}/${fileBasenameNoExtension}.OUT- Resolves to
HocCpp/RealWorld/QUALIFY/QUALIFY.OUT.
- Resolves to
- Run: Command:
${fileDirname}/${fileBasenameNoExtension} < ${fileDirname}/${fileBasenameNoExtension}.INP > ${fileDirname}/${fileBasenameNoExtension}.OUT- Dynamically runs the compiled program with the correct input/output redirection.
This setup would work seamlessly across all my subfolders without needing to hardcode paths for each problem.
Thank you
I am not sure if you would read this, but you should know that your work is incredible and it helps other people out there like me :)