You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A new flag --case or --case-style that can take one of the following values:
snake for lower_underscore_case
camel for camelCase
pascal for PascalCase
lower for lowercasewithnoseparators
A function to convert from any style to the chosen one is ran on all variable/types/functions suggestions nimsuggest makes so that developers can choose their preferred style (which I believe is one of the reasons why Nim is case-insensitive)
Description
Currently, if a library uses a different case style, you have two competing options:
taking advantage of nimsuggest and accepting suggestions that will create an inconsistent code style
typing out the function's name in its entirety while watching the suggestion just above nag you (which can be a bit irritating)
Both have disadvantages. The proposed feature only keeps the best of both worlds.
Alternatives
Not exactly an alternative, but rather an extension of the configuration that I think might be a bit too extreme: specify different types for different things, like how functions are snake_case while classes are PascalCase in some languages. This requirement could be specified by making --case-style accept a space-separated list of <kind>s:<style> pairs, where <kind> is function, variable, constant, etc. and <style> is a case style to be associated with that kind of "object".
The simpler format and this more advanced one could coexist: if no : appears in --case-style, use the simpler format (just one case style), otherwise, use the more extensive one.
Examples
--case-style snake will autocomplete with snake_case'd functions --case-style "constants:pascal functions:lower" will autocomplete with PascalCase'd constant names and lowercased function names
The text was updated successfully, but these errors were encountered:
gwennlbh
changed the title
nimsuggest: Set a case style preference and make all suggestions in that case style
nimsuggest: Set a case style preference
Jan 20, 2021
Is there any advancement on this?
Supporting different case types is something that is really bragged on about Nim, but in reality it is impossible to conveniently code using snake_case as nimsuggest/std lib is totally opiniated to camelCase.
How about not having to configure anything at all but just nimSuggest infering your coding style from your input ?
E.g:
I have a module A with a proc myProc
if I type A. nimsuggest will suggest me A.myProc
if I type A.my_ nimsuggest will suggest A.my_proc
A more advanced flavor would be for nimsuggest to look backward and check wether I used snake_case for other identifiers and suggest straight away A.my_proc while still suggesting A.myProc if I type A.myP
Seems simple enough, I'm pretty new to Nim though maybe there is something I'm overlooking.
I would be interested to contribute.
Summary
A new flag
--case
or--case-style
that can take one of the following values:snake
for lower_underscore_casecamel
for camelCasepascal
for PascalCaselower
for lowercasewithnoseparatorsA function to convert from any style to the chosen one is ran on all variable/types/functions suggestions nimsuggest makes so that developers can choose their preferred style (which I believe is one of the reasons why Nim is case-insensitive)
Description
Currently, if a library uses a different case style, you have two competing options:
Both have disadvantages. The proposed feature only keeps the best of both worlds.
Alternatives
Not exactly an alternative, but rather an extension of the configuration that I think might be a bit too extreme: specify different types for different things, like how functions are snake_case while classes are PascalCase in some languages. This requirement could be specified by making
--case-style
accept a space-separated list of<kind>s:<style>
pairs, where<kind>
isfunction
,variable
,constant
, etc. and<style>
is a case style to be associated with that kind of "object".The simpler format and this more advanced one could coexist: if no
:
appears in--case-style
, use the simpler format (just one case style), otherwise, use the more extensive one.Examples
--case-style snake
will autocomplete with snake_case'd functions--case-style "constants:pascal functions:lower"
will autocomplete with PascalCase'd constant names and lowercased function namesThe text was updated successfully, but these errors were encountered: