mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-13 23:03:36 +00:00
Register declaration of enum field has a use (#22990)
Currently when using `use` with nimsuggest on an enum field, it doesn't
return the definition of the field.
Breaks renaming in IDEs since it will replace all the usages, but not
the declaration
(cherry picked from commit c31bbb07fb)
This commit is contained in:
@@ -141,6 +141,7 @@ proc semEnum(c: PContext, n: PNode, prev: PType): PType =
|
||||
result.n.add symNode
|
||||
styleCheckDef(c, e)
|
||||
onDef(e.info, e)
|
||||
suggestSym(c.graph, e.info, e, c.graph.usageSym)
|
||||
if sfGenSym notin e.flags:
|
||||
if not isPure:
|
||||
addInterfaceOverloadableSymAt(c, c.currentScope, e)
|
||||
|
||||
15
nimsuggest/tests/tuse_enum.nim
Normal file
15
nimsuggest/tests/tuse_enum.nim
Normal file
@@ -0,0 +1,15 @@
|
||||
discard """
|
||||
$nimsuggest --tester $file
|
||||
>use $1
|
||||
def;;skEnumField;;tuse_enum.Colour.Red;;Colour;;$file;;10;;4;;"";;100
|
||||
use;;skEnumField;;tuse_enum.Colour.Red;;Colour;;$file;;14;;8;;"";;100
|
||||
"""
|
||||
|
||||
type
|
||||
Colour = enum
|
||||
Red
|
||||
Green
|
||||
Blue
|
||||
|
||||
discard #[!]#Red
|
||||
|
||||
Reference in New Issue
Block a user