-
Notifications
You must be signed in to change notification settings - Fork 38
[To be discussed]Casing conversion #82
base: master
Are you sure you want to change the base?
Conversation
I guess this functionality should be provided by nimsuggest, because in IDE there are lot of place where will require support case conversion, @Araq what is your opinion? |
@kosz78 If nimsuggest supports it, how would the VSCode plugin offer this feature to the users? |
This should be a separate plugin IMO |
this would be rather hard, I don't really know if there is even a way to intercept the suggestion provider of another extension. |
I was about to implement this, so (a) glad I checked the open PR's first, and (b) I got this fork working with current code-base, and it's just what I wanted. I think it doesn't need to have so much fidelity in the options: for me, one global option for which style to use, would be perfectly fine. Possibly 2: one for when the token starts with lower case, and one for when it starts with upper. Expanded features which could be added:
|
I think with NEP, styleCheck:on and nimpretty we got to the point where this original idea of everybody uses the casing she/he prefers is obsolete. The case invariancy of Nim is still useful for C wrappers with cumbersome names and for cases like forEach and foreach which nobody can remember (even with nimsuggest 😄), but that's about it. |
Thinking about it, what I'd actually want is:
Then I can adhere to the w/e standard while still working with preferred legibility. So, this idea/PR is dead? |
proper renaming would be a prequisite for casing conversion. Nim suggest doesn't provide functionality for that, though it can list all occurences of an identifier. I did some experiments a few years ago but it turned out to be unreliable. |
As stated here it was originally envisioned that Nim users can configure there IDE so that it shows them identifiers in the way they like(Pascal/Camel, Snake case, …).
Yesterday I made this rough POC, which more or less works. E.g. if I prefer Snake-casing for function names, I could tweak


nim.typeCasing
tosnake
. vscode-nim will automatically suggest procs, templates, macros and iterators in snake case.The implementation is still a bit rough, e.g. if you hover a call, the types in the proc signature aren't converted.
Some questions which arrive are: