benoitsan / BBUncrustifyPlugin-Xcode

Xcode plugin to format source code using ClangFormat or Uncrustify
MIT License
1.19k stars 150 forks source link

This plugin doesn't work completely since Xcode 9 #137

Closed xingheng closed 5 years ago

xingheng commented 7 years ago

The Format Selected Files feature doesn't work since issue #135, the latter Format Active File and Format Selected Lines becomes disabled state since Xcode 9, it causes by the [XCFXcodeFormatter currentSourceCodeDocument] instance is nil. I dig it into the kernel case and compare the result between Xcode 8 and Xcode 9, it seems the editor view's class type changed.

According to the Accessibility Inspector's result, Xcode 8 uses the DVTSourceTextView, 9 uses the SourceEditor.SourceEditorContentView.

XCFXcodeFormatter couldn't get the NSDocument subclass instance anymore in Xcode 9, I tried my best to fix it but failed. :(

Are there any solutions/replacements for this? Please help!

loveuqian commented 7 years ago

@xingheng https://github.com/mapbox/XcodeClangFormat

xingheng commented 7 years ago

Thanks @loveuqian , I just built a new code format script code base on uncrustify, check it from here.

xingheng commented 5 years ago

Closed as this repository isn't active anymore.