Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show error if clang-format fails #2

Merged
merged 1 commit into from
Jun 21, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion xcode-clang-format.applescript
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,13 @@ tell application "Xcode"

set _path to path of _document

set _result to do shell script "/usr/local/bin/clang-format -lines=" & item 1 of _range & ":" & item 2 of _range & " " & quoted form of _path & "> /tmp/xcode-clang-format.tmp"
try
do shell script "/usr/local/bin/clang-format -lines=" & item 1 of _range & ":" & item 2 of _range & " " & quoted form of _path & "> /tmp/xcode-clang-format.tmp"
on error error_message
display alert "clang-format failed" message error_message buttons {"OK"} default button "OK"
return
end try

set _result to read POSIX file "/tmp/xcode-clang-format.tmp"

set _final_lines to length of paragraphs in _result
Expand Down