mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-31 02:12:11 +00:00
* compiler/sem*: better lineinfo for templates
Lineinfo for templates is inconsistant across the compiler, for example:
doAssert true
^ ^
a[int](10)
^^ ^
The `^` marks where the compiler thinks the template starts.
For qualified call, we got the same situation with `proc`s before #10427:
system.once
^
Generics lineinfo within template declaration is also incorrect, for
example, this is where the compiler believes the `T` in `[T]` is:
template a[T](b: T)
^
This PR addresses all of these problems.
* nimsuggest: add tests for template highlighting
21 lines
444 B
Nim
21 lines
444 B
Nim
newSeq[int]()
|
|
system.newSeq[int]()#[!]#
|
|
offsetOf[int]()
|
|
|
|
discard """
|
|
$nimsuggest --tester $file
|
|
>highlight $1
|
|
highlight;;skType;;1;;7;;3
|
|
highlight;;skProc;;1;;0;;6
|
|
highlight;;skProc;;1;;0;;6
|
|
highlight;;skType;;1;;7;;3
|
|
highlight;;skProc;;1;;0;;6
|
|
highlight;;skType;;2;;14;;3
|
|
highlight;;skProc;;2;;7;;6
|
|
highlight;;skProc;;2;;7;;6
|
|
highlight;;skType;;2;;14;;3
|
|
highlight;;skProc;;2;;7;;6
|
|
highlight;;skTemplate;;3;;0;;8
|
|
highlight;;skType;;3;;9;;3
|
|
"""
|