Format On Save with Xcode behaviors.
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
調査の方向性
まず、issue の Command+S スクリプトにある Xcode の動作を、.cpp ファイルに対する clang-format -i および touch コマンドを含めて再現します。ファイルを外部で変更するのではなく、plugin から Xcode 内でフォーマットを呼び出せるか調査します。保存時に外部変更のダイアログを表示せず、かつディスク上の新しいバージョンを保持したままフォーマットできれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Hi, in order to allow "Format on Save" I avoid using extensions, but rather set new Xcode behavior hat run the following script upon "Command+S" (which replace the original file save):
My script extract the current file name presented by xcode, and perform clang-format on this file (see below), and it works just fine.
However, when the file is modified, I sometimes get the following message from xcode.
the file for the document at “/Users/me/file.cpp” has been modified by another application. There are also unsaved changes in Xcode. Do you want to keep the Xcode version or revert to the version on disk?
This happens because the file changed outside xcode ... and xcode probably cache the currently file being edited, so I'd like to avoid this message box and always take the newer file version from disk (select the "Revert" option instead of the other option of "Keep Xcode Version") . is it possible to avoid this message box ?
Thanks
#!/bin/sh
CDP=$(osascript -e 'tell application "Xcode"
activate
set current_document to last source document
set current_document_path to path of current_document
end tell ' )
if [[ $CDP == *.cpp ]]
then
/usr/local/bin/clang-format -i ${CDP}
touch ${CDP}
fi
P.S I'm aware this option doesn't related directly to the plugin, but if the plugin can somehow run clang-format from within the xcode, it may solve my problem and avoid this messagebox...
- 主要言語
- Objective-C++
- スター
- 807
- フォーク
- 102
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
mapbox/XcodeClangFormat のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 20/100
mapbox/XcodeClangFormat#61 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
mapbox/XcodeClangFormat#60 ·
-
OC怎么自定义代码规范规则? オープン
難易度 3/5 1〜2日 初心者へのやさしさ 25/100
mapbox/XcodeClangFormat#58 · コメント 1 件 ·
-
Not work on Xcode 12 オープン
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
mapbox/XcodeClangFormat#53 · コメント 34 件 · リアクション 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
mapbox/XcodeClangFormat#50 · コメント 4 件 ·
mapbox/XcodeClangFormat の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
OpenwaterHealth/openmotion-bloodflow-app#604 · コメント 1 件 ·
-
good first issue
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
rust-bitcoin/rust-bitcoin#6930 · コメント 1 件 ·
-
Solved site promotion gate fails on runner PHP patch drift (expects 8.2.33, runner installs 8.2.34) オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
Automattic/blocks-engine#2161 ·