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
Issues with type annotations when type includes a method, which includes a string #133
Comments
I am assuming this issue also occurs while the language server is starting/disabled? In that case, it's probably an issue with the grammar. |
Hi, Sorry, yes this is an issue with the grammar, not with the language server. In particular:
The problem is that it does not like it if we include a > or ) in the grammar since that essentially ends where it thinks the type-parameters goes up to. I'm currently playing with the grammar a bit to see if I can find a simple solution to match more generously - but the challenge is trying to find something that should trigger the end of a type annotation. |
Sure no problem, since this repo hosts the canonical version of the grammar, opening the issue here is totally fine! There's even a tiny VSCode extension for tinkering with the grammar here. |
I have created a PR for a small patch which slightly improves things by not including parameters if there is a quote. This won't help with the issue fully though, as I think we can also confuse it by introducing parenthesis around numbers. I think the best solution is likely to involve updating type-annotation to use begin and end - but I am not sure how best to support both generics and parameters in that way. |
@a-stewart , did your PR solve the issue completely? Or are there still something missing? Just asking in case we can close this 🙂 |
The PR doesn't solve the issue completely - I think that type annotations which include a string will not be tokenised correctly. |
Consider the following code:
The type annotations include a callable type which can have string arguments which fail - but then if the string contains either
>
or)
that ends the type annotation early, resulting in the closing string tag being mistakenly recognized as opening a string.Note that, I expect that it is not just strings that are not considered here, but other primitives too. I am not familiar with Kotlin though to be fully certain on what is allowed in the language here though.
The text was updated successfully, but these errors were encountered: