<commit_before><?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>beforeRunningCommand</key>
	<string>nop</string>
	<key>command</key>
	<string>#!/usr/bin/env ruby18

require ENV['TM_SUPPORT_PATH'] + '/lib/textmate'
require ENV['TM_SUPPORT_PATH'] + '/lib/tm/process'
require ENV['TM_SUPPORT_PATH'] + '/lib/tm/save_current_document'

# TextMate's special TM_GODEF or expect 'godef' on PATH
godef_cmd = ENV['TM_GODEF'] || 'godef'

TextMate.save_if_untitled('go')

# load current document from stdin
document = []
while line = $stdin.gets
  document.push(line)
end

# byte offset of cursor position from the beginning of file
cursor = document[ 0, ENV['TM_LINE_NUMBER'].to_i - 1].join().length + ENV['TM_LINE_INDEX'].to_i

args = []
args.push(godef_cmd)
args.push('-f')
args.push(ENV['TM_FILEPATH'])
args.push('-o')
args.push("#{cursor}")

# /usr/local/Cellar/go/1.7.1/libexec/src/database/sql/sql.go:960:15
out, err = TextMate::Process.run(*args)

if err.nil? || err == ''
  file_details = out.split(':')
  TextMate.go_to(:file =&gt; file_details[0],
                 :line =&gt; file_details[1],
                 :column =&gt; file_details[2].to_i)
elsif err.casecmp "godef: no identifier found";
  require "#{ENV['TM_SUPPORT_PATH']}/lib/ui.rb"
  package = TextMate::UI.request_string :title =&gt; "Open Package", :default =&gt; '', :prompt =&gt; "Which package do you wish to open?"
  #TODO: Find and open package
else
  TextMate.exit_show_tool_tip(err)
end</string>
	<key>input</key>
	<string>selection</string>
	<key>inputFormat</key>
	<string>text</string>
	<key>keyEquivalent</key>
	<string>@D</string>
	<key>name</key>
	<string>Go to Definition</string>
	<key>outputCaret</key>
	<string>afterOutput</string>
	<key>outputFormat</key>
	<string>text</string>
	<key>outputLocation</key>
	<string>toolTip</string>
	<key>requiredCommands</key>
	<array>
		<dict>
			<key>command</key>
			<string>godef</string>
			<key>moreInfoURL</key>
			<string>https://github.com/rogpeppe/godef</string>
			<key>variable</key>
			<string>TM_GODEF</string>
		</dict>
	</array>
	<key>scope</key>
	<string>source.go</string>
	<key>uuid</key><commit_msg>Def: Follow symbolic links and change key to no longer collide with 'Open Package'. Merge branch 'sleetdrop/godef-follow-symbolic-link'<commit_after><?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>beforeRunningCommand</key>
	<string>nop</string>
	<key>command</key>
	<string>#!/usr/bin/env ruby18

require ENV['TM_SUPPORT_PATH'] + '/lib/textmate'
require ENV['TM_SUPPORT_PATH'] + '/lib/tm/process'
require ENV['TM_SUPPORT_PATH'] + '/lib/tm/save_current_document'
require 'pathname'

# TextMate's special TM_GODEF or expect 'godef' on PATH
godef_cmd = ENV['TM_GODEF'] || 'godef'

TextMate.save_if_untitled('go')

# load current document from stdin
document = []
while line = $stdin.gets
  document.push(line)
end

# byte offset of cursor position from the beginning of file
cursor = document[ 0, ENV['TM_LINE_NUMBER'].to_i - 1].join().length + ENV['TM_LINE_INDEX'].to_i

args = []
args.push(godef_cmd)
args.push('-f')
args.push(ENV['TM_FILEPATH'])
args.push('-o')
args.push("#{cursor}")

# /usr/local/Cellar/go/1.7.1/libexec/src/database/sql/sql.go:960:15
out, err = TextMate::Process.run(*args)

if err.nil? || err == ''
  file_details = out.split(':')
  file = Pathname.new(file_details[0]).realpath
  TextMate.go_to(:file =&gt; file,
                 :line =&gt; file_details[1],
                 :column =&gt; file_details[2].to_i)
elsif err.casecmp "godef: no identifier found";
  require "#{ENV['TM_SUPPORT_PATH']}/lib/ui.rb"
  package = TextMate::UI.request_string :title =&gt; "Open Package", :default =&gt; '', :prompt =&gt; "Which package do you wish to open?"
  #TODO: Find and open package
else
  TextMate.exit_show_tool_tip(err)
end</string>
	<key>input</key>
	<string>selection</string>
	<key>inputFormat</key>
	<string>text</string>
	<key>keyEquivalent</key>
	<string>^.</string>
	<key>name</key>
	<string>Go to Definition</string>
	<key>outputCaret</key>
	<string>afterOutput</string>
	<key>outputFormat</key>
	<string>text</string>
	<key>outputLocation</key>
	<string>toolTip</string>
	<key>requiredCommands</key>
	<array>
		<dict>
			<key>command</key>
			<string>godef</string>
			<key>moreInfoURL</key>
			<string>https://github.com/rogpeppe/godef</string>
			<key>variable</key>
			<string>TM_GODEF</string>
		</dict>
	</array>
	<key>scope</key>
	<string>source.go</string>
	<key>uuid</key>
{'fraction_non_alphanumeric': 0.1876595744680851, 'fraction_numerical': 0.010212765957446808, 'mean_word_length': 4.87625, 'pattern_counts': {'":': 0, '<': 131, '<?xml version=': 2, '>': 131, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4294894', 'n_tokens_mistral': 1893, 'n_tokens_neox': 1796, 'n_words': 325}