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

[SR-7252] SourceKit doesn't recognise static and class as declaration attribute #49800

Open
swift-ci opened this issue Mar 22, 2018 · 0 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-7252
Radar None
Original Reporter dirtydanee (JIRA User)
Type Bug
Environment

Apple Swift version 4.1 using Xcode 9.3 beta 4
macOS version 10.13.3

Additional Detail from JIRA
Votes 1
Component/s Source Tooling
Labels Bug
Assignee None
Priority Medium

md5: e0df0c763edebf5d45e250af1abf307b

Issue Description:

SourceKit doesn't include `static` and `class` as declaration attribute.

For example:

class Foo {   
    static public let bar = 3
}

OR

class Foo { 
    class public func bar() {} 
}

will return

{
"key.diagnostic_stage": "source.diagnostic.stage.swift.parse", 
"key.substructure": [
{ 
"key.bodylength": 31, 
"key.nameoffset": 6, 
"key.accessibility": "source.lang.swift.accessibility.internal", 
"key.length": 43, 
"key.substructure": [
{
"key.nameoffset": 32, 
"key.accessibility": "source.lang.swift.accessibility.public", 
"key.length": 25, 
"key.name": "bar", 
"key.kind": "source.lang.swift.decl.var.static", 
"key.namelength": 3, 
"key.offset": 14, 
"key.attributes": [
{ "key.attribute": "source.decl.attribute.public", 
"key.offset": 21, 
"key.length": 6}]
}
], 
"key.runtime_name": "_TtC8__main__3Foo", 
"key.name": "Foo", 
"key.kind": "source.lang.swift.decl.class", 
"key.namelength": 3, 
"key.offset": 0, 
"key.bodyoffset": 11

}], 
"key.offset": 0, 
"key.length": 43
}

{
"key.diagnostic_stage": "source.diagnostic.stage.swift.parse", "key.substructure": [
{ 
"key.bodylength": 32, 
"key.nameoffset": 6, 
"key.accessibility": "source.lang.swift.accessibility.internal", 
"key.length": 44, 
"key.substructure": [
{
"key.bodylength": 0, 
"key.nameoffset": 32, 
"key.attributes": [
{
"key.attribute": "source.decl.attribute.public", 
"key.offset": 20, 
"key.length": 6
}
], 
"key.accessibility": "source.lang.swift.accessibility.public", 
"key.length": 26, 
"key.name": "bar()", 
"key.kind": "source.lang.swift.decl.function.method.class", 
"key.namelength": 5, 
"key.offset": 14, 
"key.bodyoffset": 39
}
], 
"key.runtime_name": "_TtC8__main__3Foo", "key.name": "Foo", "key.kind": "source.lang.swift.decl.class", 
"key.namelength": 3, 
"key.offset": 0, 
"key.bodyoffset": 11
}
], 
"key.offset": 0, 
"key.length": 44
}

In `key.attributes` SourceKit only returns receive `source.decl.attribute.public`, nothing regarding the `static` or the `class` modifier.

I understand, that it is part of the `key.kind`, however using the structure above i am not able to identify what is the offset of the `static`, nor the `class` keyword.

Is there any chance, it could be included as attribute? It would be great, so i can identify the position by using `key.offset`.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.
Projects
None yet
Development

No branches or pull requests

1 participant