Skip to content

Swift Language support#11

Open
MatthiasPortzel wants to merge 2 commits into
xi-editor:masterfrom
MatthiasPortzel:swift
Open

Swift Language support#11
MatthiasPortzel wants to merge 2 commits into
xi-editor:masterfrom
MatthiasPortzel:swift

Conversation

@MatthiasPortzel

Copy link
Copy Markdown
Contributor

Similar procedure and reasoning to #9. Will close #8, and replaces #10.

-Cloned from https://github.com/quiqueg/Swift-Sublime-Package.git
-Removed the .git folder. (I'm thinking it doesn't make sense for it to be a submodule, it makes more sense to be a copy.)
-Converted with sublime_syntax_convertor
Removes JSON-tmLanguage and YAML-tmLanguge files. These files aren't used or recognized by Xi.
The .tmPreferences and .tmLangage files were moved into the Swift folder instead of a subfolder.
@cmyr

cmyr commented May 17, 2019

Copy link
Copy Markdown
Member

@matthiassaihttam Cool, thanks, this will be a good addition. Do you have a sense of how up-to-date this syntax is? 2014 is a while ago, but I guess most major language features were in place by then?

@mmatoszko Would you like to take a look at this? You were mentioning swift syntax support at some point. @naclcaleb would also be curious for you to try this out. :)

@MatthiasPortzel

Copy link
Copy Markdown
Contributor Author

That's a good point; Apple has been iterating with Swift relatively quickly. This the most recent I could quickly find, and I think it's still the most popular Sublime Swift package. (So think this would be the same syntax Sublime users are getting, but it would nice if someone could confirm.) I could check what Atom uses for syntax highlighting, and if that's more up to date, but I still don't know if that could be converted to .sublime-syntax easily.

@cmyr

cmyr commented May 17, 2019

Copy link
Copy Markdown
Member

I believe both atom and vscode use some variant of textmate syntaxes, so conversion should be possible with some utility?

@MatthiasPortzel

MatthiasPortzel commented May 17, 2019

Copy link
Copy Markdown
Contributor Author

Atom's primary Swift package was last updated 3 years ago (late 2016).
And the VSCode package is similar, 2017.

I am skeptical that there's a advantage to using a slightly newer version; the Sublime package I used was last updated 3 years ago (2016), and mentions Swift 3. (But I also don't use Swift enough to really know what features could be missing.)

@naclcaleb

Copy link
Copy Markdown

I believe the current version is Swift 5, though I think the jump from 2 to 3 was the most dramatic change.

@naclcaleb

Copy link
Copy Markdown

@cmyr, are you saying you want me to try the new syntax highlighting in the PR? I would try it, but I haven't actually been able to get Xi to compile because my Mac uses Swift 5 and it only supports up to 3 (or 4?)

@cmyr

cmyr commented May 17, 2019

Copy link
Copy Markdown
Member

@naclcaleb To clarify, you're using Xcode 10.x, and you can't get xi-mac to compile?

@naclcaleb

Copy link
Copy Markdown

@cmyr Yes, I'm using Xcode v10.1

@cmyr

cmyr commented May 17, 2019

Copy link
Copy Markdown
Member

Okay, well xi-mac should compile fine there. Maybe open an issue in the xi-mac repo and we can figure out what's going on?

@naclcaleb

Copy link
Copy Markdown

Ok, here you go: xi-editor/xi-mac#465

@cmyr

cmyr commented May 20, 2019

Copy link
Copy Markdown
Member

I've played around with this and the highlighting seems pretty sparse, including no highlighting for do/catch, but maybe this is better than nothing?

Screen Shot 2019-05-20 at 1 14 15 PM

@naclcaleb

Copy link
Copy Markdown

I feel like the Swift syntax highlighting isn't that different from some other ones like JS.
Maybe just editing the JS file would suffice?

@cmyr

cmyr commented Aug 1, 2019

Copy link
Copy Markdown
Member

@naclcaleb oops, missed this comment, sorry!

You could certainly try to start a new sytanx def based on JS, but I think you would have better luck starting with an existing swift syntax and updating that?

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

Successfully merging this pull request may close these issues.

include swift syntax highlighting

3 participants