Stop Xcode from converting text to hyperlinks?

I have Xcode 3.2.1 and I like to use it, but when I edit a file with hyperlinks in the text (for example, a comment with a link: # see http://example.com ) Xcode turns the text into an interactive hyperlink. This is the royal PITA when trying to edit this hyperlink, since it means that I canโ€™t click inside it to edit part of the link - I need to select all this and repeat, or backspace / arrow-key eleven billion times to go to that part which needs a change.

Does anyone know how to disable this? I don't see it anywhere in preferences, and I have Googled until my fingers fall, to no avail.

+4
source share
3 answers

I went a bit further, and I found that Xcode 3.x hides its syntax highlighting rules in xclangspec files , so editing the corresponding file will allow you to change the rules to the extent.

Files are stored here:

/Developer/Library/PrivateFrameworks/XcodeEdit.framework/Versions/A/Resources 

In this directory, I opened BaseSupport.xclangspec and found a line identifying the URL protocol:

  Syntax = { StartChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; Chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789;/:@&=+$,-_.!~*'()%#"; Match = "^(acap|afp|afs|cid|data|fax|feed|file|ftp|go|gopher|http|https|imap|ldap|mailserver|mid|modem|news|nntp|opaquelocktoken|pop|prospero|rdar|rtsp|service|sip|soap\\.beep|soap\\.beeps|tel|telnet|tip|tn3270|urn|vemmi|wais|z39\\.50r|z39\\.50s)://([a-zA-Z0-9\\-_.]+/)?[a-zA-Z0-9;/?:@\\&=+$,\\-_.!~*'()%#]+$", "^(mailto|im):[a-zA-Z0-9\\-_] +@ [a-zA-Z0-9\\-_\\.!%]+$", "^radar:[a-zA-Z0-9;/?:@\\&=+$,\\-_.!~*'()%#]+$", ); */ Type = "xcode.syntax.url"; }; 

and changed the line for Match = to read:

 Match = (); 

This excludes URL mapping, but not mailto matching (which is in a separate rule below the first). I leave this as an exercise for the reader; -)

Obviously, I could be more selective, and I suspect that changing the type string would also be sufficient. In addition, future versions of Xcode are likely to overwrite this change, so I will have to examine the changes to my own copy of BaseSupport.xclangspec and see if it works in ~ / Library / Application Support.

+4
source

Use the option key when selecting text in a link or more sharply, turn off the syntax highlighting for the file.

+3
source

For those coming here for Xcode 7, things have changed a bit since the publication of @Zee.

To start, the BaseSupport.xclangspec file BaseSupport.xclangspec now located in /Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/Resources .

Secondly, you must also modify the Built-in Syntax Types.xcsynspec , which is located in the same directory as BaseSupport.xclangspec . After opening this file, go to the comment MARK: URLs and get rid of the URL identifiers.

For security reasons, I would recommend just commenting:

 // MARK: URLs //{ // Identifier = "xcode.syntax.url"; // Name = "URLs"; // Color = "0.055 0.055 1.000"; // IncludeInPrefs = YES; // IsLink = YES; // URLFormat = "%@"; //}, //{ // Identifier = "xcode.syntax.url.mail"; // BasedOn = "xcode.syntax.url"; // Color = "0.055 0.055 1.000"; // IncludeInPrefs = NO; // IsLink = YES; // URLFormat = "mailto:%@"; //}, 
+3
source

All Articles