compiler/[msgs, suggest]: improve highlighter accuracy (#10496)
Previously the compiler would generate suggestions based on the symbol identifier length, but that might not reflect the actual representation of it within the actual source code. This commit implements a simple source scanner for the suggest module to address the problem outlined above. Fixes nim-lang/nimsuggest#24
This commit is contained in:
parent
29fbf111a8
commit
2fdf816332
4 changed files with 63 additions and 3 deletions
10
nimsuggest/tests/tsetter_highlight.nim
Normal file
10
nimsuggest/tests/tsetter_highlight.nim
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
proc `a=`(a, b: int) = discard
|
||||
10.a = 1000#[!]#
|
||||
|
||||
discard """
|
||||
$nimsuggest --tester $file
|
||||
>highlight $1
|
||||
highlight;;skProc;;1;;6;;2
|
||||
highlight;;skType;;1;;16;;3
|
||||
highlight;;skProc;;2;;5;;1
|
||||
"""
|
||||
11
nimsuggest/tests/tsi_highlight.nim
Normal file
11
nimsuggest/tests/tsi_highlight.nim
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
proc a: int = 0
|
||||
e_c_h_o#[!]#
|
||||
|
||||
discard """
|
||||
$nimsuggest --tester $file
|
||||
>highlight $1
|
||||
highlight;;skProc;;1;;5;;1
|
||||
highlight;;skType;;1;;8;;3
|
||||
highlight;;skResult;;1;;0;;0
|
||||
highlight;;skProc;;2;;0;;7
|
||||
"""
|
||||
Loading…
Add table
Add a link
Reference in a new issue