Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

C# Bundle for TextMate (version 0.03, Released 4/18)

Discussion in 'Scripting' started by Emanuel, Mar 31, 2006.

  1. Emanuel

    Emanuel

    Joined:
    Feb 24, 2006
    Posts:
    11
    Update: Version 0.03 Available 4/18/2006

    After playing around with 10 million other editors, I've decided to make a C# bundle for TextMate. If you'd be interested in using it, it is available here. (URL Fixed on 4/19 -- previously was a 404 error)

    Currently this bundle adds to text mate:
    • Syntax Highlighting for C#
    • Syntax Highlighting for Unity Classes (thanks Neil!)
    • Auto Completion for Unity Classes (thanks Neil!)
    • Symbol Menu, allowing you to jump around
    • Basic Snippets for C# -- short macros that save you time typing.
    Version 0.03 Changes:
    • Types are now correctly highlighted in the parameter list.
    • Added new keywords 'set,' 'get,' 'as,' and 'throws'
    • Numerical Constants are highlighted now (courtesy of Neil)
    • Unity's types are now correctly highlighted. To use any Unity specific features from this version on, you must choose 'Unity (C#)' as the language for the file. The 'C#' language is used for pure C#.
    • Unity's types can be auto-completed. To use this, type a method partially and press Escape. Continue to press escape until TextMate has chosen the word you desire.
    • C# (and thus the Unity mode) has some very basic snippets defined for it. You can check them out in menu: Insert->Insert Snippet->C# . Snippets can be triggered by typing in the name found in parenthesis and then pressing tab. Snippets sometimes have multiple placeholders -- these can be accessed by pressing tab once for each place holder.
    Known issues in 0.03:
    • set and get are highlighted as keywords outside of properties
    • properties are not included in the symbols list
    • no support for generics, yet.
    If you end up trying this and having feedback, I'd love to hear! I'll edit this post again when I add a new version. The scopes are still up for debate, but quite a bit less than before. In addition, I'm still experimenting with the snippets. Very interested in hearing what people like and don't like.

    Enjoy!
     
  2. lurid

    lurid

    Joined:
    Aug 28, 2005
    Posts:
    72
    Awesome! I just recently got hooked on TextMate too and got inspired to make a foundation for a Boo bundle.

    For now, its just a copy/paste/edit of the Python bundle, but I'm hoping to find the time to add some Unityisms to it some day.
     
  3. Emanuel

    Emanuel

    Joined:
    Feb 24, 2006
    Posts:
    11
    sweet. Thanks for the link. I'm hoping to do the same with my bundle as well. It'd be really nice to have fully functional bundles for Unity :). Lemme know if I can help with anything.
     
  4. greenland

    greenland

    Joined:
    Oct 22, 2005
    Posts:
    205
    What does this program have over SubEthaEdit?
     
  5. lurid

    lurid

    Joined:
    Aug 28, 2005
    Posts:
    72
    I like the way it presents its feature set. It feels much more mac-like and makes it easier to get to useful features (tab completion, auto-inserting text, etc). It also makes it easier to see what is available to you when you are in a specific text mode.

    The way keyboard shortcuts and macros are handled seem much more intuitive to me too. I never used them much before TM, but perhaps because of the way it presents them, I've really picked up on using them in workflow.

    I also like the way it integrates with the shell - most modes have their own understanding of how to execute (for scripts), or do other things based on the mode, and you can override most built in functionality quite easily (most internal functionality is exposed through shell scripting).

    I'm still stuck putting in 60-70 hours with a contract, but I can't wait to get back in to Unity and trying to better integrate the two - I think there is a lot of promise there.

    Russ
     
  6. Emanuel

    Emanuel

    Joined:
    Feb 24, 2006
    Posts:
    11
    (disclaimer: I've only been using TextMate for a few months :) )

    For me, I think it definitely think the 'feel' of the program is excellent. It is designed well. I spent a bit of time playing with Ruby on Rails (a web programming framework) in TextMate, and I really used the ability to insert code snippets (called triggers) a ton.

    I'm a guy who's really used to using big IDE's like Visual Studio and Xcode, but I really like the cleanness of just using a text editor. Of course, in most text editors, you lose a lot of the nice editing features (Auto completion, for example). Or you have Vi or Emacs which come across to me as being very unintuitive.

    TextMate seems to be a nice compromise of the two, and is extremely customizable.
     
  7. NCarter

    NCarter

    Joined:
    Sep 3, 2005
    Posts:
    686
    This is pretty good. Thanks for making this available, Emanuel!

    On the recommendation of certain friends of mine, I'm trying out TextMate at the moment, and this is certainly better than the standard Mono/C# behaviour. I can't imagine why the standard one doesn't bother to populate the function popup....

    I've fiddled around with your bundle to add a few more C# keywords (as, get, set etc.) and Unity class names, as well as adding the latter for autocompletion. I can pass these modifications back to you if you like, although you might want to wait until I've understood how TextMate works a bit better, so that I actually know what I'm doing when I'm editing the files!

    Incidentally, is it me, or does Unity not always notice when TextMate has saved the file? Sometimes it does, but frequently Unity doesn't respond when I hit save, and the script is only recompiled when I switch back to Unity.
     
  8. Emanuel

    Emanuel

    Joined:
    Feb 24, 2006
    Posts:
    11
    Thanks Neil.

    As far as I know, I didn't think that there was a standard Mono/C# bundle, which is why I ended up creating this one. If you know of another TextMate bundle, I definitely would love to try it out.

    How did you add the set and get items to the bundle? What did you scope them as? I did not include set/get as keywords because they are valid identifiers when used outside of properties (and didn't get to detect them properly). I completely missed 'as' and apparently 'throw' as well, lol. I'll make sure those two get placed into the next version.

    I'd be more than happy to use the your list of types for Unity. All that stuff in my version is going into a separate language (I'll most likely call it 'Unity (C#)') that will make reference to the separate C# language. That way, the bundle will do the right thing when you're using Mono and not Unity.

    I'd also like to eventually change the behavior of autocomplete using TextMate to take what you've already typed into consideration when displaying the list of options. I get the impression that it doesn't do this on its own from reading the documentation. Its on my todo list somewhere.

    Thanks a bunch for the feedback! =)
     
  9. Mortoc

    Mortoc

    Joined:
    Nov 3, 2006
    Posts:
    50
    Here's a useful snippet for Textmate.

    In the bundle editor, add a command "GoToDocumentation" or whatever you wanna call it. I assigned the keyboard shortcut Command + ' (same as Unitron).

    Code (csharp):
    1. open "http://unity3d.com/support/documentation/ScriptReference/30_search.html?q=$TM_SELECTED_TEXT"
    This gives you the same "Look up selected in the script reference" functionality that Unitron comes with. I use this in C#, but it'll work in Boo or Javascript as well.
     
  10. Jorgen

    Jorgen

    Joined:
    Dec 13, 2005
    Posts:
    38
    or even better, select "Output: Show as HTML" for the command, and
    Code (csharp):
    1. URL="http://unity3d.com/support/documentation/ScriptReference/30_search.html?q=$TM_SELECTED_TEXT"
    2. "<meta http-equiv='Refresh' content='0;$URL'>"
    3.  
     
  11. Joe ByDesign

    Joe ByDesign

    Joined:
    Oct 13, 2005
    Posts:
    841
    The TextMate section of the user wiki has been updated to help keep TM bundle releases organized.

    Please upload maintain your TM bundle on the Wiki (filling out any missing info), rather than uploading here on the forum.

    Your help will aid the effort to maintain a single source for TM Unity bundles, instead of having a bunch of misc. forum posts with fragmented versions spread about that users have to hunt to find.

    Media Wikis are great for this sort of thing! Let's use it! :)

    Thanks!
     
  12. Joe ByDesign

    Joe ByDesign

    Joined:
    Oct 13, 2005
    Posts:
    841
    Any word on this gents?
     
  13. seventyfive

    seventyfive

    Joined:
    Jul 20, 2007
    Posts:
    34
    hey guys
    is there a newer version of the textmate c# bundle? couldn't find anything yet and the existing one isn't complete i guess..

    thanks+cheers,
    marco
     
  14. awhit

    awhit

    Joined:
    Jun 7, 2010
    Posts:
    1
    The link to the C# bundle seems to be broken. Could someone reupload?
     
  15. eternalnoob

    eternalnoob

    Joined:
    Jan 24, 2010
    Posts:
    53
    Hi All,
    This C# TextMate bundle is now on the Unify Community wiki here:
    http://www.unifycommunity.com/wiki/index.php?title=Script_Editors#TextMate_.28OSX.29
    because the link above in the forum by the original poster Emanuel is currently broken. I am not responsible for the bundle, I simply downloaded it a few months ago when the link was working and have now posted it to the Unify Community wiki in the hope of helping others who may need it.
    EN