Xcode9 expand/collapse if or switch {} is missing - xcode

when update to xcode9 ,i found the if or swith {} can not be fold,any one know how to fold "{}" in the read area

It Seems that, fold unfold options from sidebar on editor are removed in xCode 9.
But you can still do it from Editor.
by following way you can achieve the same. (You can always use the shortcuts)
Editor -> Code Folding -> Fold/Unfold
Hope this will help you out.

It's back in Xcode 10. You can turn it on from menu Xcode -> Preferences -> Text Editing tab -> Edit tab -> check show: code folding rebbon

Related

Xcode 9 Different Files Same Window

Does anyone know how to open two files in the same Xcode9 window (via tabs). This used to be so easy and intuitive, but it seems Apple has broken this functionality entirely.
I have used the Preference -> Navigation options and they have absolutely no affect on the behavior of the application.
Thanks for your help!
I don't know about tabs..., but I think that is because there is an easier way to open a second file on the same window...
Go to the file navigator
Search for the file you want to open
Option + Double click it and you will get a second editor for that file on the same window.
NOTE - My preferences are:
a. Preferences -> Navigation -> Optional Navigation = Uses Single Assistant Editor
b. Preferences -> Navigation -> Double Click Navigation = Uses Separate Window

How to make the tab names visible in the main codeblocks window?

I sorry to ask this lame question but I'ev searched everywhere else and could not find an answer.
The bar that show the tab name in codeblocks is gone.when I open multiple files I don't know which one I am in.This is bothering me.How can I get it back?
View -> Hide editor tabs, try it and I guess your tab name would come back.
View -> perspectives -> Code::Blocks default may also work.
Uncheck the View->Hide editor tabs option. It worked.

javascript visual studio 2013 indentation

I started playing around with javascript on Visual Studio 2013 and I couldn't figure out why it is not automatically positioning the cursor to the correct indentation level, instead always resetting back to the head. For example:
function foo(y) {
var f = function bar(x) {
|<-- cursor should be here, but ends up
|<-- over here
}
Does anyone else see this and how do you change it?
I have the typescript, nodejs plugin installed and that's about it.
With a bit of research, things started working for me. First check that, Tools -> Options -> Text Editor -> Javascript -> Tabs -> Indenting is set to 'Smart'. Next restart VS. For me restarting was important since, apparently, my file had some mixed line-endings and that was throwing off the indentation engine. Hope this helps someone.
In my case, the whole javascript formatting stopped working for every file, I could play with language options and restart VS, nothing helped, until I unchecked:
Tools -> Options -> Text Editor -> JavaScript/TypeScript -> Language Service -> Enable the new JavaScript language service
The editor returned to old school javascript formatting, which is sufficient for me.
I'm not sure if this applies to Visual Studio 2013 (the original question), but in 2015 at least, you can select the text in your JavaScript file you want to format, right-click, and then choose "Format Selection". There's a keyboard short-cut as well (Ctrl-K, Ctrl-F).
If you already have Tools -> Options -> Text Editor -> Javascript -> Tabs -> Indenting set to 'Smart', then try setting this option (the Indenting setting) to 'None' and click OK.
Open the Options back up and, set Tools -> Options -> Text Editor -> Javascript -> Tabs -> Indenting back to 'Smart', click OK.
Close and reopen the file you were working on.

Fix code indentation in Xcode

Once I start editing my code and adding for loops or if then statements my code indentation is whacked because the previous code maintains its former indentation instead of adjusting automatically.
In Visual Studio you can highlight code and select 'format selection' to fix these issues - is there anything similar in Xcode?
Before Xcode 9 (for Xcode 9 see default shortcut below)
select text
right-click
there's a "Re-indent selection" item in popup menu
In XCode 4 there is one more step:
select text
right-click
Click on "Structure"
there's a "Re-indent selection" and other options in popup menu
Or using the default shortcut:
select text
press ctrl + i
select text
press Control-I (the default keyboard shortcut)
You can do this automatically in Xcode 11
In Xcode 4.6.3, choose Editor > Structure > Re-Indent.
Shortcut: Control + I
(that's 'i', for 'indent')
This works on current selection. If no text selected, choose Edit > Select All (⌘+A) and then perform the re-indent.
(I'm more clearly restating the other answers)
These solutions re-indent text to the default xCode behaviors. To change these behaviors, go to xCode (v.4) > Preferences > Text Editing. Then to Indentation Tab.
Xcode 9.2:
You can select text and press ctrl + i to re-indent code.
You can do it in different ways, but these two are the easiest
select text ( ⌘ +a) :
Using shortcut -> (control)^ + i
Click on "Editor" -> Click on "Structure" -> Click on "Re-indent"
Sometimes setting Xcode global preferences is not enough for ^ + i to do its job accordingly. The reason is that project settings override global ones. You can set indentations for a concrete project or even a file.
Select project (or file) in the Navigation Pane. Then in File Inspector go to Text Settings section and set desired number of tabs or spaces for indents.
To quickly re-indent the whole file:
⌘+a
⌘+x
⌘+v
Edit: No longer working in Xcode 11
You can try my extension Swimat
https://github.com/Jintin/Swimat
It support format on selection.
Simple install by brew cask install swimat

Is there anyway to remove Design (and Split) views from Visual Studio 2005/2008?

I am trying to find a way to disable Design / Split views from appearing in Visual Studio. I figure there's no way to completely disable it, but I still can't seem to find a way to remove the shortcut (F7), or remove the buttons from the bottom bar.
The best I found was:
for HTML/ASPX - Options -> HTML Designer -> start pages in source view
for XAML -> Options -> Text Editor -> XAML -> Misc -> Always open documents in full XAML view
The keyboard shortcut is listed under View.ToggleDesigner.
I just want to be able to disable the Design view; the F7 shortcut is rather handy for swapping between source and code behind when doing web development.
Short blog post here apparently has an answer for this problem
http://renaissauce.com/thoughts/visual-studio-2008-tip-remove-the-design-split-source-button-bar/
You should be able to delete the keyboard assignment for F7 in the Keyboard Customization screen. All hotkey assignments are customizable AFAIK.
I doubt there's any way to get rid of the buttons on the UI.
Here is a solution for XAML

Resources