Xcode 5 has a nice diff system. But for the life of me, I cannot get it to diff two files that aren't in a repository. I just want to use it to compare any two arbitrary files, but when I open one file, and go to the version editor button, the two half windows say: "no editor"
Any thoughts?
Choose Xcode > Open Developer Tool > FileMerge from the menu bar and you'll get an app that can show you a comparison view much like the one in the Xcode version editor.
Related
I know this feature was available previously. Selecting 2 files inside a project, right clicking them and do a diff on both files. This does not work anymore on build 3103. After selecting both files, I right click and then one file gets deselected. Is there a fix for this?
This appears to be a bug, but it only appears under certain conditions. I tested Build 3103 (the most recent public build) and the latest dev build 3111 (just released today, in fact) on OS X 10.10.5. First I picked two random files in one of the folders of my project that were not already open, clicked to select one, held down ⌘ and clicked to select the other, then right-clicked on one and selected Diff Files.... The diff view opened up just fine in both 3103 and 3111.
However, if one or both of the files was already open in Sublime, it could not be selected in the sidebar in 3103, and therefore the Diff Files command wasn't accessible. Diffing worked just fine on open files in Build 3111.
So, if you're a registered user (and you really should be if you're using Sublime long-term or for commercial purposes), just download Build 3111 (or whatever the most recent dev build is when you read this) and you'll be all set.
Is there a way to save the current 'workspace' in Xcode and/or create keyboard shortcuts for different workspaces? Not the workspace as xcode defines it (https://developer.apple.com/library/ios/featuredarticles/XcodeConcepts/Concept-Workspace.html), but rather the open files and split panels etc.
Yes, there is a way. You can "Create Snapshot" from the File menu. Give the snapshot a name. The next time you open XCode it should be in the state you left it.
Actually, scratch that. I just tested and it's not even necessary. If I open multiple tabs and then close Xcode, when I reopen Xcode the tabs are still there. Is that what you mean?
I am using OS X 10.9 (Mavericks) and need to work on a Perl project. I enjoy using TextMate, Atom, and BBEdit, but would like to try using Xcode instead, as it has good integration with git, a clean look, and I am already intimately familiar with the UI and syntax highlighting colour scheme.
Is it possible to use Xcode as an IDE to develop and run Perl scripts, in a way that puts it on par, or ahead of, existing text editors?
Update
I used Xcode 5 as an IDE for Perl for more than a month, and found it an excellent alternative to regular text editors like Atom and TextMate. However, like pure text editors, Xcode lacks support for debugging in Perl. I have since discovered Komodo IDE, a really nice IDE for Perl (and similar languages) that supports graphical Perl debugging, plus remote Perl debugging. I have since switched from using Xcode for Perl development to using Komodo IDE.
After some experimentation, it seems that Xcode makes for a fairly decent environment for developing Perl. Here is a screenshot of Xcode showing some Perl, project navigator, Git integration, and command-line output from a Perl script, as run by Xcode.
Xcode 5's built-in syntax highlighting works fine with Perl (.pl and .pm) files, right out of the box. But to use Xcode to write Perl more efficiently, you'll want to set up a new Xcode project:
Create a new Xcode workspace (File > New > Workspace) and select the folder you want to use for the Perl project.
Enable the Xcode navigator, so you can see the files in your project (View > Navigators > Show Navigators). Notice that Xcode does not show you a list of files in the workspace folder by default. If you're reading this, you're probably already an Xcode user, already knew that.
Manually add any files, or folders (groups, in Xcode parlance), that you want to see in the project (right-click on the Project Navigator pane and select Add files to "Project Name). Create groups to mirror your folder structure and add any files in subfolders to the groups. This can be a bit of work, depending on the size of your Perl project, but once you're set up it should not change much.
Click on your files in the Project Navigator to view the code. If you are using a Git or Subversion, Xcode will generate diffs as normal in the Xcode version editor.
To get your Perl script running when you hit Cmd-R:
Create a new scheme (Product > Scheme > New Scheme), configure Target to None and assign a name like Run Perl.
After creating the scheme, hit Edit Scheme.
In the Run perl scheme, set the Executable to /usr/bin/perl (select Other then press Shift-Cmd-G, enter /usr/bin/perl, and press Choose).
Go to the Arguments tab and ensure that your main script is the first argument. Add more arguments and environment variables as necessary.
Go to the Options tab and set Use custom working directory to your project folder. Deselect XPC services and any other options related to iOS or OS X development.
Press OK and when you press Cmd-R in Xcode, Xcode will call Perl, run your script, and show you the output.
To get Perl snippets and templates in Xcode, see How to create project templates in Xcode 4.
Extra tips:
If you are working with files that have extensions for an language that Xcode does not recognise, such as .sql files, you may be able to use the generic syntax highlighting. Go to Editor > Syntax Highlighting > Generic.
I'm new to XCode and Objective-C programming. I have used WebStorm, IntelliJ, Netbeans, and Eclipse. They all support something like this:
Notice the colors on the left that indicate what's changed locally. Clicking on those will show me what it was before and allow me to reset the local copy to what it was before. Very useful and I do it all the time.
Obviously, with iOS programming, I want to use XCode, but I really want to have those indicators. All I see with XCode is this:
Notice that there's no indicator at all...
Note: I am not talking about being able to open a git diff tool, even if it's built into XCode. I am looking for the simplicity that all the other IDEs give me...
The closest thing in Xcode is the version editor. Choose View > Version Editor > Show Version Editor to show the version editor. The version editor shows your local copy and the last committed version of the file side by side and highlights the changes between the two versions.
I want a nice graphical version of git log -p some/file.rb on my Mac. Tower 1.2 boasts a new File History view, but that just shows two dropdowns with SHA1s to compare; it's slightly less useful than a MediaWiki "compare versions" history (it doesn't even show commit messages).
I can't find anything in GitNub or Gitti that does this. GitX does it about as well as GitHub, but it leaves me wishing I could just scroll up and down to see the diffs instead of having to click each commit. Is there a better tool?
I would give SourceTree a try. It has a nice and powerful GUI.
I am used to and like how Netbeans shows file history, so I just create a project in netbeans with the option PHP Application with Existing Sources, now you can enjoy per file history and graphical diff of each commit, like so:
Locate your file in projects pane, on the left
Right click > Git > Show History
Choose Diff From 2 buttons on the left, Summary and Diff
Now tap each commit