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

Casted class types are not highlighted (via as) #48

Closed
kylef opened this issue Aug 3, 2015 · 2 comments
Closed

Casted class types are not highlighted (via as) #48

kylef opened this issue Aug 3, 2015 · 2 comments

Comments

@kylef
Copy link
Collaborator

kylef commented Aug 3, 2015

I'd expect as NSDictionary to highlight NSDictionary.

screen shot 2015-08-03 at 22 56 34

@keith
Copy link
Owner

keith commented Aug 3, 2015

Thanks for these 3 (with examples!) Kyle. Vim syntax files are the worst. I'll see what I can do.

@keith
Copy link
Owner

keith commented Oct 18, 2015

I almost got somewhere with this:

syntax match swiftThing "\v\W\u\w+"hs=s+1
syntax match swiftThing "\v^\u\w+"
highlight default link swiftThing TODO

This worked by highlighting everything that had a capital letter, followed by other letters. It almost worked because it was also overwritten by other rules. There are 2 cases this is broken with though:

if #available(OSX 10.10.3, *) {

Here it overwrites the highlight of OSX. And:

let URL = NSURL(string: "foo")

It highlights URL when it shouldn't be (or any other variable name starting with a capital letter). We could possibly handle this last case by making sure it's not followed by a = but that got pretty complex pretty quickly.

If anyone wants to take this starting point and run with it that would be awesome

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

No branches or pull requests

2 participants