'Modern Syntax can be used' in bulk

Hi all,

I have some objective-C files from a very old project which are being updated, and they are littered with calls like this:

NSString *myString = [myArray objectAtIndex:idx];

AppCode throws up a warning on all of these saying "Modern Syntax can be used", and lets me pick "Switch to [ ]" from the pop-up menu.

In case I'm missing it, is there any way to select an entire file and get it to make these syntax changes in bulk?  I seem to have to do them one at a time.


Cheers,
Corey.

3 comments
Comment actions Permalink

Hi Corey.

You can do it using the following steps:

  • use 'run inspection by name' action
  • find 'modern syntax can be used’
  • you’ll see the window with results and you can apply quick fix via selecting required text or applying it everywhere in the file when you're at the root of the tree
You can choose objects to analyze and apply this replacement: current file, all project, custom set of files.
0
Comment actions Permalink

Excellent, thanks, I had never used that feature before.

0
Comment actions Permalink

Hi Corey.

Also maybe you can find out some useful information in the article:
https://confluence.jetbrains.com/display/OBJC/Inspections

0

Please sign in to leave a comment.