Skip to content

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

@blach

Description

@blach

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:.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions