Skip to content

Commit

Permalink
Fixed a path error in the Validate Syntax command
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.textmate.org/trunk/Bundles/ActionScript.tmbundle@8151 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
  • Loading branch information
Ale Muñoz committed Sep 11, 2007
1 parent 1b4da51 commit b41233d
Showing 1 changed file with 25 additions and 26 deletions.
51 changes: 25 additions & 26 deletions Commands/Validate Syntax.tmCommand
Expand Up @@ -20,38 +20,37 @@ stdin, stdout, stderr = Open3.popen3(cmd)
warnings = []
errors = []
while err = stderr.gets
if err[0, 10] == 'Warning : '
warnings.push(err.chomp)
else
m = /(.+):([0-9]+): characters ([0-9]+)-([0-9]+) : (.+)/.match(err)
if m != nil
a = "txmt://open?url=file://#{filename}&line=#{m[2]}&column=#{m[3].to_i + 1}"
err = "<a href=\"#{a}\">#{File.basename(m[1])}, Line: #{m[2]} Column: #{m[3].to_i + 1} - #{m[5]}</a>"
if err[0, 10] == 'Warning : '
warnings.push(err.chomp)
else
m = /(.+):([0-9]+): characters ([0-9]+)-([0-9]+) : (.+)/.match(err)
if m != nil
if /^\//.match(m[1])
real_path = m[1]
else
real_path = Dir.pwd + "/" + m[1]
end
errors.push(err.chomp)
a = "txmt://open?url=file://#{real_path}&line=#{m[2]}&column=#{m[3].to_i + 1}"
err = "<a href=\"#{a}\">#{File.basename(m[1])}, Line: #{m[2]} Column: #{m[3].to_i + 1} - #{m[5]}</a>"
end
errors.push(err.chomp)
end
end
if errors.empty? && warnings.empty?
puts "Syntax Ok"
TextMate.exit_show_tool_tip
else
html_header("Validating Syntax for #{File.basename(filename)}","Validate Syntax")
if !errors.empty?
#puts "#{errors.uniq.join('</p><p>')} <br/> <pre>#{cmd}</pre>", "Errors:"
puts "<h2>Errors</h2>"
puts errors
end
if !warnings.empty?
#puts "#{warnings.uniq.join('</p><p>')} <br/> <pre>#{cmd}</pre>", "Warnings:"
puts "<h2>Warnings</h2>"
puts warnings
end
if errors.empty? && warnings.empty?
puts "Syntax Ok"
TextMate.exit_show_tool_tip
else
html_header("Validating Syntax for #{File.basename(filename)}","Validate Syntax")
if !errors.empty?
puts "<h2>Errors</h2>"
puts errors
end
if !warnings.empty?
puts "<h2>Warnings</h2>"
puts warnings
end
html_footer
TextMate.exit_show_html
html_footer
TextMate.exit_show_html
end</string>
<key>input</key>
<string>none</string>
Expand All @@ -60,7 +59,7 @@ end</string>
<key>name</key>
<string>Validate Syntax</string>
<key>output</key>
<string>openAsNewDocument</string>
<string>discard</string>
<key>scope</key>
<string>source.actionscript</string>
<key>uuid</key>
Expand Down

0 comments on commit b41233d

Please sign in to comment.