Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Side by Side Diff: third_party/clang_format/scripts/clang-format-bbedit.applescript

Issue 135773003: Revert of Revert of Add clang-format binaries and scripts for all platforms (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 -- In this file, change "/path/to/" to the path where you installed clang-format
2 -- and save it to ~/Library/Application Support/BBEdit/Scripts. You can then
3 -- select the script from the Script menu and clang-format will format the
4 -- selection. Note that you can rename the menu item by renaming the script, and
5 -- can assign the menu item a keyboard shortcut in the BBEdit preferences, under
6 -- Menus & Shortcuts.
7 on urlToPOSIXPath(theURL)
8 return do shell script "python -c \"import urllib, urlparse, sys; print urllib.unquote(urlparse.urlparse(sys.argv[1])[2])\" " & quoted form of theURL
9 end urlToPOSIXPath
10
11 tell application "BBEdit"
12 set selectionOffset to characterOffset of selection
13 set selectionLength to length of selection
14 set fileURL to URL of text document 1
15 end tell
16
17 set filePath to urlToPOSIXPath(fileURL)
18 set newContents to do shell script "/path/to/clang-format -offset=" & selectionO ffset & " -length=" & selectionLength & " " & quoted form of filePath
19
20 tell application "BBEdit"
21 -- "set contents of text document 1 to newContents" scrolls to the botto m while
22 -- replacing a selection flashes a bit but doesn't affect the scroll pos ition.
23 set currentLength to length of contents of text document 1
24 select characters 1 thru currentLength of text document 1
25 set text of selection to newContents
26 select characters selectionOffset thru (selectionOffset + selectionLengt h - 1) of text document 1
27 end tell
OLDNEW
« no previous file with comments | « third_party/clang_format/scripts/clang-format.py ('k') | third_party/clang_format/scripts/clang-format-diff.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698