├── .gitignore ├── Commands ├── Compile.tmCommand ├── Complete.tmCommand ├── Documentation for Word : Selection.tmCommand ├── Open Package.tmCommand ├── Reformat Document.tmCommand ├── Run.tmCommand └── Test.tmCommand ├── History.rdoc ├── LICENSE ├── Preferences ├── Comments.tmPreferences ├── Folding.tmPreferences ├── Indentation Rules.tmPreferences ├── Symbol List: Functions.tmPreferences └── Symbol List: Methods.tmPreferences ├── README.rdoc ├── Snippets ├── Case Clause.tmSnippet ├── Channel.tmSnippet ├── Constant.tmSnippet ├── Constants.tmSnippet ├── Default Clause.tmSnippet ├── Deferred Call.tmSnippet ├── Empty Interface.tmSnippet ├── For Index Loop.tmSnippet ├── For Loop.tmSnippet ├── For Range Loop.tmSnippet ├── Function Type.tmSnippet ├── Function w: result vars.tmSnippet ├── Function.tmSnippet ├── Goroutine Call.tmSnippet ├── If Statement.tmSnippet ├── If err.tmSnippet ├── Import.tmSnippet ├── Imports.tmSnippet ├── Init Function.tmSnippet ├── Initialize.tmSnippet ├── Interface.tmSnippet ├── Main Function.tmSnippet ├── Make.tmSnippet ├── Map.tmSnippet ├── Method w: result vars.tmSnippet ├── Method.tmSnippet ├── New.tmSnippet ├── Package.tmSnippet ├── Pair.tmSnippet ├── Return Statement.tmSnippet ├── Select Statement.tmSnippet ├── Send_Receive.tmSnippet ├── Slice.tmSnippet ├── Struct.tmSnippet ├── Switch Statement.tmSnippet ├── Test.tmSnippet ├── Type.tmSnippet ├── Types.tmSnippet ├── Variable.tmSnippet ├── Variables.tmSnippet └── iota.tmSnippet ├── Support ├── gomate.rb └── icons │ ├── const.png │ ├── func.png │ ├── icons.psd │ ├── package.png │ ├── type.png │ └── var.png ├── Syntaxes └── Go.tmLanguage └── info.plist /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /Commands/Compile.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | autoScrollOutput 6 | 7 | beforeRunningCommand 8 | saveModifiedFiles 9 | command 10 | #!/usr/bin/env ruby 11 | 12 | require "#{ENV['TM_BUNDLE_SUPPORT']}/gomate" 13 | Go::go "build", :verb => "Compiling" 14 | 15 | input 16 | document 17 | inputFormat 18 | text 19 | keyEquivalent 20 | @b 21 | name 22 | Compile 23 | outputCaret 24 | afterOutput 25 | outputFormat 26 | html 27 | outputLocation 28 | newWindow 29 | requiredCommands 30 | 31 | 32 | command 33 | go 34 | locations 35 | 36 | /opt/local/bin/go 37 | /usr/local/bin/go 38 | /usr/local/go/bin/go 39 | 40 | variable 41 | TM_GO 42 | 43 | 44 | scope 45 | source.go 46 | uuid 47 | 73628139-0077-4F09-9B72-77546D7C2D2D 48 | version 49 | 2 50 | 51 | 52 | -------------------------------------------------------------------------------- /Commands/Complete.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | saveActiveFile 7 | command 8 | #!/usr/bin/env ruby -Ku 9 | require ENV['TM_SUPPORT_PATH'] + '/lib/ui.rb' 10 | require ENV['TM_SUPPORT_PATH'] + "/lib/escape.rb" 11 | require ENV['TM_SUPPORT_PATH'] + "/lib/tm/require_cmd.rb" 12 | require ENV['TM_SUPPORT_PATH'] + "/lib/tm/htmloutput.rb" 13 | require ENV['TM_SUPPORT_PATH'] + "/lib/web_preview" 14 | 15 | # current document 16 | document = [] 17 | File.open(ENV['TM_FILEPATH'], "r+") do |file| 18 | document = file.readlines 19 | end 20 | 21 | # byte offset of cursor position from the beginning of file 22 | cursor = document[ 0, ENV['TM_LINE_NUMBER'].to_i - 1].join().length + ENV['TM_LINE_INDEX'].to_i 23 | output = `$TM_GOCODE -f=csv -in=#{e_sh ENV['TM_FILEPATH']} autocomplete #{cursor}` 24 | 25 | # quit if no completions found 26 | TextMate.exit_show_tool_tip("No completions found.") if output.length == 0 27 | 28 | # set up images for use by DIALOG 29 | # this probably should be done only once, somehow. 30 | icon_plist = "{ " + [ "const", "func", "package", "type", "var" ].map { |v| 31 | "#{v} = '#{ENV['TM_BUNDLE_SUPPORT']}/icons/#{v}.png';" 32 | }.join(" ") + " }" 33 | system( ENV['DIALOG'], "images", "--register", icon_plist ) 34 | 35 | # helper function to build the choice hash 36 | def make_completion_hash(line) 37 | comp = line.split(",,", 3) 38 | 39 | match = comp[1] 40 | image = comp[0] 41 | 42 | display = " " + comp[1] 43 | display += comp[0] == "func" ? comp[2].gsub(/^func/, "") : " " + comp[2] 44 | 45 | # input : "foo(x func(func())) (z int, k int)" 46 | # output: "0000111111122222210001111111111110" 47 | def depth_at_i(sig) 48 | depths = Array.new 49 | depth = 0 50 | sig.chars { |ch| 51 | depth-=1 if ch == ")" 52 | depths << depth 53 | depth+=1 if ch == "(" 54 | } 55 | return depths 56 | end 57 | 58 | # returns function arguments in the form "x arg, y arg" 59 | def get_f_args(sig) 60 | depths = depth_at_i(sig) 61 | pos = sig.index(")") 62 | while pos != nil && depths[pos] > 0 63 | pos = sig.index(")", pos+1) 64 | end 65 | return sig[ Range.new(sig.index("(")+1, pos - 1) ] 66 | end 67 | 68 | def split_args(sig) 69 | args = Array.new 70 | depths = depth_at_i(sig) 71 | start = 0 72 | pos = sig.index(",") 73 | 74 | while pos != nil 75 | if depths[pos] == 0 76 | args << sig[ Range.new(start, pos-1) ] 77 | start = pos+1 78 | end 79 | pos = sig.index(",", pos+1) 80 | end 81 | 82 | lastarg = sig[ Range.new(start, sig.length) ].strip 83 | args << lastarg unless lastarg == "" 84 | return args 85 | end 86 | 87 | if comp[0] == "func" 88 | i = 0 89 | insert = "(" + split_args( get_f_args( display )).map { |m| "${#{i += 1}:"+e_snp(m)+"}" }.join(", ") + ")$0" 90 | else 91 | insert = "" 92 | end 93 | 94 | return { 'match' => match, 'display' => display, 'insert' => insert, 'image' => image } 95 | end 96 | 97 | # build the list of completion choices. 98 | hash = output.split("\n").collect { |v| make_completion_hash( v ) } 99 | options = { :extra_chars => "_", :case_insensitive => false } 100 | 101 | # if there is only one match, insert. no need to show the menu 102 | if hash.length == 1 103 | word = ENV['TM_CURRENT_WORD'] || "" 104 | snippet = hash[0]["match"].gsub(/^#{Regexp.escape(word)}/, "") + hash[0]["insert"] 105 | #`"$DIALOG" x-insert --snippet #{e_sh snippet}` 106 | #full = document.join() 107 | #print e_sn(full[0..cursor]) + "$0" + e_sn(full[cursor+1..-1]) 108 | TextMate.exit_insert_snippet( snippet ) 109 | else 110 | TextMate::UI.complete( hash , options ) 111 | end 112 | fallbackInput 113 | word 114 | hideFromUser 115 | true 116 | input 117 | none 118 | inputFormat 119 | text 120 | keyEquivalent 121 | ~ 122 | name 123 | Complete 124 | outputCaret 125 | afterOutput 126 | outputFormat 127 | text 128 | outputLocation 129 | atCaret 130 | requiredCommands 131 | 132 | 133 | command 134 | gocode 135 | moreInfoURL 136 | https://github.com/nsf/gocode 137 | variable 138 | TM_GOCODE 139 | 140 | 141 | scope 142 | source.go 143 | uuid 144 | FE908865-7729-4926-9FAC-2D54895BEA48 145 | version 146 | 2 147 | 148 | 149 | -------------------------------------------------------------------------------- /Commands/Documentation for Word : Selection.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | saveModifiedFiles 7 | command 8 | #!/usr/bin/env ruby 9 | 10 | require "#{ENV['TM_BUNDLE_SUPPORT']}/gomate" 11 | Go::godoc 12 | 13 | fallbackInput 14 | word 15 | input 16 | selection 17 | inputFormat 18 | text 19 | keyEquivalent 20 | ^h 21 | name 22 | Documentation for Word / Selection 23 | outputCaret 24 | afterOutput 25 | outputFormat 26 | html 27 | outputLocation 28 | toolTip 29 | requiredCommands 30 | 31 | 32 | command 33 | godoc 34 | locations 35 | 36 | /opt/local/bin/godoc 37 | /usr/local/bin/godoc 38 | /usr/local/go/bin/godoc 39 | 40 | variable 41 | TM_GODOC 42 | 43 | 44 | scope 45 | source.go 46 | uuid 47 | 7BCFCFC8-9152-4638-8436-E17B0C754C8D 48 | version 49 | 2 50 | 51 | 52 | -------------------------------------------------------------------------------- /Commands/Open Package.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby 9 | require "shellwords" 10 | 11 | def import_path 12 | if ENV.has_key? 'TM_SELECTED_TEXT' 13 | ENV['TM_SELECTED_TEXT'] 14 | elsif ENV['TM_CURRENT_LINE'] =~ /^\s*(?:import\s+)?(?:\.|[[:alpha:]_][[:alnum:]_]*\s+)?(["`])(.*?)\1/; 15 | $2 16 | else 17 | defaultText = %x{ /usr/bin/pbpaste -pboard find } 18 | require "#{ENV['TM_SUPPORT_PATH']}/lib/ui.rb" 19 | TextMate::UI.request_string :title => "Open Package", :default => defaultText, :prompt => "Which package do you wish to open?" 20 | end 21 | end 22 | 23 | def go_path 24 | env = %x{"${TM_GO:-go}" env} 25 | if $? == 0 26 | lcal, root = [], [] 27 | env.scan(/^GO(PATH|ROOT)="(.*)"/) do |key,value| 28 | case key 29 | when 'PATH': lcal = value.split(':').map { |dir| "#{dir}/src" } 30 | when 'ROOT': root = value.split(':').map { |dir| "#{dir}/src/pkg" } 31 | end 32 | end 33 | [ lcal, root ].flatten 34 | else 35 | ENV['GOPATH'].to_s.split(':').map { |dir| "#{dir}/src" } 36 | end 37 | end 38 | 39 | def find_package_path(package) 40 | go_path.each do |dir| 41 | path = File.expand_path(package, dir) 42 | if File.directory?(path) 43 | files = Dir.entries(path).select { |file| file =~ /\.go$/ && file !~ /_test\.go$/ } 44 | return files.size == 1 ? File.join(path, files.first) : path 45 | end 46 | end 47 | nil 48 | end 49 | 50 | if package = import_path() 51 | if path = find_package_path(package) 52 | %x{"$TM_MATE" #{path.shellescape}} 53 | else 54 | require "#{ENV['TM_SUPPORT_PATH']}/lib/exit_codes.rb" 55 | TextMate.exit_show_tool_tip "Unable to locate package for import path ‘#{package}’." 56 | end 57 | end 58 | 59 | input 60 | selection 61 | inputFormat 62 | text 63 | keyEquivalent 64 | @D 65 | name 66 | Open Package 67 | outputCaret 68 | afterOutput 69 | outputFormat 70 | text 71 | outputLocation 72 | discard 73 | scope 74 | source.go 75 | uuid 76 | D3CD6B51-3A7E-4356-85F4-B76B8336BEF2 77 | version 78 | 2 79 | 80 | 81 | -------------------------------------------------------------------------------- /Commands/Reformat Document.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | saveModifiedFiles 7 | command 8 | #!/usr/bin/env ruby 9 | 10 | require "#{ENV['TM_BUNDLE_SUPPORT']}/gomate" 11 | Go::gofmt 12 | 13 | input 14 | document 15 | inputFormat 16 | text 17 | keyEquivalent 18 | ^H 19 | name 20 | Reformat Document 21 | outputCaret 22 | interpolateByLine 23 | outputFormat 24 | text 25 | outputLocation 26 | replaceDocument 27 | requiredCommands 28 | 29 | 30 | command 31 | gofmt 32 | locations 33 | 34 | /opt/local/bin/gofmt 35 | /usr/local/bin/gofmt 36 | /usr/local/go/bin/gofmt 37 | 38 | variable 39 | TM_GOFMT 40 | 41 | 42 | scope 43 | source.go 44 | uuid 45 | B0271A46-F6EF-4D2F-95A6-EC067E69155C 46 | version 47 | 2 48 | 49 | 50 | -------------------------------------------------------------------------------- /Commands/Run.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | autoScrollOutput 6 | 7 | beforeRunningCommand 8 | saveModifiedFiles 9 | command 10 | #!/usr/bin/env ruby 11 | 12 | require "#{ENV['TM_BUNDLE_SUPPORT']}/gomate" 13 | Go::go "run", :verb => "Running" 14 | 15 | input 16 | document 17 | inputFormat 18 | text 19 | keyEquivalent 20 | @r 21 | name 22 | Run 23 | outputCaret 24 | afterOutput 25 | outputFormat 26 | html 27 | outputLocation 28 | newWindow 29 | requiredCommands 30 | 31 | 32 | command 33 | go 34 | locations 35 | 36 | /opt/local/bin/go 37 | /usr/local/bin/go 38 | /usr/local/go/bin/go 39 | 40 | variable 41 | TM_GO 42 | 43 | 44 | scope 45 | source.go 46 | uuid 47 | 0B3C3EB0-9F51-4997-A87D-ECA507D8E31E 48 | version 49 | 2 50 | 51 | 52 | -------------------------------------------------------------------------------- /Commands/Test.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | autoScrollOutput 6 | 7 | beforeRunningCommand 8 | saveModifiedFiles 9 | command 10 | #!/usr/bin/env ruby 11 | 12 | require "#{ENV['TM_BUNDLE_SUPPORT']}/gomate" 13 | Go::go "test", :verb => "Testing" 14 | 15 | input 16 | document 17 | inputFormat 18 | text 19 | keyEquivalent 20 | @R 21 | name 22 | Run Tests 23 | outputCaret 24 | afterOutput 25 | outputFormat 26 | html 27 | outputLocation 28 | newWindow 29 | requiredCommands 30 | 31 | 32 | command 33 | go 34 | locations 35 | 36 | /opt/local/bin/go 37 | /usr/local/bin/go 38 | /usr/local/go/bin/go 39 | 40 | variable 41 | TM_GO 42 | 43 | 44 | scope 45 | source.go 46 | uuid 47 | 0F6A8710-54FC-48F5-9D02-D093DA001D17 48 | version 49 | 2 50 | 51 | 52 | -------------------------------------------------------------------------------- /History.rdoc: -------------------------------------------------------------------------------- 1 | === 2.0.1 / 2012-10-22 2 | * Fixed code-completion with a single result: no longer puts single completions at end of file. 3 | 4 | === 2.0 / 2012-10-22 5 | * Merged in a whole lot of work from other folks, primarily bringing in full support for Go 1.0 and TextMate 2: 6 | 7 | [https://github.com/AlanQuatermain/go-tmbundle/commit/1f182d955b56f6ccb308c94f4b1e1463ae99a782] 8 | *sdefresne* Support for Go version 1.0 9 | 10 | [https://github.com/AlanQuatermain/go-tmbundle/commit/a2297b561653a5cc2874c0ee106715795a92ad99] 11 | *sdefresne* Update documentation 12 | 13 | [https://github.com/AlanQuatermain/go-tmbundle/commit/abb8331d64817241a23b8668e2354e983d803c91] 14 | *liuyork* Fix the mistake when call "go" CMD. 15 | 16 | [https://github.com/AlanQuatermain/go-tmbundle/commit/789bb3951f6e82241ff57cfb4877265191b0f081] 17 | *AlekSi* Fix important typo. 18 | 19 | [https://github.com/AlanQuatermain/go-tmbundle/commit/7d7e399afecd114dfc39fe8f8bbc15c883db4c39] 20 | *AlekSi* It's 'git clone'. 21 | 22 | [https://github.com/AlanQuatermain/go-tmbundle/commit/cf5c2528bb70747301a9e694b55ca376fa2f12c7] 23 | *mkhl* Merge "Deferred Function Call" into "Deferred Call". 24 | 25 | [https://github.com/AlanQuatermain/go-tmbundle/commit/76199f73304285b2e03b25192e129f9744d30ae0] 26 | *mkhl* Adapt "Goroutine Call" in the spirit of "Deferred Call". 27 | 28 | [https://github.com/AlanQuatermain/go-tmbundle/commit/48287f71203d6c3c87c2bca96a62752b6d33bd72] 29 | *infininight* Improve comment matches. 30 | 31 | [https://github.com/AlanQuatermain/go-tmbundle/commit/7232ee66407a894f94358e23c6a32aad584a5ca7] 32 | *infininight* Improve scoping of braces and parens, remove outdated snippet. 33 | 34 | [https://github.com/AlanQuatermain/go-tmbundle/commit/cb99b8da8a12b328f8c65885a82d569917798202] 35 | *infininight* Hide completion command in the menu. 36 | 37 | [https://github.com/AlanQuatermain/go-tmbundle/commit/8d019dd8126334cf4801b8fcf151c522d4fef58f] 38 | *infininight* Move folding settings. 39 | 40 | [https://github.com/AlanQuatermain/go-tmbundle/commit/0ff2ffb4260f8332c3e1136d58e6b5122453e26b] 41 | *infininight* Correct version lookup and parsing. 42 | 43 | [https://github.com/AlanQuatermain/go-tmbundle/commit/ca55b4ce28b7badd56e3df69a56b6e8f51fce589] 44 | *whitlockjc* Updated all commands to use TM_* variables to locate necessary executables and TM_GOPATH. 45 | 46 | [https://github.com/AlanQuatermain/go-tmbundle/commit/1f69fb08bc84267ecb7b75725ddebe5a879d8bea] 47 | *infininight* Start using requiredCommands to locate go. 48 | 49 | === 1.3.2 / 2012-10-19 50 | * Added Symbol List support for functions and received functions (object methods). 51 | 52 | === 1.3.1 / 2012-10-18 53 | * Fixed some problems with the indentation regexes. 54 | 55 | === 1.3 / 2011-11-22 56 | * Includes a wrapper for +gotest+ on Cmd-Opt-T. 57 | * Imported some community additions and bugfixes to bring compatibility with OS X 10.7 and TextMate 1.5.1: 58 | [https://github.com/AlanQuatermain/go-tmbundle/commit/97f8c44552b0347c9d89f948a5fb92172f32daca] 59 | *mkhl* Use default values for GOOS and GOARCH only when necessary. 60 | [https://github.com/AlanQuatermain/go-tmbundle/commit/c85768b573f47d7274066b1260df6627ce35b82f] 61 | *rsesek* Include the receiver in entity.name.function scope so that it shows up in the symbol list. 62 | [https://github.com/AlanQuatermain/go-tmbundle/commit/2eeb1c60f975af7cc3250964c9da58fca37d57f8] 63 | *guncha* Add gocode completion support. 64 | [https://github.com/AlanQuatermain/go-tmbundle/commit/b730967fbd14e58bcc32d7f5157234cfa48f4043] 65 | *guncha* Add proper argument handling for functions. 66 | [https://github.com/AlanQuatermain/go-tmbundle/commit/837e04fba7e6e4a3127006be5fa3f1d04e357cba] 67 | *guncha* Fix links not working properly when html output is produced while compiling a project with errors. 68 | [https://github.com/AlanQuatermain/go-tmbundle/commit/69797af68e37e171fa12e3aa3f0ce9340369a453] 69 | *chriseaton* Size modifiers are not optional for float or complex. 70 | [https://github.com/AlanQuatermain/go-tmbundle/commit/05ba567d62018b87619d77653b728fcd25c270fb] 71 | *schmurfy* added x86_64 as a valid architecture string. 72 | [https://github.com/AlanQuatermain/go-tmbundle/commit/2912e001142b2e0921f4f5f5c568734ccc6bf701] 73 | *TassoLee* Fix for issue #6. 74 | [https://github.com/AlanQuatermain/go-tmbundle/commit/67e6118d245ba4d9901b2fe869ca2c3a3bea4672] 75 | *TassoLee* Revert goroot. 76 | [https://github.com/guncha/go-tmbundle/commit/27142544725331d465aed364eacb67d2c4b1eeb7] 77 | *guncha* Fix for source filenames with spaces bug. 78 | [https://github.com/KnightBaron/go-tmbundle/commit/eb925bb53f71ab472d67c5ac9cfd78d7cc02be85] 79 | *KnightBaron* Use GOBIN shell variable instead of PATH if present. 80 | 81 | === 1.2 / 2010-06-13 82 | * Many new snippets and updates to the command-runner implementation, courtesy of Martin Kühl (http://github.com/mkhl). 83 | 84 | === 1.0.3 / 2010-03-28 85 | * Removed the no-longer-supported -oldparser flags from the invocation of the gofmt command 86 | (http://github.com/AlanQuatermain/go-tmbundle/issues/issue/2) 87 | 88 | === 1.0.2 / 2010-02-16 89 | * Removed the no-longer-supported -oldprinter flag from the invocation of the gofmt command (http://github.com/AlanQuatermain/go-tmbundle/issues/issue/1) 90 | 91 | === 1.0.1 / 2009-11-19 92 | * Fixed a couple of bugs in the language grammar. 93 | * Cleaned up menu formatting. 94 | * Commands will now complain correctly if the necessary command-line tools aren't available. 95 | 96 | === 1.0.0 / 2009-11-18 97 | * Updated grammar, now uses much fewer backrefs and suchlike, meaning it no longer causes TextMate to hog all your CPU! 98 | * Grammar now correctly identifies and separately scopes just about everything I've been able to find, including: 99 | * Function names, receivers, parameters, and return types. 100 | * Variable initializations, whether by short or long form (including the := operator). 101 | * Exported variables. 102 | * Channel I/O operators. 103 | * Snippets now obey standard Go formatting rules (even though they insist on icky K&R stuff, doh). 104 | * New command: Tidy. Runs 'gofmt' to reformat your code based on standard Go formatting guidelines. This has the useful side-effect of performing a syntax check on the file, so you can also use it as pre-compilation check. 105 | * Regular braces () now open up in the same manner as curly braces {} if you press Enter with the cursor between an empty pair. 106 | 107 | === 0.2.0 / 2009-11-15 108 | * New indentation increase/decrease rules: 109 | * Case statements decrease and increase (they pop their own line back by one indent without affecting either prior or following line). 110 | * Regular braces now increase/decrease indent automatically. 111 | * Regular braces now act as folding markers for multi-line 'const ( ... )' declarations. 112 | * Code-folding matches on curly braces are now more conservative-- before, they could match characters beyond newlines. 113 | * Built-in storage types are now matched properly. 114 | * Variable initialization is FINALLY matching correctly. Should work for every style & number of variables, even in-line in loop statements. 115 | * Matches exported variable names correctly (i.e. those beginning with an uppercase letter). 116 | * Dot-accessed variable match no longer consumes the preceding '.' character. 117 | 118 | === 0.1.0 / 2009-11-14 119 | * Initial Revision -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009, Jim Dovey 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 5 | 6 | - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 7 | - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 8 | - Neither the name of the copyright holder nor the names of the software's contributors may be used to endorse or promote products derived from this software without specific prior written permission. 9 | 10 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 11 | 12 | Portions based on Allan Odgaard's C bundle for TextMate. -------------------------------------------------------------------------------- /Preferences/Comments.tmPreferences: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | Comments 7 | scope 8 | source.go 9 | settings 10 | 11 | shellVariables 12 | 13 | 14 | name 15 | TM_COMMENT_START 16 | value 17 | // 18 | 19 | 20 | name 21 | TM_COMMENT_START_2 22 | value 23 | /* 24 | 25 | 26 | name 27 | TM_COMMENT_END_2 28 | value 29 | */ 30 | 31 | 32 | name 33 | TM_COMMENT_DISABLE_INDENT_2 34 | value 35 | yes 36 | 37 | 38 | 39 | uuid 40 | 05400837-EE8F-44D1-A636-3EEB0E82FFF5 41 | 42 | 43 | -------------------------------------------------------------------------------- /Preferences/Folding.tmPreferences: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | Folding 7 | scope 8 | source.go 9 | settings 10 | 11 | foldingIndentedBlockStart 12 | ^\s*(case|default)\b 13 | foldingStartMarker 14 | (?x) 15 | /\*\*(?!\*) # opening C-style comment with 2 asterisks but no third later on 16 | | # OR 17 | ^ # start of line... 18 | (?! # ...which does NOT contain... 19 | [^{(]*?// # ...a possible bunch of non-opening-braces, followed by a C++ comment 20 | | # OR 21 | [^{(]*?/\*(?!.*?\*/.*?[{(]) # ...a possible bunch of non-opening-braces, followed by a C comment with no ending 22 | ) 23 | .*? # ...any characters (or none)... 24 | [{(]\s* # ...followed by an open brace and zero or more whitespace... 25 | ( # ...followed by... 26 | $ # ...the end of line... 27 | | # OR 28 | // # ...a C++ comment... 29 | | # OR 30 | /\*(?!.*?\*/.*\S) # ...a C comment, so long as no non-whitespace chars follow it.. 31 | ) 32 | 33 | foldingStopMarker 34 | (?<!\*)\*\*/|^\s*[})] 35 | 36 | uuid 37 | 21783905-48ED-47DD-9EBA-0DF5FDBA1F4E 38 | 39 | 40 | -------------------------------------------------------------------------------- /Preferences/Indentation Rules.tmPreferences: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | Indentation Rules 7 | scope 8 | source.go 9 | settings 10 | 11 | decreaseIndentPattern 12 | (?x)^ 13 | ( .* [*]/ )? 14 | ( \s* \} .* 15 | | \s* \) ( [^)("'\n]* \( )? [;,\s]* 16 | | ( \s* (case|default)\b .* ) 17 | ) 18 | ( \s* ( //.* | /[*] .*? [*]/ ) )* 19 | \s* $ 20 | increaseIndentPattern 21 | (?x)^ 22 | ( .* [*]/ )? 23 | ( ( .* \{ [^}"'\n]* ) 24 | | ( .* \( [^)"'\n]* ) 25 | | ( \s* (case|default)\b .* ) 26 | ) 27 | ( \s* ( //.* | /[*] .*? [*]/ ) )* 28 | \s* $ 29 | zeroIndentPattern 30 | ^(?!default:)\w+:.*$ 31 | 32 | uuid 33 | 160118A4-208D-4422-AFF0-0C21B5B78AAF 34 | 35 | 36 | -------------------------------------------------------------------------------- /Preferences/Symbol List: Functions.tmPreferences: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | Symbol List: Functions 7 | scope 8 | source.go meta.function.declaration.go 9 | settings 10 | 11 | showInSymbolList 12 | 1 13 | symbolTransformation 14 | s/^\s*func\s+/ / 15 | 16 | uuid 17 | E7FFE4C1-DDB7-4405-A669-41AB65734E12 18 | 19 | 20 | -------------------------------------------------------------------------------- /Preferences/Symbol List: Methods.tmPreferences: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | Symbol List: Methods 7 | scope 8 | source.go meta.function.receiver.declaration.go 9 | settings 10 | 11 | showInSymbolList 12 | 1 13 | symbolTransformation 14 | s/^\s*func\s+\(.*?\s+\*?(.*?)\)\s*/ $1./ 15 | 16 | uuid 17 | 52EBFA13-B3F1-42BA-AF98-6D632365184E 18 | 19 | 20 | -------------------------------------------------------------------------------- /README.rdoc: -------------------------------------------------------------------------------- 1 | == Go 2 | (a TextMate 2 language bundle) 3 | Version 2.0.1 4 | 5 | === Installation 6 | 7 | The easiest way to install this bundle is to let TextMate 2 do the work for you: create a new .go file and open it in TextMate. The application will then suggest the Go language format and will download and install the bundle for you. 8 | 9 | If you'd rather do things manually, or if you want to make changes to the repository, then in a Terminal window do: 10 | 11 | mkdir ~/Library/Application\ Support/Avian/Bundles 12 | cd ~/Library/Application\ Support/Avian/Bundles 13 | git clone git://github.com/AlanQuatermain/go-tmbundle.git Go.tmbundle 14 | 15 | === Features 16 | The bundle here implements a language syntax, some snippets, and some compile/format/documentation commands for the Go language (http://golang.org/). Much of the current infrastructure was created by Martin Kühl (http://github.com/mkhl), who is a significantly more seasoned TextMate bundle developer than I, and to whom I am eternally grateful. 17 | 18 | Support for Go 1.0 was provided by Jeremy Whitlock (http://github.com/whitlockjc) and Michael Sheets (http://github.com/infininight), with additional code and fixes from Sylvain Defresne (http://github.com/sdefresne), liuyork (http://github.com/liuyork), and Alexey Palazhchenko (http://github.com/AlekSi). 19 | 20 | === Snippets 21 | 22 | ==== Simple Statements 23 | [Cmd-i] '+iota+' 24 | [,] A pair ('first, second'), suitable for declaring result variables from a multi-return-value function or a map range loop. 25 | [<] Send/receive through a channel. Provides tab stops for the value and the channel name. 26 | [def] A default clause within a switch. 27 | [in] An empty interface type (i.e. matches anything). 28 | [imp] An import statement with optional alternative name. 29 | [imps] A multiple-import statement. 30 | [pkg] A package declaration including an optional comment block for packages other than 'main'. 31 | [ret] A return statement with optional return value. 32 | 33 | ==== Initializers and Declarations 34 | [:] A short-form variable initializer (i.e. 'name := value'). 35 | [\[\]] A slice variable type; expands to '[]+type+', so is usable inside other snippets. 36 | [ch] A channel type. 37 | [con] A single constant declaration. 38 | [cons] A multiple constant declaration block. 39 | [fun] A function type definition statement. 40 | [int] An interface definition with a single method. 41 | [mk] A make statement (used for creating & initializing channels, maps, etc.). 42 | [map] A map variable type; expands to 'map[+keytype+]+valuetype+'. 43 | [new] A new statement (used to create & initialize structure types). 44 | [st] A struct definition with a single member. 45 | [type] A type declaration, with name and variable type as tab-stops. 46 | [types] A block with multiple type declarations. 47 | [var] Declare a variable with an optional initial value (long form, i.e. 'var x int = 10'). 48 | [vars] A block of long-form variable declarations. 49 | 50 | ==== Functions 51 | [de] A deferred goroutine call (defines the function inline). 52 | [func] A plain (global) function declaration, with tab stops for name, parameters, and a single optional result. 53 | [funcv] A plain (global) function declaration, with tab stops for name, parameters, and multiple results. 54 | [go] An immediate goroutine call (defines the function inline). 55 | [init] A template for a module's +init()+ function, with a tab stop at its body. 56 | [main] A template for a +main()+ function with a tab stop at its body. 57 | [meth] Declares a function on a particular type, with additional tab stops for receiver name and type and a single optional result. 58 | [methv] Declares a function on a particular type, with additional tab stops for receiver name and type and multiple results. 59 | 60 | ==== Control Statements 61 | [case] A case clause, within a switch or select. 62 | [for] A for loop. 63 | [fori] A for loop with an index (similar to C for loops). 64 | [forr] A for loop iterating over a collection's full range. 65 | [if] An if statement, properly formatted (Go requires the use of {} on ifs, unlike C; this throws me sometimes). 66 | [sel] A select statement, for looping over channel conditions. 67 | [sw] A switch statement with an optional expression. 68 | 69 | === Commands 70 | [Cmd-K] Build the current package or executable. 71 | [Cmd-R] Compile and run the current file. 72 | [Cmd-Opt-T] Launch the unittests for the current package using "go test". 73 | [Ctrl-Shift-H] Reformat the document according to the Go style guidelines. 74 | [Ctrl-H] Show the Go HTML documentation for the currently-selected symbol. 75 | [] Complete the symbol under the cursor. 76 | 77 | === Thanks 78 | Thanks be to lasersox and Infininight over at the #textmate room on IRC (irc://irc.freenode.net/textmate) for all their help in cleaning up this here bundle, and for helping me to optimize my regex use in the language grammar. 79 | Thanks to Martin Kühl for his extensive additions to this project's snippets and commands. Also Infininight's work on updating the bundle to use the TextMate's new Ruby interface and Jeremy & Sylvain's work on supporting Go 1.0 has been invaluable. Their assistance and stewardship while I've been deep in the world of Objective-C is very much appreciated. 80 | 81 | === Contact Information 82 | 83 | You can contact me through github, or you can ping me on Twitter or alpha.app.net as 'alanQuatermain'. 84 | 85 | Happy coding :) 86 | -------------------------------------------------------------------------------- /Snippets/Case Clause.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | case ${1:condition}: 7 | ${0://body} 8 | name 9 | Case Clause 10 | scope 11 | source.go 12 | tabTrigger 13 | case 14 | uuid 15 | EA490E02-1982-4F35-BBE5-D0B3DBCF148C 16 | 17 | 18 | -------------------------------------------------------------------------------- /Snippets/Channel.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | chan ${1:valtype} 7 | name 8 | Channel 9 | scope 10 | source.go 11 | tabTrigger 12 | ch 13 | uuid 14 | C71F1625-B79B-463B-961D-D2071BF21821 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/Constant.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | const ${1:name}${2/(.+)/ /}${2:type} = ${0:value} 7 | name 8 | Constant 9 | scope 10 | source.go 11 | tabTrigger 12 | con 13 | uuid 14 | E3553899-14C9-4B7E-ABF5-A1C14A33808C 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/Constants.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | const ( 7 | ${1:name}${2/(.+)/ /}${2:type} = ${0:value} 8 | ) 9 | name 10 | Constants 11 | scope 12 | source.go 13 | tabTrigger 14 | cons 15 | uuid 16 | 7B2D69FC-DFEA-4548-91B7-4A698E63F22D 17 | 18 | 19 | -------------------------------------------------------------------------------- /Snippets/Default Clause.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | default: 7 | ${0://body} 8 | name 9 | Default Clause 10 | scope 11 | source.go 12 | tabTrigger 13 | def 14 | uuid 15 | C4732003-866C-466B-B72A-5FB209F46671 16 | 17 | 18 | -------------------------------------------------------------------------------- /Snippets/Deferred Call.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | defer ${1:func(${2:params}) { 7 | ${0:// body} 8 | \}(${3:${2/(.+)?/(?1:values)/}})} 9 | name 10 | Deferred Goroutine Call 11 | scope 12 | source.go 13 | tabTrigger 14 | de 15 | uuid 16 | 92CF0E27-7ED9-4F9B-8061-DD2B38D22893 17 | 18 | 19 | -------------------------------------------------------------------------------- /Snippets/Empty Interface.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | interface {} 7 | name 8 | Empty Interface 9 | scope 10 | source.go 11 | tabTrigger 12 | in 13 | uuid 14 | E5E46A13-E5D3-49A3-9BFF-082A9DC69C08 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/For Index Loop.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | for ${2:i} := 0; $2 < ${1:count}; ${3:$2++} { 7 | ${0:// body} 8 | } 9 | name 10 | For Index Loop 11 | scope 12 | source.go 13 | tabTrigger 14 | fori 15 | uuid 16 | 7DA0072A-BF35-413B-B4D9-B5C2B4D20FF2 17 | 18 | 19 | -------------------------------------------------------------------------------- /Snippets/For Loop.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | for ${1:condition}${1/(.+)/ /}{ 7 | ${0:// body} 8 | } 9 | name 10 | For Loop 11 | scope 12 | source.go 13 | tabTrigger 14 | for 15 | uuid 16 | D58425E7-F6E5-4249-8C57-277C4E38A5F4 17 | 18 | 19 | -------------------------------------------------------------------------------- /Snippets/For Range Loop.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | for ${2:name} := range ${1:collection} { 7 | ${0:// body} 8 | } 9 | name 10 | For Range Loop 11 | scope 12 | source.go 13 | tabTrigger 14 | forr 15 | uuid 16 | 8C557B1F-C1C5-4FC3-830E-9D51DE6CFA5A 17 | 18 | 19 | -------------------------------------------------------------------------------- /Snippets/Function Type.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | func(${4:params})${5/(.+)/ /}${5:type} 7 | name 8 | Function Type 9 | scope 10 | source.go 11 | tabTrigger 12 | fun 13 | uuid 14 | D6C5D7C0-06B6-4080-8E2B-8C646CADDE8C 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/Function w: result vars.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | func${3/(.+)/ /}${3:name}(${4:params}) (${5:type}) { 7 | ${0:// body} 8 | } 9 | name 10 | Function w/ result vars 11 | scope 12 | source.go 13 | tabTrigger 14 | funcv 15 | uuid 16 | 65FCDB2E-8AD1-4FF4-8E0E-DD4511A461F5 17 | 18 | 19 | -------------------------------------------------------------------------------- /Snippets/Function.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | func${3/(.+)/ /}${3:name}(${4:params})${5/(.+)/ /}${5:type} { 7 | ${0:// body} 8 | } 9 | name 10 | Function 11 | scope 12 | source.go 13 | tabTrigger 14 | func 15 | uuid 16 | E9B44CC5-B004-4793-B125-7E429FDCCE32 17 | 18 | 19 | -------------------------------------------------------------------------------- /Snippets/Goroutine Call.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | go ${1:func(${2:params}) { 7 | ${0:// body} 8 | \}(${3:${2/(.+)?/(?1:values)/}})} 9 | name 10 | Goroutine Call 11 | scope 12 | source.go 13 | tabTrigger 14 | go 15 | uuid 16 | 6B01E886-4CFA-476E-AE01-EFF406116978 17 | 18 | 19 | -------------------------------------------------------------------------------- /Snippets/If Statement.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | if ${1:condition}${1/(.+)/ /}{ 7 | ${0:// body} 8 | } 9 | name 10 | If Statement 11 | scope 12 | source.go 13 | tabTrigger 14 | if 15 | uuid 16 | AF797914-E5F7-4F2B-866B-852889C6A925 17 | 18 | 19 | -------------------------------------------------------------------------------- /Snippets/If err.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | if ${1:err} != nil { 7 | ${2:log.Fatal($1)} 8 | }${0} 9 | name 10 | If err 11 | scope 12 | source.go 13 | tabTrigger 14 | ife 15 | uuid 16 | 8C0BE817-6C6E-4927-85E5-9DA3FB8A7000 17 | 18 | 19 | -------------------------------------------------------------------------------- /Snippets/Import.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | import${2/(.+)/ /}${2:$1} "${1:package}" 7 | name 8 | Import 9 | scope 10 | source.go 11 | tabTrigger 12 | imp 13 | uuid 14 | 2DFA9510-6F88-4BC6-A409-DA4075DEA8FF 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/Imports.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | import ( 7 | "${0:package}" 8 | ) 9 | name 10 | Imports 11 | scope 12 | source.go 13 | tabTrigger 14 | imps 15 | uuid 16 | 5E6327B4-8BD5-4079-8B25-D8D3EF9E89FB 17 | 18 | 19 | -------------------------------------------------------------------------------- /Snippets/Init Function.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | func init() { 7 | ${0:// body} 8 | } 9 | name 10 | Init Function 11 | scope 12 | source.go 13 | tabTrigger 14 | init 15 | uuid 16 | 54394BD4-1FFE-440F-9D3D-2D44F3B1BCC6 17 | 18 | 19 | -------------------------------------------------------------------------------- /Snippets/Initialize.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | ${1:name} := ${0:value} 7 | name 8 | Initialize 9 | scope 10 | source.go 11 | tabTrigger 12 | : 13 | uuid 14 | FAE480BF-DF92-4B4F-8982-AB61CD05AD64 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/Interface.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | interface { 7 | ${0:method} 8 | } 9 | name 10 | Interface 11 | scope 12 | source.go 13 | tabTrigger 14 | int 15 | uuid 16 | 96C65CC5-19C3-4B73-A66B-F9C80B98DE54 17 | 18 | 19 | -------------------------------------------------------------------------------- /Snippets/Main Function.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | func main() { 7 | ${0:// body} 8 | } 9 | name 10 | Main Function 11 | scope 12 | source.go 13 | tabTrigger 14 | main 15 | uuid 16 | 18A04BC9-D37A-46B9-8C92-4E8D287A46E4 17 | 18 | 19 | -------------------------------------------------------------------------------- /Snippets/Make.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | ${1:name}${1/(.+)/ := /}make(${2:reftype}) 7 | name 8 | Make 9 | scope 10 | source.go 11 | tabTrigger 12 | mk 13 | uuid 14 | 56603467-E883-4DB7-9562-62B841DC07CF 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/Map.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | map[${1:keytype}]${2:valtype} 7 | name 8 | Map 9 | scope 10 | source.go 11 | tabTrigger 12 | map 13 | uuid 14 | 95F0EB07-61D5-4E0C-B610-BFD4A802A5C3 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/Method w: result vars.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | func (${1:receiver} ${2:type}) ${3:name}(${4:params}) (${5:type}) { 7 | ${0:// body} 8 | } 9 | name 10 | Method w/ result vars 11 | scope 12 | source.go 13 | tabTrigger 14 | methv 15 | uuid 16 | 0DF6CCE2-56DF-43EF-8EEE-BDFFEC38C244 17 | 18 | 19 | -------------------------------------------------------------------------------- /Snippets/Method.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | func (${1:receiver} ${2:type}) ${3:name}(${4:params})${5/(.+)/ /}${5:type} { 7 | ${0:// body} 8 | } 9 | name 10 | Method 11 | scope 12 | source.go 13 | tabTrigger 14 | meth 15 | uuid 16 | D8CF6ACF-85BB-4AAD-BFDE-DFD9D075FCF2 17 | 18 | 19 | -------------------------------------------------------------------------------- /Snippets/New.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | ${1:name}${1/(.+)/ := /}new(${2:type}) 7 | name 8 | New 9 | scope 10 | source.go 11 | tabTrigger 12 | new 13 | uuid 14 | 8FC95B21-86DE-4E94-889E-FE1472F1E25F 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/Package.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | ${1/^main$|(.+)/(?1:/* 7 | The $1 package implements ... bananas? 8 | */ 9 | )/}package ${1:main} 10 | name 11 | Package 12 | scope 13 | source.go 14 | tabTrigger 15 | pkg 16 | uuid 17 | CFE21C25-71DE-48A9-8FE6-2A40D8DF16EF 18 | 19 | 20 | -------------------------------------------------------------------------------- /Snippets/Pair.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | ${1:first}, ${0:second} 7 | name 8 | Pair 9 | scope 10 | source.go 11 | tabTrigger 12 | , 13 | uuid 14 | 0FC09B94-D4C1-4C21-8076-EE7075174926 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/Return Statement.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | return${1/(.+)/ /}${1:value} 7 | name 8 | Return Statement 9 | scope 10 | source.go 11 | tabTrigger 12 | ret 13 | uuid 14 | 4B3F378E-D9E8-4CCB-B537-96099B406511 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/Select Statement.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | select { 7 | case${0} 8 | } 9 | name 10 | Select Statement 11 | scope 12 | source.go 13 | tabTrigger 14 | sel 15 | uuid 16 | 26577C1F-0975-4A8F-BB89-375B0908FCA2 17 | 18 | 19 | -------------------------------------------------------------------------------- /Snippets/Send_Receive.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | ${1:channel}${1/(.+)/ /}<-${0:${1/(.+)?/(?1: value:channel)/)}} 7 | name 8 | Send/Receive 9 | scope 10 | source.go 11 | tabTrigger 12 | < 13 | uuid 14 | 0E515A1F-B6F7-4473-B4C6-D6485E7CD133 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/Slice.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | []${1:valtype} 7 | name 8 | Slice 9 | scope 10 | source.go 11 | tabTrigger 12 | [] 13 | uuid 14 | 22E438EE-F254-4FB3-B05E-BA59387E3F6F 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/Struct.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | struct { 7 | ${0:member} 8 | } 9 | name 10 | Struct 11 | scope 12 | source.go 13 | tabTrigger 14 | st 15 | uuid 16 | CC5D7F66-6BBC-4D9C-BC32-D569238523EB 17 | 18 | 19 | -------------------------------------------------------------------------------- /Snippets/Switch Statement.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | switch ${1:expression}${1/(.+)/ /}{ 7 | case${0} 8 | } 9 | name 10 | Switch Statement 11 | scope 12 | source.go 13 | tabTrigger 14 | sw 15 | uuid 16 | DE6B5489-7140-4954-AA78-6C4014525D38 17 | 18 | 19 | -------------------------------------------------------------------------------- /Snippets/Test.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | package ${1:`base="${TM_FILEPATH%_test.go}.go" 7 | if [[ -f "$base" ]] && grep -q '^package ' "$base" 8 | then grep -m1 '^package ' "$base"|cut -d' ' -f2 9 | else echo 'main' 10 | fi`} 11 | 12 | import ( 13 | "testing" 14 | ) 15 | 16 | func Test${2:${TM_DISPLAYNAME/^(.*?)(_test)?(\.go)?$/${1:/capitalize}/}}(t *testing.T) { 17 | $0t.Fatal("no test body") 18 | } 19 | name 20 | Test 21 | scope 22 | source.go 23 | tabTrigger 24 | test 25 | uuid 26 | C6F66AFB-B50B-45AF-B2B2-819CC3464E56 27 | 28 | 29 | -------------------------------------------------------------------------------- /Snippets/Type.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | type ${1:name} ${0:definition} 7 | name 8 | Type 9 | scope 10 | source.go 11 | tabTrigger 12 | type 13 | uuid 14 | 9E325583-D146-41A4-BA94-0B5BF91DEBF8 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/Types.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | type ( 7 | ${1:name} ${0:definition} 8 | ) 9 | name 10 | Types 11 | scope 12 | source.go 13 | tabTrigger 14 | types 15 | uuid 16 | F4CA0BAC-E987-4154-BCBA-35B2668D514D 17 | 18 | 19 | -------------------------------------------------------------------------------- /Snippets/Variable.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | var ${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value}} 7 | name 8 | Variable 9 | scope 10 | source.go 11 | tabTrigger 12 | var 13 | uuid 14 | E86778CD-D0DE-4E2E-AB13-740FA3E79814 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/Variables.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | var ( 7 | ${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value}} 8 | ) 9 | name 10 | Variables 11 | scope 12 | source.go 13 | tabTrigger 14 | vars 15 | uuid 16 | 113FC085-6E3C-432A-A2F1-D8BD54B8B49E 17 | 18 | 19 | -------------------------------------------------------------------------------- /Snippets/iota.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | iota 7 | keyEquivalent 8 | @i 9 | name 10 | Iota 11 | scope 12 | source.go 13 | uuid 14 | DCF037CD-EF51-41BA-A29B-3184FB48685F 15 | 16 | 17 | -------------------------------------------------------------------------------- /Support/gomate.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require "#{ENV['TM_SUPPORT_PATH']}/lib/escape" 4 | require "#{ENV['TM_SUPPORT_PATH']}/lib/exit_codes" 5 | require "#{ENV['TM_SUPPORT_PATH']}/lib/ui" 6 | require "#{ENV['TM_SUPPORT_PATH']}/lib/web_preview" 7 | require "#{ENV['TM_SUPPORT_PATH']}/lib/tm/executor" 8 | require "#{ENV['TM_SUPPORT_PATH']}/lib/tm/save_current_document" 9 | 10 | # TextMate's special GOPATH used in .tm_properties files prepended to the environment's GOPATH 11 | ENV['GOPATH'] = (ENV.has_key?('TM_GOPATH') ? ENV['TM_GOPATH'] : '') + 12 | (ENV.has_key?('GOPATH') ? ':' + ENV['GOPATH'] : '') 13 | 14 | module Go 15 | def Go::go(command, options={}) 16 | # TextMate's special TM_GO or expect 'go' on PATH 17 | go_cmd = ENV['TM_GO'] || 'go' 18 | TextMate.save_if_untitled('go') 19 | TextMate::Executor.make_project_master_current_document 20 | 21 | args = options[:args] ? options[:args] : [] 22 | opts = {:use_hashbang => false, :version_args => ['version'], :version_regex => /\Ago version (.*)/} 23 | opts[:verb] = options[:verb] if options[:verb] 24 | 25 | if command == 'test' && ENV['TM_FILENAME'] =~ /(_test)?(\.go)$/ 26 | basename = $` 27 | args.push("-v") 28 | args.push("#{basename}.go") 29 | args.push("#{basename}_test.go") 30 | opts[:chdir] = ENV['TM_DIRECTORY'] 31 | else 32 | # At this time, we will always run 'go' against a single file. In the future there may be new 33 | # commands that will invalidate this but until then, might as well start simple. 34 | args.push(ENV['TM_FILEPATH']) 35 | end 36 | args.push(opts) 37 | 38 | TextMate::Executor.run(go_cmd, command, *args) 39 | end 40 | 41 | def Go::godoc 42 | # TextMate's special TM_GODOC or expect 'godoc' on PATH 43 | godoc_cmd = ENV['TM_GODOC'] || 'godoc' 44 | term = STDIN.read.strip 45 | TextMate.save_if_untitled('go') 46 | 47 | if term.nil? || term.empty? 48 | term = TextMate::UI.request_string( :title => 'Go Documentation Search', 49 | :prompt => 'Enter a term to search for:', 50 | :button1 => 'Search') 51 | end 52 | 53 | TextMate.exit_show_tool_tip('Please select a term to look up.') if term.nil? || term.empty? 54 | 55 | args = [] 56 | args.push(godoc_cmd) 57 | args.push('-html') 58 | args.push('-tabwidth=0') 59 | args.concat term.split('.') 60 | 61 | out, err = TextMate::Process.run(*args) 62 | 63 | if err.nil? || err == '' 64 | html_header("Documentation for #{term}", "go") 65 | puts out 66 | html_footer 67 | TextMate.exit_show_html 68 | else 69 | TextMate.exit_show_tool_tip(err) 70 | end 71 | end 72 | 73 | def Go::gofmt 74 | # TextMate's special TM_GOFMT or expect 'gofmt' on PATH 75 | gofmt_cmd = ENV['TM_GOFMT'] || 'gofmt' 76 | TextMate.save_if_untitled('go') 77 | 78 | args = [] 79 | args.push(gofmt_cmd) 80 | args.push("-tabwidth=#{ENV['TM_TAB_SIZE']}") 81 | if ENV['TM_SOFT_TABS'] && ENV['TM_SOFT_TABS'] == 'YES' 82 | args.push('-tabs=false') 83 | else 84 | args.push('-tabs=true') 85 | end 86 | args.push(ENV['TM_FILEPATH']) 87 | 88 | out, err = TextMate::Process.run(*args) 89 | 90 | if err.nil? || err == '' 91 | puts out 92 | else 93 | args << {:use_hashbang => false, :version_args => ['version'], :version_regex => /\Ago version (.*)/} 94 | TextMate::Executor.run(*args) 95 | TextMate.exit_show_html 96 | end 97 | end 98 | end 99 | 100 | -------------------------------------------------------------------------------- /Support/icons/const.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlanQuatermain/go-tmbundle/0bdec37eded22e8416d046fe28e50d2c5c666798/Support/icons/const.png -------------------------------------------------------------------------------- /Support/icons/func.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlanQuatermain/go-tmbundle/0bdec37eded22e8416d046fe28e50d2c5c666798/Support/icons/func.png -------------------------------------------------------------------------------- /Support/icons/icons.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlanQuatermain/go-tmbundle/0bdec37eded22e8416d046fe28e50d2c5c666798/Support/icons/icons.psd -------------------------------------------------------------------------------- /Support/icons/package.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlanQuatermain/go-tmbundle/0bdec37eded22e8416d046fe28e50d2c5c666798/Support/icons/package.png -------------------------------------------------------------------------------- /Support/icons/type.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlanQuatermain/go-tmbundle/0bdec37eded22e8416d046fe28e50d2c5c666798/Support/icons/type.png -------------------------------------------------------------------------------- /Support/icons/var.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlanQuatermain/go-tmbundle/0bdec37eded22e8416d046fe28e50d2c5c666798/Support/icons/var.png -------------------------------------------------------------------------------- /Syntaxes/Go.tmLanguage: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | comment 6 | Go allows any Unicode character to be used in identifiers, so our identifier regex is: \b([[:alpha:]_]+[[:alnum:]_]*)\b 7 | cf. The Go Programming Language Specification <http://golang.org/doc/go_spec.html> 8 | fileTypes 9 | 10 | go 11 | 12 | firstLineMatch 13 | (?i)-[*]-\s*(mode:)?\s*go\s*-[*]- 14 | keyEquivalent 15 | ^~G 16 | name 17 | Go 18 | patterns 19 | 20 | 21 | include 22 | #receiver_function_declaration 23 | 24 | 25 | include 26 | #plain_function_declaration 27 | 28 | 29 | include 30 | #basic_things 31 | 32 | 33 | include 34 | #exported_variables 35 | 36 | 37 | begin 38 | ^[[:blank:]]*(import)\b\s+ 39 | beginCaptures 40 | 41 | 1 42 | 43 | name 44 | keyword.control.import.go 45 | 46 | 47 | end 48 | (?=(?://|/\*))|$ 49 | name 50 | meta.preprocessor.go.import 51 | patterns 52 | 53 | 54 | begin 55 | " 56 | beginCaptures 57 | 58 | 0 59 | 60 | name 61 | punctuation.definition.string.begin.go 62 | 63 | 64 | end 65 | " 66 | endCaptures 67 | 68 | 0 69 | 70 | name 71 | punctuation.definition.string.end.go 72 | 73 | 74 | name 75 | string.quoted.double.import.go 76 | 77 | 78 | 79 | 80 | include 81 | #block 82 | 83 | 84 | include 85 | #root_parens 86 | 87 | 88 | include 89 | #function_calls 90 | 91 | 92 | repository 93 | 94 | access 95 | 96 | match 97 | (?<=\.)[[:alpha:]_][[:alnum:]_]*\b(?!\s*\() 98 | name 99 | variable.other.dot-access.go 100 | 101 | basic_things 102 | 103 | patterns 104 | 105 | 106 | include 107 | #comments 108 | 109 | 110 | include 111 | #initializers 112 | 113 | 114 | include 115 | #access 116 | 117 | 118 | include 119 | #strings 120 | 121 | 122 | include 123 | #keywords 124 | 125 | 126 | 127 | block 128 | 129 | begin 130 | \{ 131 | beginCaptures 132 | 133 | 0 134 | 135 | name 136 | punctuation.section.block.begin.go 137 | 138 | 139 | end 140 | \} 141 | endCaptures 142 | 143 | 0 144 | 145 | name 146 | punctuation.section.block.end.go 147 | 148 | 149 | name 150 | meta.block.go 151 | patterns 152 | 153 | 154 | include 155 | #block_innards 156 | 157 | 158 | 159 | block_innards 160 | 161 | patterns 162 | 163 | 164 | include 165 | #function_block_innards 166 | 167 | 168 | include 169 | #exported_variables 170 | 171 | 172 | 173 | comments 174 | 175 | patterns 176 | 177 | 178 | captures 179 | 180 | 1 181 | 182 | name 183 | meta.toc-list.banner.block.go 184 | 185 | 186 | match 187 | ^/\* =(\s*.*?)\s*= \*/$\n? 188 | name 189 | comment.block.go 190 | 191 | 192 | begin 193 | /\* 194 | captures 195 | 196 | 0 197 | 198 | name 199 | punctuation.definition.comment.go 200 | 201 | 202 | end 203 | \*/ 204 | name 205 | comment.block.go 206 | 207 | 208 | match 209 | \*/.*\n 210 | name 211 | invalid.illegal.stray-comment-end.go 212 | 213 | 214 | captures 215 | 216 | 1 217 | 218 | name 219 | punctuation.definition.comment.go 220 | 221 | 2 222 | 223 | name 224 | meta.toc-list.banner.line.go 225 | 226 | 227 | match 228 | ^(//) =(\s*.*?)\s*=\s*$\n? 229 | name 230 | comment.line.double-slash.banner.go 231 | 232 | 233 | begin 234 | (^[ \t]+)?(?=//) 235 | beginCaptures 236 | 237 | 1 238 | 239 | name 240 | punctuation.whitespace.comment.leading.go 241 | 242 | 243 | end 244 | (?!\G) 245 | patterns 246 | 247 | 248 | begin 249 | // 250 | beginCaptures 251 | 252 | 0 253 | 254 | name 255 | punctuation.definition.comment.go 256 | 257 | 258 | end 259 | \n 260 | name 261 | comment.line.double-slash.go 262 | patterns 263 | 264 | 265 | match 266 | (?>\\\s*\n) 267 | name 268 | punctuation.separator.continuation.go 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | exported_variables 277 | 278 | comment 279 | This is kinda hacky, in order to get the 'var' scoped the right way again. 280 | match 281 | (?<=\s|\[\])([[:upper:]][[:alnum:]_]*)(?=\W+) 282 | name 283 | variable.exported.go 284 | 285 | fn_parens 286 | 287 | begin 288 | \( 289 | beginCaptures 290 | 291 | 0 292 | 293 | name 294 | punctuation.section.parens.begin.go 295 | 296 | 297 | end 298 | \) 299 | endCaptures 300 | 301 | 0 302 | 303 | name 304 | punctuation.section.parens.end.go 305 | 306 | 307 | name 308 | meta.parens.go 309 | patterns 310 | 311 | 312 | include 313 | #basic_things 314 | 315 | 316 | include 317 | #function_calls 318 | 319 | 320 | 321 | function_block 322 | 323 | begin 324 | \{ 325 | beginCaptures 326 | 327 | 0 328 | 329 | name 330 | punctuation.section.function-block.begin.go 331 | 332 | 333 | end 334 | \} 335 | endCaptures 336 | 337 | 0 338 | 339 | name 340 | punctuation.section.function-block.end.go 341 | 342 | 343 | name 344 | meta.block.go 345 | patterns 346 | 347 | 348 | include 349 | #function_block_innards 350 | 351 | 352 | 353 | function_block_innards 354 | 355 | patterns 356 | 357 | 358 | include 359 | #basic_things 360 | 361 | 362 | captures 363 | 364 | 1 365 | 366 | name 367 | punctuation.whitespace.support.function.leading.go 368 | 369 | 2 370 | 371 | name 372 | support.function.builtin.go 373 | 374 | 375 | match 376 | (\s*)\b(new|c(lose|ap)|p(anic|rint(ln)?)|len|make|append)(?:\b|\() 377 | 378 | 379 | include 380 | #function_block 381 | 382 | 383 | include 384 | #function_calls 385 | 386 | 387 | include 388 | #fn_parens 389 | 390 | 391 | 392 | function_calls 393 | 394 | captures 395 | 396 | 1 397 | 398 | name 399 | punctuation.whitespace.function-call.leading.go 400 | 401 | 2 402 | 403 | name 404 | support.function.any-method.go 405 | 406 | 3 407 | 408 | name 409 | punctuation.definition.parameters.go 410 | 411 | 412 | match 413 | (?x) 414 | (?: (?= \s ) (?:(?<=else|new|return) | (?<!\w)) (\s+) )? 415 | (\b 416 | (?!(for|if|else|switch|return)\s*\() 417 | (?:[[:alpha:]_][[:alnum:]_]*+\b) # method name 418 | ) 419 | \s*(\() 420 | 421 | name 422 | meta.function-call.go 423 | 424 | initializers 425 | 426 | patterns 427 | 428 | 429 | captures 430 | 431 | 1 432 | 433 | name 434 | keyword.control.go 435 | 436 | 2 437 | 438 | patterns 439 | 440 | 441 | match 442 | [[:alpha:]_][[:alnum:]_]* 443 | name 444 | variable.other.go 445 | 446 | 447 | 448 | 449 | comment 450 | This matches the 'var x' style of variable declaration. 451 | match 452 | ^[[:blank:]]*(var)\s+((?:[[:alpha:]_][[:alnum:]_]*)(?:,\s+[[:alpha:]_][[:alnum:]_]*)*) 453 | name 454 | meta.initialization.explicit.go 455 | 456 | 457 | captures 458 | 459 | 1 460 | 461 | patterns 462 | 463 | 464 | match 465 | [[:alpha:]_][[:alnum:]_]* 466 | name 467 | variable.other.go 468 | 469 | 470 | 471 | 2 472 | 473 | name 474 | keyword.operator.go 475 | 476 | 477 | comment 478 | This matches the 'x :=' style of variable declaration. 479 | match 480 | ((?:[[:alpha:]_][[:alnum:]_]*)(?:\s*,\s+[[:alpha:]_][[:alnum:]_]*)*)\s*(:=) 481 | name 482 | meta.initialization.short.go 483 | 484 | 485 | 486 | keywords 487 | 488 | patterns 489 | 490 | 491 | match 492 | \b(s(elect|witch)|c(ontinue|ase)|type|i(nterface|f|mport)|def(er|ault)|package|else|var|f(or|unc|allthrough)|r(eturn|ange)|go(to)?|break)\b 493 | name 494 | keyword.control.go 495 | 496 | 497 | match 498 | (\b|(?<=\]))(int(16|8|32|64)?|uint(16|8|32|64|ptr)?|float(32|64)|complex(64|128)|b(yte|ool)|string|error|struct)\b 499 | name 500 | storage.type.go 501 | 502 | 503 | match 504 | \b(c(onst|han)|map)\b 505 | name 506 | storage.modifier.go 507 | 508 | 509 | match 510 | \b(nil|true|false|iota)\b 511 | name 512 | constant.language.go 513 | 514 | 515 | match 516 | \b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)\b 517 | name 518 | constant.numeric.go 519 | 520 | 521 | match 522 | \<\- 523 | name 524 | keyword.operator.channel.go 525 | 526 | 527 | 528 | plain_function_declaration 529 | 530 | begin 531 | (?x) 532 | (^[[:blank:]]*(func)\s* 533 | (?: ([[:alpha:]_][[:alnum:]_]*)? ) # name of function is optional 534 | (?: \( ((?:[\[\]\w\d\s\/,._*&<>-]|(?:interface\{\}))*)? \) ) # required braces for parameters (even if empty) 535 | \s* 536 | (?: \(? ((?:[\[\]\w\d\s,._*&<>-]|(?:interface\{\}))*) \)? )? # optional return types, optionally within braces 537 | ) 538 | 539 | beginCaptures 540 | 541 | 1 542 | 543 | name 544 | meta.function.declaration.go 545 | 546 | 2 547 | 548 | name 549 | keyword.control.go 550 | 551 | 3 552 | 553 | name 554 | entity.name.function.go 555 | 556 | 4 557 | 558 | patterns 559 | 560 | 561 | match 562 | [[:alpha:]_][[:alnum:]_]* 563 | name 564 | variable.parameters.go 565 | 566 | 567 | 568 | 5 569 | 570 | patterns 571 | 572 | 573 | match 574 | [[:alpha:]_][[:alnum:]_]* 575 | name 576 | variable.return-types.go 577 | 578 | 579 | 580 | 581 | comment 582 | We scope all parenthesized alpha-numeric text as variable.parameters.go and variable.return-types.go, which is a bit lazy, as some of it is storage.type. 583 | end 584 | (?<=\}) 585 | name 586 | meta.function.plain.go 587 | patterns 588 | 589 | 590 | include 591 | #comments 592 | 593 | 594 | include 595 | #storage_type 596 | 597 | 598 | include 599 | #storage_modifier 600 | 601 | 602 | include 603 | #function_block 604 | 605 | 606 | 607 | receiver_function_declaration 608 | 609 | begin 610 | (?x) 611 | ( 612 | (func)\s* 613 | ( 614 | (?: \( ((?:[\[\]\w\d\s,._*&<>-]|(?:interface\{\}))*) \)\s+ ) # receiver variable declarations, in brackets 615 | (?: ([[:alpha:]_][[:alnum:]_]*)? ) # name of function is optional 616 | ) 617 | (?: \( ((?:[\[\]\w\d\s,._*&<>-]|(?:interface\{\}))*)? \) ) # required braces for parameters (even if empty) 618 | \s* 619 | (?: \(? ((?:[\[\]\w\d\s,._*&<>-]|(?:interface\{\}))*) \)? )? # optional return types, optionally within braces 620 | ) 621 | 622 | beginCaptures 623 | 624 | 1 625 | 626 | name 627 | meta.function.receiver.declaration.go 628 | 629 | 2 630 | 631 | name 632 | keyword.control.go 633 | 634 | 3 635 | 636 | name 637 | entity.name.function.go.full-name 638 | 639 | 4 640 | 641 | patterns 642 | 643 | 644 | match 645 | [[:alpha:]_][[:alnum:]_]* 646 | name 647 | variable.receiver.go 648 | 649 | 650 | 651 | 5 652 | 653 | name 654 | entity.name.function.go.name 655 | 656 | 6 657 | 658 | patterns 659 | 660 | 661 | match 662 | [[:alpha:]_][[:alnum:]_]* 663 | name 664 | variable.parameters.go 665 | 666 | 667 | 668 | 7 669 | 670 | patterns 671 | 672 | 673 | match 674 | [[:alpha:]_][[:alnum:]_]* 675 | name 676 | variable.return-types.go 677 | 678 | 679 | 680 | 681 | comment 682 | Version of above with support for declaring a receiver variable. 683 | end 684 | (?<=\}) 685 | name 686 | meta.function.receiver.go 687 | patterns 688 | 689 | 690 | include 691 | #comments 692 | 693 | 694 | include 695 | #storage_type 696 | 697 | 698 | include 699 | #storage_modifier 700 | 701 | 702 | include 703 | #function_block 704 | 705 | 706 | 707 | root_parens 708 | 709 | begin 710 | \( 711 | end 712 | (?<=\()(\))?|(?:\)) 713 | endCaptures 714 | 715 | 1 716 | 717 | name 718 | meta.parens.empty.go 719 | 720 | 721 | name 722 | meta.parens.go 723 | patterns 724 | 725 | 726 | include 727 | #basic_things 728 | 729 | 730 | include 731 | #exported_variables 732 | 733 | 734 | include 735 | #function_calls 736 | 737 | 738 | 739 | string_escaped_char 740 | 741 | patterns 742 | 743 | 744 | match 745 | \\(\\|[abfnrutv'"]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8}|[0-7]{3}) 746 | name 747 | constant.character.escape.go 748 | 749 | 750 | match 751 | \\. 752 | name 753 | invalid.illegal.unknown-escape.go 754 | 755 | 756 | 757 | string_placeholder 758 | 759 | patterns 760 | 761 | 762 | match 763 | (?x)% 764 | (\d+\$)? # field (argument #) 765 | [#0\- +']* # flags 766 | [,;:_]? # separator character (AltiVec) 767 | ((-?\d+)|\*(-?\d+\$)?)? # minimum field width 768 | (\.((-?\d+)|\*(-?\d+\$)?)?)? # precision 769 | [diouxXDOUeEfFgGaAcCsSpnvtTbyYhHmMzZq%] # conversion type 770 | 771 | name 772 | constant.other.placeholder.go 773 | 774 | 775 | match 776 | % 777 | name 778 | invalid.illegal.placeholder.go 779 | 780 | 781 | 782 | strings 783 | 784 | patterns 785 | 786 | 787 | begin 788 | " 789 | beginCaptures 790 | 791 | 0 792 | 793 | name 794 | punctuation.definition.string.begin.go 795 | 796 | 797 | end 798 | " 799 | endCaptures 800 | 801 | 0 802 | 803 | name 804 | punctuation.definition.string.end.go 805 | 806 | 807 | name 808 | string.quoted.double.go 809 | patterns 810 | 811 | 812 | include 813 | #string_placeholder 814 | 815 | 816 | include 817 | #string_escaped_char 818 | 819 | 820 | 821 | 822 | begin 823 | ' 824 | beginCaptures 825 | 826 | 0 827 | 828 | name 829 | punctuation.definition.string.begin.go 830 | 831 | 832 | end 833 | ' 834 | endCaptures 835 | 836 | 0 837 | 838 | name 839 | punctuation.definition.string.end.go 840 | 841 | 842 | name 843 | string.quoted.single.go 844 | patterns 845 | 846 | 847 | include 848 | #string_escaped_char 849 | 850 | 851 | 852 | 853 | begin 854 | ` 855 | beginCaptures 856 | 857 | 0 858 | 859 | name 860 | punctuation.definition.string.begin.go 861 | 862 | 863 | end 864 | ` 865 | endCaptures 866 | 867 | 0 868 | 869 | name 870 | punctuation.definition.string.end.go 871 | 872 | 873 | name 874 | string.quoted.raw.go 875 | 876 | 877 | 878 | 879 | scopeName 880 | source.go 881 | uuid 882 | 33100200-8916-4F78-8522-4362628C6889 883 | 884 | 885 | -------------------------------------------------------------------------------- /info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | contactEmailRot13 6 | wvzqbirl@znp.pbz 7 | contactName 8 | Jim Dovey 9 | description 10 | Support for the <a href="http://golang.org">Go programming language</a>. 11 | mainMenu 12 | 13 | excludedItems 14 | 15 | 214A69FB-0168-465E-AB51-D8C6C46BCF61 16 | 17 | items 18 | 19 | 0B3C3EB0-9F51-4997-A87D-ECA507D8E31E 20 | 0F6A8710-54FC-48F5-9D02-D093DA001D17 21 | 73628139-0077-4F09-9B72-77546D7C2D2D 22 | ------------------------------------ 23 | D3CD6B51-3A7E-4356-85F4-B76B8336BEF2 24 | 7BCFCFC8-9152-4638-8436-E17B0C754C8D 25 | ------------------------------------ 26 | B0271A46-F6EF-4D2F-95A6-EC067E69155C 27 | ------------------------------------ 28 | C64599DA-E362-4411-9782-58A9C7F1B05A 29 | 88695E43-E330-4A5A-9492-C604DBD10A27 30 | F3EDE714-207E-4E99-9542-DFAC245C5E44 31 | 4BE04FFA-DF1F-4A48-BAF6-6711544ECAC9 32 | 25CE5652-3DF2-478F-820B-965F6F7F57A4 33 | C2D3D065-3434-4AC0-BB50-5D8676052D1F 34 | 35 | submenus 36 | 37 | 25CE5652-3DF2-478F-820B-965F6F7F57A4 38 | 39 | items 40 | 41 | AF797914-E5F7-4F2B-866B-852889C6A925 42 | DE6B5489-7140-4954-AA78-6C4014525D38 43 | 26577C1F-0975-4A8F-BB89-375B0908FCA2 44 | EA490E02-1982-4F35-BBE5-D0B3DBCF148C 45 | C4732003-866C-466B-B72A-5FB209F46671 46 | ------------------------------------ 47 | D58425E7-F6E5-4249-8C57-277C4E38A5F4 48 | 7DA0072A-BF35-413B-B4D9-B5C2B4D20FF2 49 | 8C557B1F-C1C5-4FC3-830E-9D51DE6CFA5A 50 | ------------------------------------ 51 | 8C0BE817-6C6E-4927-85E5-9DA3FB8A7000 52 | 53 | name 54 | Control Flow 55 | 56 | 4BE04FFA-DF1F-4A48-BAF6-6711544ECAC9 57 | 58 | items 59 | 60 | FAE480BF-DF92-4B4F-8982-AB61CD05AD64 61 | 56603467-E883-4DB7-9562-62B841DC07CF 62 | 8FC95B21-86DE-4E94-889E-FE1472F1E25F 63 | DCF037CD-EF51-41BA-A29B-3184FB48685F 64 | 65 | name 66 | Initialization 67 | 68 | 88695E43-E330-4A5A-9492-C604DBD10A27 69 | 70 | items 71 | 72 | 9E325583-D146-41A4-BA94-0B5BF91DEBF8 73 | F4CA0BAC-E987-4154-BCBA-35B2668D514D 74 | E3553899-14C9-4B7E-ABF5-A1C14A33808C 75 | 7B2D69FC-DFEA-4548-91B7-4A698E63F22D 76 | E86778CD-D0DE-4E2E-AB13-740FA3E79814 77 | 113FC085-6E3C-432A-A2F1-D8BD54B8B49E 78 | E9B44CC5-B004-4793-B125-7E429FDCCE32 79 | 65FCDB2E-8AD1-4FF4-8E0E-DD4511A461F5 80 | D8CF6ACF-85BB-4AAD-BFDE-DFD9D075FCF2 81 | 0DF6CCE2-56DF-43EF-8EEE-BDFFEC38C244 82 | 83 | name 84 | Declaration 85 | 86 | C2D3D065-3434-4AC0-BB50-5D8676052D1F 87 | 88 | items 89 | 90 | 6B01E886-4CFA-476E-AE01-EFF406116978 91 | 92CF0E27-7ED9-4F9B-8061-DD2B38D22893 92 | 18A04BC9-D37A-46B9-8C92-4E8D287A46E4 93 | 54394BD4-1FFE-440F-9D3D-2D44F3B1BCC6 94 | ------------------------------------ 95 | 0FC09B94-D4C1-4C21-8076-EE7075174926 96 | 0E515A1F-B6F7-4473-B4C6-D6485E7CD133 97 | 4B3F378E-D9E8-4CCB-B537-96099B406511 98 | 99 | name 100 | Idioms 101 | 102 | C64599DA-E362-4411-9782-58A9C7F1B05A 103 | 104 | items 105 | 106 | CFE21C25-71DE-48A9-8FE6-2A40D8DF16EF 107 | 2DFA9510-6F88-4BC6-A409-DA4075DEA8FF 108 | 5E6327B4-8BD5-4079-8B25-D8D3EF9E89FB 109 | C6F66AFB-B50B-45AF-B2B2-819CC3464E56 110 | 111 | name 112 | Organization 113 | 114 | F3EDE714-207E-4E99-9542-DFAC245C5E44 115 | 116 | items 117 | 118 | E5E46A13-E5D3-49A3-9BFF-082A9DC69C08 119 | 96C65CC5-19C3-4B73-A66B-F9C80B98DE54 120 | CC5D7F66-6BBC-4D9C-BC32-D569238523EB 121 | 22E438EE-F254-4FB3-B05E-BA59387E3F6F 122 | 95F0EB07-61D5-4E0C-B610-BFD4A802A5C3 123 | C71F1625-B79B-463B-961D-D2071BF21821 124 | D6C5D7C0-06B6-4080-8E2B-8C646CADDE8C 125 | 126 | name 127 | Types 128 | 129 | 130 | 131 | name 132 | Go 133 | ordering 134 | 135 | 33100200-8916-4F78-8522-4362628C6889 136 | 05400837-EE8F-44D1-A636-3EEB0E82FFF5 137 | 160118A4-208D-4422-AFF0-0C21B5B78AAF 138 | 0B3C3EB0-9F51-4997-A87D-ECA507D8E31E 139 | 20810F68-79E2-4D36-B222-6374BDEAB7B9 140 | 0F6A8710-54FC-48F5-9D02-D093DA001D17 141 | 73628139-0077-4F09-9B72-77546D7C2D2D 142 | B0271A46-F6EF-4D2F-95A6-EC067E69155C 143 | 7BCFCFC8-9152-4638-8436-E17B0C754C8D 144 | CFE21C25-71DE-48A9-8FE6-2A40D8DF16EF 145 | 2DFA9510-6F88-4BC6-A409-DA4075DEA8FF 146 | 5E6327B4-8BD5-4079-8B25-D8D3EF9E89FB 147 | 9E325583-D146-41A4-BA94-0B5BF91DEBF8 148 | F4CA0BAC-E987-4154-BCBA-35B2668D514D 149 | E3553899-14C9-4B7E-ABF5-A1C14A33808C 150 | 7B2D69FC-DFEA-4548-91B7-4A698E63F22D 151 | E86778CD-D0DE-4E2E-AB13-740FA3E79814 152 | 113FC085-6E3C-432A-A2F1-D8BD54B8B49E 153 | E9B44CC5-B004-4793-B125-7E429FDCCE32 154 | 65FCDB2E-8AD1-4FF4-8E0E-DD4511A461F5 155 | D8CF6ACF-85BB-4AAD-BFDE-DFD9D075FCF2 156 | 0DF6CCE2-56DF-43EF-8EEE-BDFFEC38C244 157 | E5E46A13-E5D3-49A3-9BFF-082A9DC69C08 158 | 96C65CC5-19C3-4B73-A66B-F9C80B98DE54 159 | CC5D7F66-6BBC-4D9C-BC32-D569238523EB 160 | 22E438EE-F254-4FB3-B05E-BA59387E3F6F 161 | 95F0EB07-61D5-4E0C-B610-BFD4A802A5C3 162 | C71F1625-B79B-463B-961D-D2071BF21821 163 | D6C5D7C0-06B6-4080-8E2B-8C646CADDE8C 164 | FAE480BF-DF92-4B4F-8982-AB61CD05AD64 165 | 56603467-E883-4DB7-9562-62B841DC07CF 166 | 8FC95B21-86DE-4E94-889E-FE1472F1E25F 167 | DCF037CD-EF51-41BA-A29B-3184FB48685F 168 | AF797914-E5F7-4F2B-866B-852889C6A925 169 | DE6B5489-7140-4954-AA78-6C4014525D38 170 | 26577C1F-0975-4A8F-BB89-375B0908FCA2 171 | EA490E02-1982-4F35-BBE5-D0B3DBCF148C 172 | C4732003-866C-466B-B72A-5FB209F46671 173 | D58425E7-F6E5-4249-8C57-277C4E38A5F4 174 | 7DA0072A-BF35-413B-B4D9-B5C2B4D20FF2 175 | 8C557B1F-C1C5-4FC3-830E-9D51DE6CFA5A 176 | 6B01E886-4CFA-476E-AE01-EFF406116978 177 | 92CF0E27-7ED9-4F9B-8061-DD2B38D22893 178 | 18A04BC9-D37A-46B9-8C92-4E8D287A46E4 179 | 54394BD4-1FFE-440F-9D3D-2D44F3B1BCC6 180 | 0FC09B94-D4C1-4C21-8076-EE7075174926 181 | 0E515A1F-B6F7-4473-B4C6-D6485E7CD133 182 | 4B3F378E-D9E8-4CCB-B537-96099B406511 183 | 214A69FB-0168-465E-AB51-D8C6C46BCF61 184 | FE908865-7729-4926-9FAC-2D54895BEA48 185 | 186 | uuid 187 | 9A94FED7-9430-410F-9C6A-5B9D48A89180 188 | 189 | 190 | --------------------------------------------------------------------------------