XCode indents method chaining like this:
xcode method chaining indentation
However if I press auto-format on appcode, it formats it in a weird way:
appcode method chaining indentation
Does appcode have a configuration in the code-style to fix this? When I look into their coding style for swift, I can't seem to find the configuration to change this behavior.
Anyone know a way to solve this? Thanks.
EDIT:
Another more convenient option is to use https://plugins.jetbrains.com/plugin/7177-file-watchers
with next conf:
More in docs:
https://www.jetbrains.com/help/idea/using-file-watchers.html#showFileWatcherInfoInEditor
PREVIOUS:
AppCode issue is very old...
So i solved it using https://github.com/nicklockwood/SwiftFormat :
brew install swiftformat
Add External Tools
(program: /path/to/swiftformat, arguments: $FilePath$, working directory: $ProjectFileDir):
Add KeyMap to your taste:
Related
image showing the indentation problem
I am using vscode for programming in java and for auto-indentation, I am using "prettier". I have applied all the necessary settings in the preferences menu like "Format on Save" and "Default code formatter", but still vscode fails to indent properly the if-else statement as shown in the image. Any suggestion is appreciated. Thanks in advance.
Try using java prettier formatter
I have noticed that the coding style in Swift appears to be to put braces on the same line as a method signature or if statement etc. Without getting into a debate about which is right or wrong, my aim is simply tom get Xcode to put the braces on a new line when it does its auto completion and for the new file templates.
I've tried the advice here and it doesn't work: https://forums.developer.apple.com/thread/23087
I'm using Xcode 8.1 on Sierra.
Has anyone else been able to get this to work?
Thanks,
Alan
You can use below methods in conjunction to accomplish this task.
ClangFormat and Uncrustify
Above method will only change the default statement templates and not the inbuilt methods formatting. (i.e autofilled viewDidLoad() method will still have the braces in the same line.) For this you should consider using these plugins. They have options to save the file with specified format.
(UPDATE Snippet Edit no longer works)
Snippet Edit
Snippet Edit is a small program that is used to edit the Xcode's standard code snippets. We have to do this way because there is no direct way to change the code style in Xcode settings and XCCodeSenseFormattingOptions is not supported since Xcode 4
You can follow below screenshot for reference. Remember to restart Xcode once you are done with editing.
So, I started learning with the 3.0 RC1 version of the Godot Engine and I noticed, that code completion isn't working. No suggestions, no completions, nothing. Only highlighting and bracket completion works. Is that because of the RC1 or am I missing something? Code completion is enable in editor settings.
Thanks alot.
Greetings, Nils
Since Godot 3.1 you can use typed variables in GDScript like this:
var myTexture : ImageTexture
And then autocomplete will work a little better for those. Otherwise Godot can not always figure out what type your variable is.
Solved this myself. I just weren't writing the code inside the scene functions.
I have noticed that the coding style in Swift appears to be to put braces on the same line as a method signature or if statement etc. Without getting into a debate about which is right or wrong, my aim is simply tom get Xcode to put the braces on a new line when it does its auto completion and for the new file templates.
I've tried the advice here and it doesn't work: https://forums.developer.apple.com/thread/23087
I'm using Xcode 8.1 on Sierra.
Has anyone else been able to get this to work?
Thanks,
Alan
You can use below methods in conjunction to accomplish this task.
ClangFormat and Uncrustify
Above method will only change the default statement templates and not the inbuilt methods formatting. (i.e autofilled viewDidLoad() method will still have the braces in the same line.) For this you should consider using these plugins. They have options to save the file with specified format.
(UPDATE Snippet Edit no longer works)
Snippet Edit
Snippet Edit is a small program that is used to edit the Xcode's standard code snippets. We have to do this way because there is no direct way to change the code style in Xcode settings and XCCodeSenseFormattingOptions is not supported since Xcode 4
You can follow below screenshot for reference. Remember to restart Xcode once you are done with editing.
I know it is possible to increase or decrease indentation of a block using n>> like in Vim. This used to work on Vrapper in my environment until recently, but now it is no longer smart, converting tabs to spaces, and not respecting my default tab width.
I have tried uninstalling and reinstalling the plugin, and making .vrapperrc look similar to my .vimrc. Neither attempts made any difference.
A friend helped out with a suggestion that worked. It had nothing to do with smartindent, or shiftwidth. Apparently :set expandtab is the default setting. Using :set noexpandtab took care of this for me.
(I use tabs, not spaces, let us not do that war. :-)
I have found similar behaviour with vrapper. As #romainl suggested, I took a look at the issue tracker and found this issue.
Using set sw=4 resolved my indenting issue.
I also use Eclipse + pydev + vrapper, set sw=4 is the perfect solution to the problem. And tabs is not recommended by python.