Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collection of problems with semantic highlight #132

Open
aMOPel opened this issue Oct 5, 2023 · 0 comments
Open

Collection of problems with semantic highlight #132

aMOPel opened this issue Oct 5, 2023 · 0 comments

Comments

@aMOPel
Copy link

aMOPel commented Oct 5, 2023

First of all, thank you for you work on Nim 🙏

I put every problem in a test case to (hopefully) make it easier.

My Version:

$ nimsuggest --version
Nim Compiler Version 2.0.0 [Linux: amd64]
Compiled at 2023-08-01
Copyright (c) 2006-2023 by Andreas Rumpf

git hash: a488067a4130f029000be4550a0fb1b39e0e9e7c
active boot switches: -d:release -d:danger --gc:markAndSweep

1. Label references

Desired Behavior

block label:
  break label

discard """
$nimsuggest --tester $file
>highlight $1
highlight;;skLabel;;1;;6;;5
highlight;;skLabel;;2;;8;;5
"""

Current Behavior

$ nimsuggest --tester --stdin test.nim
!EOF!
highlight test.nim
highlight       skLabel 1       6       5
highlight       skLabel 2       2       0
!EOF!

2. Module name with / operator

Desired Behavior

import std/strutils

discard """
$nimsuggest --tester $file
>highlight $1
highlight;;skModule;;2;;11;;8
"""

Current Behavior

highlight       skModule        1       10      0

3. Module name references

Desired Behavior

import strutils
discard strutils.spaces 5

discard """
$nimsuggest --tester $file
>highlight $1
highlight;;skModule;;1;;7;;8
highlight;;skModule;;2;;8;;8
highlight;;skFunc;;2;;17;;6
"""

Current Behavior

highlight       skModule        1       7       8
highlight       skFunc  2       17      6

4. Missing skExceptVar to existing skForVar

Desired Behavior

Basically same as skForVar.

try:
  discard
except IndexError as e:
  discard e

discard """
$nimsuggest --tester $file
>highlight $1
highlight;;skType;;3;;7;;10
highlight;;skExceptVar;;4;;10;;1
"""

Current Behavior

highlight       skType  3       7       10
highlight       skLet   4       10      1

5. Type reference that's accent quoted

Desired Behavior

Basically same as skForVar.

type `5` = int

let a:`5` = 5

discard """
$nimsuggest --tester $file
>highlight $1
highlight;;skType;;1;;6;;1
highlight;;skType;;1;;11;;3
highlight;;skType;;1;;11;;3
highlight;;skType;;3;;7;;1
highlight;;skGlobalLet;;3;;4;;1
"""

Current Behavior

highlight       skType  1       6       1
highlight       skType  1       11      3
highlight       skType  1       11      3
highlight       skType  3       6       0
highlight       skGlobalLet     3       4       1

6. static expressions falsly(?) captured as skType

Desired Behavior

Either don't capture at all or as skProc.

discard static(5)

discard """
$nimsuggest --tester $file
>highlight $1
highlight;;skProc;;1;;8;;6
"""

Current Behavior

highlight       skType  1       8       6

7. Proper skGenericParam

Desired Behavior

Either skGenericParam for every T:

type X[T] = seq[T]
proc x[T](a:T) = discard

discard """
$nimsuggest --tester $file
>highlight $1
highlight;;skType;;1;;5;;1
highlight;;skGenericParam;;1;;7;;1
highlight;;skType;;1;;12;;3
highlight;;skGenericParam;;1;;16;;1
highlight;;skProc;;2;;5;;1
highlight;;skGenericParam;;2;;7;;1
highlight;;skGenericParam;;2;;12;;1
"""

Or probably more reasonably only for references of T:

type X[T] = seq[T]
proc x[T](a:T) = discard

discard """
$nimsuggest --tester $file
>highlight $1
highlight;;skType;;1;;5;;1
highlight;;skType;;1;;12;;3
highlight;;skGenericParam;;1;;16;;1
highlight;;skProc;;2;;5;;1
highlight;;skGenericParam;;2;;12;;1
"""

Current Behavior

highlight       skType  1       5       1
highlight       skType  1       12      3
highlight       skType  1       16      1
highlight       skProc  2       5       1
highlight       skGenericParam  2       12      1
highlight       skType  2       7       1

8. Enum field when qualifying

Desired Behavior

type X = enum one
discard one
discard X.one

discard """
$nimsuggest --tester $file
>highlight $1
highlight;;skType;;1;;5;;1
highlight;;skEnumField;;2;;8;;3
highlight;;skType;;3;;8;;1
highlight;;skEnumField;;3;;10;;3
"""

Current Behavior

highlight       skType  1       5       1
highlight       skEnumField     2       8       3
highlight       skType  3       8       1
highlight       skEnumField     3       9       0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant