Skip to content

Instantly share code, notes, and snippets.

@ordovician
Last active October 3, 2018 23:18
Show Gist options
  • Save ordovician/9427938 to your computer and use it in GitHub Desktop.
Save ordovician/9427938 to your computer and use it in GitHub Desktop.
[Text Mate Bundle for Go] Method, variable and function completion for the Go language written in Julia. Put this in a TextMate bundle. Currently too slow to be practical due to slow Julia startuptime #tmbundle #go #plugin
#!/usr/bin/env julia
using PList
import GoTMSupport
bundle_support = ENV["TM_BUNDLE_SUPPORT"]
dialog = ENV["DIALOG"]
gocode = ENV["TM_GOCODE"]
filepath = ENV["TM_FILEPATH"]
row = int(ENV["TM_LINE_NUMBER"])
col = int(ENV["TM_LINE_INDEX"]) + 1
function register_icons()
icons = icon_plist()
run(`$dialog images --register $icons`)
end
function icon_plist()
writeplist_string(map({"const", "func", "package", "type", "var"}) do v
{v => string(bundle_support, "/icons/$v.png")}
end)
end
suggestions = GoTMSupport.completion_choices_plist(filepath, row, col, gocode)
register_icons()
# suggestions = "( { display = law; }, { display = laws; } )"
print(readall(`$dialog popup --suggestions $suggestions`))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment