vscode-nim icon indicating copy to clipboard operation
vscode-nim copied to clipboard

Getting list of all possible values for an enum

Open tobimensch opened this issue 5 years ago • 3 comments
trafficstars

Hello,

thanks for your extension.

I tried to get a list of all the values an enum can have, but this doesn't seem to be implemented.

Thanks in advance to whoever makes this work, it'd be very useful in my opinion.

tobimensch avatar May 18 '20 18:05 tobimensch

what do you mean, by all the value it can take on?

just go to the enums definition (right click go to definition or ctrl+click), and you'll find the values which belong to the enum.

RSDuck avatar May 18 '20 18:05 RSDuck

@RSDuck Of course one can go to its definition, but why should one have to? You could also tell me to go to a module's source file to know all the procs it provides, yet we have autocompletion, which shows as all the procedures that work for a given type. So why can't autocompletion do the same for an enum instead of forcing me to leave the current source file I'm working on? I want to type enumName.(here a list of all the value-names this enum has should appear), to see what choices I have, I think this would be more intuitive, instead of being forced to leave the current source code I'm working on because I have to something up.

tobimensch avatar May 19 '20 13:05 tobimensch

  1. the completion is provided by nimsuggest not by the plugin
  2. what you're describing enumName. is not really idomatic Nim code. Enums should only be explicitely qualified in cases where it's necessary. Typically you give your enums a common prefix (example: https://nim-lang.org/docs/macros.html#NimNodeKind).

RSDuck avatar May 19 '20 13:05 RSDuck