ktnrg45 / vs-code-cython

VS Code Language Extension for Cython
MIT License
42 stars 3 forks source link

Two conditions before colons leads to incorrect syntax error highlight #20

Open jrenaud90 opened 11 months ago

jrenaud90 commented 11 months ago

With cython 3.0.0+ we can write a function that is compiled with two different conditions:

cdef double square(double x) noexcept nogil:
    return x * x

In this particular case, we are telling cython that square can be compiled with out the gil and to ignore exceptions that are raised in its body. However, the cython extension for VS code marks this as a syntax error:

image

The use of "noexcept nogil" is quickly becoming popular for functions that need the most performance and are unlikely to encounter problems with disabling those features (see, for example, some of the functions here used for scipy). So it would be nice if the syntax checker took this feature into account.

Thank you for your work on this, it is a very useful extension!