textmate / swift.tmbundle

TextMate support for Swift
72 stars 30 forks source link

updated language syntax, snippets, commands for the swift programming language #2

Closed nemesit closed 10 years ago

sorbits commented 10 years ago

I do not have the Xcode 6 beta, but I think you should be able to run ‘swift’ via ‘xcrun’, e.g.: xcrun --sdk MacOSX10.10.sdk swift

With respect to saving document before executing, set the command to “Save: Modified Documents” and in the command:

require "#{ENV['TM_SUPPORT_PATH']}/lib/tm/save_current_document"
⋮
TextMate.save_if_untitled('swift')

That way, TextMate will save the document whenever there is a path (doing necessary stuff with encoding, will/did save hooks, etc.) and otherwise the command (by calling ‘save_if_untitled’) will save stdin to a temporary path with a ‘.swift’ extension and update TM_FILEPATH and related variables.

The shebang should be: #!/usr/bin/env ruby18

The command should have a semantic class of: process.run.swift (this is not something we currently use, but it will allow us to make semantic queries in the future to populate a toolbar, palette, or similiar).

I’ll let @Infininight handle merging (I just took a look at the run command).

On 14 Jul 2014, at 22:31, nemesit wrote:

You can merge this Pull Request by running:

git pull https://github.com/nemesit/swift.tmbundle master

Or you can view, comment on it, or merge it online at:

https://github.com/textmate/swift.tmbundle/pull/2

-- Commit Summary --

  • execute swift script with Cmd+R
  • Run: save document before running
  • Run: add osx sdk path as argument to enable import of Cocoa
  • updated language grammar and added snippets
  • added license info of syntax used as a starting point

-- File Changes --

A Commands/Run Script.tmCommand (45) A Snippets/Array.tmSnippet (16) A Snippets/Dictionary.tmSnippet (16) A Snippets/class-var.tmSnippet (16) A Snippets/class.tmSnippet (16) A Snippets/deinit.tmSnippet (18) A Snippets/didSet.tmSnippet (18) A Snippets/else-if.tmSnippet (18) A Snippets/else.tmSnippet (18) A Snippets/enum.tmSnippet (18) A Snippets/extension.tmSnippet (18) A Snippets/func.tmSnippet (18) A Snippets/get.tmSnippet (18) A Snippets/if-else.tmSnippet (20) A Snippets/if.tmSnippet (18) A Snippets/init.tmSnippet (18) A Snippets/operator.tmSnippet (18) A Snippets/protocol.tmSnippet (18) A Snippets/set.tmSnippet (18) A Snippets/shebang.tmSnippet (18) A Snippets/static-var.tmSnippet (16) A Snippets/struct.tmSnippet (18) A Snippets/subscript.tmSnippet (20) A Snippets/switch.tmSnippet (19) A Snippets/typealias.tmSnippet (16) A Snippets/willSet.tmSnippet (18) M Syntaxes/Swift.tmLanguage (1148) A Syntaxes/Swift.tmLanguage-license.txt (21) M info.plist (10)

-- Patch Links --

https://github.com/textmate/swift.tmbundle/pull/2.patch https://github.com/textmate/swift.tmbundle/pull/2.diff


Reply to this email directly or view it on GitHub: https://github.com/textmate/swift.tmbundle/pull/2

nemesit commented 10 years ago

I adjusted the run command to not be dependent on a specific Xcode beta and added the save_if_untitled("swift"). The ruby shebang is also fixed as is the semantic class :-)

infininight commented 10 years ago

Made a couple minor changes and added a couple commits and pulled, thanks!

sorbits commented 10 years ago

A little late, but why add a specific license for the language grammar?

The bundle already had a license in README.md which is the standard license we use for bundles.

nemesit commented 10 years ago

the language grammar is only partly from myself so i included the license until i'm finished with my grammar