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

[Syntax] Function is not recognized after variable declaration without type annotation #4

Open
blach opened this issue Sep 19, 2023 · 0 comments · May be fixed by #5
Open

[Syntax] Function is not recognized after variable declaration without type annotation #4

blach opened this issue Sep 19, 2023 · 0 comments · May be fixed by #5
Assignees
Labels

Comments

@blach
Copy link

blach commented Sep 19, 2023

Describe the syntax error
There is a syntax error when a variable declaration is not followed by a type annotation. A function declaration after such a variable declartion is not recognized.

Consider this example:

@Environment(\.dynamicTypeSize) var dynamicTypeSize

func subtitle() -> LocalizedStringKey {

In this case, the func keyword is not recognized. It gets the scope variable.other.swift instead of keyword.declaration.function.swift.

This is how it looks in Sublime Text:

Bildschirmfoto 2023-09-19 um 11 53 12

Expected behavior
The function should be recognized even if there is no type annotation in the previous variable declaration.

This is how it should look:

Bildschirmfoto 2023-09-19 um 11 55 37

Minimum Reproducible Snippet of Swift code

@Environment(\.dismiss) var dismiss

func test() {

Environment (please complete the following information):

  • OS: macOS
  • Sublime Text: 4156

Additional context
I think this can be fixed by adding - include: reserved-word-pop to declaration-variable: and declaration-constant:.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants