Implement type command (#19944)
* Implement type command - this will be mapped to textDocument/typeDefinition in LSP protocol. It will be very useful for `nim` in particular because typically most of the time the type is inferred. * Update nimsuggest/nimsuggest.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
This commit is contained in:
parent
417b90a7e5
commit
e636c211b0
4 changed files with 47 additions and 3 deletions
32
nimsuggest/tests/tv3_typeDefinition.nim
Normal file
32
nimsuggest/tests/tv3_typeDefinition.nim
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
# tests v3
|
||||
|
||||
type
|
||||
Foo* = ref object of RootObj
|
||||
bar*: string
|
||||
|
||||
proc test(ff: Foo) =
|
||||
echo f#[!]#f.bar
|
||||
|
||||
type
|
||||
Fo#[!]#o2* = ref object of RootObj
|
||||
|
||||
type
|
||||
FooGeneric[T] = ref object of RootObj
|
||||
bar*: T
|
||||
|
||||
let fooGeneric = FooGeneric[string]()
|
||||
echo fo#[!]#oGeneric.bar
|
||||
|
||||
# bad type
|
||||
echo unde#[!]#fined
|
||||
|
||||
discard """
|
||||
$nimsuggest --v3 --tester $file
|
||||
>type $1
|
||||
type skType tv3_typeDefinition.Foo Foo $file 4 2 "" 100
|
||||
>type $2
|
||||
type skType tv3_typeDefinition.Foo2 Foo2 $file 11 2 "" 100
|
||||
>type $3
|
||||
type skType tv3_typeDefinition.FooGeneric FooGeneric $file 14 2 "" 100
|
||||
>type $4
|
||||
"""
|
||||
Loading…
Add table
Add a link
Reference in a new issue