agrawal-d/cph

problem file name: both short & full

goyalyashpal opened this issue · 5 comments

hi!

problem solution

  • thanks a lot for this wonderful extension.
  • cph.general.useShortCodeForcesName does "instead of" i.e. either 144C or C_Anagram_Search
  • would it be possible to use both the short and full name? so like: 144C_Anagram_Search

cph.general.useShortCodeForcesName
Use a short ID for problem file generated ( like 144C ) instead of the complete problem name for codeforces problems

implementation details

it can be implemented in 2 ways:

  1. (preferred imo) changing the option cph.general.useShortCodeForcesName to be multivalued instead of boolean
    so, smth like: cph.generatl.fileName: short, full, both, custom

  2. (bad UX imo:) giving different boolean options for each field (shortcode, fullname) and picking some default (like fullname) when all (both for now) are disabled. the format will be: short_full

environment & versions

$ codium --list-extensions --show-versions | grep agrawal
divyanshuagrawal.competitive-programming-helper@6.1.0

$ codium -v
1.89.1
a045dcfceda27f896936bfd8cbf524f6a93a2f46
x64

$ systeminfo | grep -Ei "^os (n|v)|system type"
OS Name:                   Microsoft Windows 10 Home Single Language
OS Version:                10.0.19045 N/A Build 19045
System Type:               x64-based PC

Extension Version: see above
VS Code Version: see above
Operating System: see above

Browser Version: Vivaldi 6.7.3329.31 (Stable channel) (64-bit)
Chrome/124.0.0.0

previous issues in this lineage:

I wanted this feature as well and created a fork and added the feature myself. You can check it out here : https://github.com/hitarth-gg/cph-personal-edition
It does not add "underscores" but rather adds whitespaces in between, resulting in a file name like this : 144C - Anagram Search.cpp.

but rather adds whitespaces in between

hi! thanks a lot for making the fork.

but whitespaces are super bad - they complicate the CLI use and require needless escapes, it's the naive & dumbed down windows os environment which doesnt expose the users to how bad whitespace is in filenames.

and whitespace wont work for java files either, as java files require the name to match the classname i.e. follow the rules of identifiers.

but rather adds whitespaces in between

hi! thanks a lot for making the fork.

but whitespaces are super bad - they complicate the CLI use and require needless escapes, it's the naive & dumbed down windows os environment which doesnt expose the users to how bad whitespace is in filenames.

and whitespace wont work for java files either, as java files require the name to match the classname i.e. follow the rules of identifiers.

I agree with that, that is why I've added a warning in the repo's readme about the whitespaces. I only made this for myself since I rarely have issues with whitespaces on my machine and I don't use CLI that much.
You can change the logic in companion.ts file and replace the whitespace with an underscore at line 155 : const secondPart = words?.join(' ');.

I don't use CLI that much

i would guess that u tried using cmd or powershell shells.

try using bash from msys2 on windows, u will love it.

my affection for cli can be apparent in the issue descriptioy itself, where even the version info is shared via bash lol 😂