whenever compile scripts in xcode they get formatted all weird. this has been happening ever since i upgraded to leopard and xcode 3. When i compile the applescript sometimes in changes my position in the window (it’ll scroll down to the end by itself), or it taks away spaces, or turns all the text black. i’ve tried reinstalling xcode, but that did nothing. Here are some images…
I cant say I’ve ever seen this kind of problem before. From experience with other applications freaking out, I would first suggest trying to change the default font Xcode uses.
You can do this by going to Xcode > Preferences > Fonts & Colors.
The default is Monaco. Try changing it to a similar font like Helvetica or Arial.
What I’m getting at is maybe you just have a corrupt font cache file somewhere. Changing it to a new font would fix the problem most likely if that is the case.
i changed the font to verdana which is the font used in script editor which does not have this problem. But yeah, it didn’t work. It’s not as severe, but it’s still there. any other ideas?
Thats really strange. With it being application specific, it’s hard to diagnose if reinstalling Xcode has no effect.
Along the lines of the font cache corruption, there’s a program called Linotype FontExplorerX. It has a font cache cleaning feature. It never hurts to try it. Outside of that, I have absolutely no idea how to fix this one if a full reinstall of dev tools doesn’t fix it.
Basically, when fonts are activated, they are cached for use. Some of these font caches are handled by the OS and some are handled by the applications themselves. Deleting these cache files will hurt nothing but gives your system the opportunity to write a fresh set, which will fix commonly related font-related annoyances.
So after you clear your font caches (If you use Linotype’s app, be sure to clear Application Font Caches [u]AND[/u] System Font Caches), give your machine a fresh reboot and you’ll be good to go.
Like I said before, this may not be your problem but it’s a common problem with OS X and is worth the few minutes it takes to do so.
-Chris
If you gradually delete portions of the affected files (or until only known, good code exists) do you eventually have success in correctly formatting the files? It’s important to know if it’s an all-the-time thing or just with certain, specific files. Sometimes you can have files with weird, invisible characters that are out of range for the supported character set. For example, you might have unknowingly cut & pasted code from a site that had some japanese characters or some html formatting characters that don’t display in Xcode. While it’s not displaying them, they’re still there, can cause major display and compilation problems, and can be difficult to find. In my experiences with similar formatting problems, hidden, conflicting characters don’t need to be anywhere near the location of the formatting error. The best way to find out if this is your problem is to MAKE A BACKUP of an affected file. Then, start at the bottom of the file and begin deleting portions of it, working your way to the top. Make sure you get all the characters at the bottom of the file, including any line ending or return characters at the end. Every time you remove something, recompile so you can see if the removed portion was causing the formatting error. If you make it all the way to the top, cut some code out of another good file and paste into the bad one. If that code gets whacked, it may be a corruption in the file itself. Otherwise, you may have cause to report a bug to apple. If by chance you found some code that was causing the problem, go through that code line by line… then character by character… to find any problems. Usually, I arrow key through the whole block of bad text until I see it skip a movement when I hit the arrow key. That means there’s a character there that’s not being displayed. Retype the effected code manually on another line, then delete the bad characters and all surrounding text (including the returns before and after) that may have been cut&pasted with it or derived from the same place (just in case). Usually you won’t have to manually retype more than a few lines, and it’s worth it to avoid having to trash the file altogether. This approach has always fixed formatting errors like this for me. If you don’t have any success with the above method of troubleshooting, then answers to these questions may be helpful…
Does it happen all the time?
How big are the effected files? 400 lines? 4000 lines? Doesn’t matter?
Does it happen only with Applescript files, or with other file types as well?
Does it happen with barand new, unedited files…i.e. files that only contain automatically generated content?
it does not happen in script editor.
i cleard the font caches, reboot and still have the problem.
it happens with all of my applescript studio xcode projects.
they all have different amounts of lines, ranging from 10 to a few hundred.
this does not happen with other file types (only applescript files, not cocoa, etc.)
i cant tell if it happens with unedited files because it only happens after it compiles someting.
It doesn’t happen every time i compile the script, but it happens more often than it doesn’t.