This repository has been archived by the owner. It is now read-only.

[nuclide-swift] Provide dynamic syntax highlighting via SourceKit #649

Open
modocache opened this Issue Aug 1, 2016 · 2 comments

Comments

Projects
None yet
3 participants
@modocache
Contributor

modocache commented Aug 1, 2016

Thanks to the SwiftPMTaskRunnerStore, the compile commands we store, and SourceKit, we could potentially provide really great syntax highlighting.

At the very least, we can use the sourcekitten syntax command. That command doesn't take a --compilerargs, but what if we modified it so that it did? Could we get even better syntax highlighting?

Without compiler args, SourceKitten reports the vast majority of symbols as source.lang.swift.syntaxtype.identifier, whether they're initializing a struct or calling a function. Xcode, on the other hand, is able to color structs and functions differently. If we passed better args to SourceKit, would we be able to get better type info? Or should we be using a different command, like sourcekitten structure?

Unfortunately, it seems like dynamic grammars are not straightforward in Atom. @jarsen provided these helpful links:

We should look into building a dynamic grammar for Swift.

@mominul

This comment has been minimized.

mominul commented Aug 5, 2016

Here is an another issue that contains some more links that @basarat referenced when investigating about dynamic grammar.

@basarat has implemented his dynamic grammar here

@gandm

This comment has been minimized.

gandm commented Aug 10, 2016

You might also want to take a look at tree-sitter. It is written by Max Brunsfeld, who is part of the github atom team. I was thinking of using it to create a package to replace my language-babel grammar. Maybe he can cast some light on whether this it will make it into core atom?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.