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

fallback grammar labels operator lexeme precedence groups as invalid syntax #366

Closed
tayloraswift opened this issue Jul 19, 2022 · 9 comments
Labels
bug Something isn't working

Comments

@tayloraswift
Copy link
Member

tayloraswift commented Jul 19, 2022

Describe the bug

operator lexeme declarations with explicit precedence groups are (incorrectly) flagged as invalid syntax:

infix operator ?= :ComparisonPrecedence

Screenshot from 2022-07-19 15-42-06

there are three bugs here. two are vscode-swift bugs, and the other one is a sourcekit-lsp bug:

lexeme ?= : ComparisonPrecedence
current semantic highlight none none identifier
expected semantic highlight identifier none identifier
sourcekit-lsp bug? yes no no
current fallback label operator invalid invalid
expected fallback label operator none none
vscode-swift bug? no yes yes

Environment

  • OS: Ubuntu 20.04
  • vscode-swift version: 0.6.0
$ swift --version
Swift version 5.8-dev (LLVM 396c6969ee90ef4, Swift 02efc3a2d28e348)
Target: x86_64-unknown-linux-gnu
$ swiftenv version
DEVELOPMENT-SNAPSHOT-2022-07-06-a 
$ code --version
1.69.2
3b889b090b5ad5793f524b5d1d39fda662b96a2a
x64
@tayloraswift tayloraswift added the bug Something isn't working label Jul 19, 2022
@adam-fowler
Copy link
Contributor

Again this is most likely Sourcekit-LSP. The vscode-swift extension does nothing with the semantic highlighting

@tayloraswift
Copy link
Member Author

can you please transfer this issue to https://github.com/apple/sourcekit-lsp/issues ?
i do not have write access to either repo

@adam-fowler
Copy link
Contributor

It appears transfer issue only works within an organisation. So I can't transfer to the apple organisation.

@tayloraswift
Copy link
Member Author

there are three bugs covered by this issue, you are correct in that one of them was actually a sourcekit-lsp issue, and i have refiled it there. the other two are vscode bugs, as they originate from faulty rules in their repository: https://github.com/microsoft/vscode/blob/main/extensions/swift/syntaxes/swift.tmLanguage.json

closing this issue

@jtbandes
Copy link

Hi folks, I'm obviously quite late to this ticket, but I'm the maintainer of the upstream repo that the vscode grammar is generated from. I'm trying to understand the reported issue exactly, but I'm kind of confused because as far as I can tell the grammar is handling this line correctly in TextMate and GitHub (which also uses the TM grammar):

infix operator ?= :ComparisonPrecedence
image

Is the issue only present in the vscode extension specifically?

@adam-fowler
Copy link
Contributor

@tayloraswift can you help here

@tayloraswift
Copy link
Member Author

tayloraswift commented Oct 26, 2023

i am still seeing invalid.illegal.character-not-allowed-here.swift meta.definition.operator.swift source.swift for the colon in that example.

i’m on version v1.7.0 of the swift extension, but i imagine this is coming from the TextMate grammar that ships with VSCode (1.83.1), and not the swift extension.

@jtbandes
Copy link

Yep, sounds like it must be a VS Code specific issue then. If anyone knows a quick way to use an updated tmlanguage in vscode for testing purposes, let me know. I will try it out and see if I can figure out where the discrepancy comes from.

@jtbandes
Copy link

jtbandes commented Nov 3, 2023

I believe the root cause of the issue is microsoft/vscode-textmate#140. There seems to be a simple enough workaround so I believe it I can get this fixed easily.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants