FlashDevelop for Mac/Linux: Part 1

For five years, FlashDevelop has been my code editor of choice.

If you are targeting Actionscript 3 or Haxe, FlashDevelop is arguably (and in my mind) the best editor you can use. I love it so much I even use it for Javascript, PHP, C++… almost anything I need to write. The only problem with FlashDevelop is that it only works on Windows.

This is not a bad thing if you are running Windows, but when you boot into Ubuntu or OS X, which editor do you use?

I am not implying that Linux and Mac do not have their share of excellent editors, but I am most productive when I have FlashDevelop. Many people actually boot Windows in a VM in order to use FlashDevelop on OS X or Linux. I literally went from using Linux full-time for five months, on all my machines, to using Windows because of FlashDevelop.

There is a long story behind efforts to port FlashDevelop to Mac and Linux. There are instructions for using FlashDevelop in Wine, but I can’t get it to work. There have been efforts to compile using Mono, but some of the components of FlashDevelop, namely ScintillaNET and DockPanelSuite, do not work outside of Windows.

If you are interested in knowing more of the details behind the possible approaches to porting FlashDevelop, and the pitfalls, I would be more than happy to go into further detail, later

I picked this up again as I began using Ubuntu 12.04 as my full-time OS. I’ve already worked on porting FlashDevelop in the past, so I was (fortunately) able to fast-forward through a lot of the “what if?” conjecture that comes along with a porting effort.

Philippe Elsass is one of the lead developers for the FlashDevelop project, and one of my close friends. As we discussed this idea again, we both felt that there were two “ideal” options on the table.

Either we could:

  • Compile FlashDevelop using elements from MonoDevelop (like Mono.Texteditor and MonoDevelop.Ide.Gui)

or…

  • Create a MonoDevelop add-in using logic from FlashDevelop

I explored the first approach, but satisfying the dependencies for all of MonoDevelop’s controls is difficult. Also, Philippe made the excellent point that much of an IDE is common features, like find and replace, so it would make sense to try and focus on the important things, like haxe language support.

This week I’ve been working on the second approach — extending MonoDevelop using FlashDevelop functionality. This is actually something Philippe and I worked on a year ago. I am working with MonoDevelop 2.8, which is in the Ubuntu 12.04 repositories. I have had much better success extending MonoDevelop this time than I did with MonoDevelop 2.6 in the past, and have enjoyed the editor a lot more.

Here is a list of features I have working:

  • NME project generation
  • Haxe language highlighting
  • Haxe compiler-based code completion
  • Build and run support for NME projects

With these features in-place, I feel that my “HaxeBinding” add-in for MonoDevelop is mature enough to share with you. Generic haxe project support is not working, but I would like to add it in the future. If you’re working with NME, you might be interested in giving this a try.

I have put the source on GitHub so you can take a look or try it out if you are interested. I have only used MonoDevelop 2.8 with the add-in, but if you are using a different version, I can try and see if it is compatible. The next steps are to continue to improve haxe language support, NME project and haxe project support, as well to add more polish to install and distribution process.

FlashDevelop is written in C#, and so is MonoDevelop. That means that extending MonoDevelop using code from FlashDevelop is really feasible. You may be surprised if you try it how similar MonoDevelop feels to FlashDevelop.

  • $26185370

     Sweet! I was recently thinking how cool it’d be if someone could port FlashDevelop to other platforms; I didn’t realize you were working on this! Can’t wait to give it a try sometime!

  • http://www.facebook.com/matthew.mourlam Matthew Mourlam

    Fantastic

  • saumya

    finally!! something on MAC and Linux. Nice stuff. Thank you so much for putting effort and keep going. 
    I would say the same thing as I boot up to Windows just to use FlashDevelop. Now its time for a complete shift.

  • The_bowwer

    Hello,
    This is very nice and I wanted to try but I can’t manage to…
    I’m on mac osx, and i’ve put the Addin in the folder :
    Applications/MonoDevelop.app/Contents/MacOS/lib/monodevelop/Addins

    This doesn’t work because I can’t make an empty NME project when I want to create a new solution. 
    I don’t know this editor so I may do something wrong !
    Thanks for help :)

  • Juan

    Hi there!

    I’m trying to set it up but I’m not getting very far. This directory doesn’t exist in my Ubuntu 11.10:

    ~/.local/share/MonoDevelop-2.8/LocalInstall/AddinsI’ve tried creating it and putting the DLL there, but nothing haXe/NME related when starting a new solution.I’ve also tried Edit > Preferences > Addins > Addin Manager > Install from fileBut can’t add the DLL manually, I guess it’s not really an “Addin package”.Cheers!Juan

  • http://www.joshuagranick.com Joshua Granick

    That’s the directory on my machine. Which version of MonoDevelop comes in the Ubuntu 11.10 repositories?

    If it is an older version of MonoDevelop, it may go into “MonoDevelop-2.7″, etc.

    I’ll try and get this posted in a repository soon, so you can install (and update) from the add-in manager rather than installing manually like this. Stay tuned! :)

  • http://www.joshuagranick.com Joshua Granick

    On OS X, I had to put the DLL in “~/Library/Application Support/MonoDevelop-2.8/LocalInstall/Addins”

    The directory didn’t exist, so I had to create it. I’ll try and get this posted in a repository to make things easier in the future. If it is working you’ll see “Haxe” then “NME” as categories for creating a new project :)

  • John Olson

    Very cool.  Got it up and running on OSX very quickly. 

    I think you start a KickStarter project to fund your work on this. I imagine you’d get some very big donations. People have been asking for FD on OSX for years.   I know I’d donate.

  • Juan

     Found it!

    There’re Monodevelop default Addins in /usr/lib/monodevelop/Addins

    Copied it there and now it comes up. Checking it right now!

  • JLM

    This is really good, and easy to set up, downloaded mono sdk and monodevelop as dmg and installed very easy, then put the two bin files from the git repository in /Applications/MonoDevelop.app/Contents/MacOS/lib/monodevelop/AddIns
    and restarted monodevelop and File>New>Solution…  so easy.  I noticed that completion does not work for all cases, like if you type in your main constructor…var g = graphics;  But surprised it seems to be so easy to use with the project dropdown.  Are you planning to support as2/as3 as well, unfortunately I often have to use them.  So can we run nme apps within monodevelop as plugins to add graphics tools etc… would be good to get info on where to start maybe if we could see how to add say a calculator or something… any tips?  But well done Phillippe and Joshua, hope to see you both next weekend  ;j  JLM

  • http://www.joshuagranick.com Joshua Granick

    Code completion is being provided by the haxe compiler right now. It provides completion for methods and properties when you reference an instance (like “.beginFill”) or for the parameters when you are calling a method, but it does not provide a look-up for all the available class instances, or when you want to create a new class.

    These are available in FlashDevelop because it has its own parsers, which loop through your project files and find which objects and classes are available. It sounds like this feature will be possible to add to the haxe compiler-based completion in the future, since haxe 2.09 will support a cache when performing completion, making it practical to make completion smarter without slowing everything down.

    Porting completion from FlashDevelop is not easy, but is possible since MonoDevelop and FlashDevelop both use C#. This way is still easier than using FlashDevelop as-is and replacing the UI with GTK# controls. It needs to be adapted to work within the new environment, with new controls. Otherwise we can generally pull completion over, and also work to support Actionscript 3 if its wanted. Most people on Twitter seemed to say that haxe was most important to them, and its much easier to implement.

    We definitely can explore extending MonoDevelop with more tools to help create projects. It probably is possible to host graphic tools in the editor, or definitely anything which can be run in a background process, like I’m doing now with the haxe, haxelib and nme tools.

  • Jlm

     PS anyone looking for a twilight type theme there is one here https://github.com/nicolinux/Monolight which seems ok.

  • Confidant

    I did this and I was able to create a new NME project, but code comepletion does not seem to be working (CTRL-Space). Do I need to enter a path to haxe somewhere? I’m using MonoDevelop 2.8.8.4.

  • Martamius

    Very awesome! THANK YOU!!!! Working great for me on osx lion.

  • http://www.joshuagranick.com Joshua Granick

    You shouldn’t have to press Ctrl+Space in order to receive code completion… it should occur automatically.

    It used to check for an HXML file, using the same name as the target NMML file, so if it was “NMETest.nmml” it would look for “NMETest.hxml” in the same directory.

    However, I updated it today so this is no longer necessary. It automatically receives the HXML data it needs from the project, based on your NMML and the target you have selected in the drop-down.

  • Confidant

    I updated to your latest .dll, then I discovered that I needed to change the target to something other than the default Debug|Android since I don’t have that SDK. Works now, thanks!

  • _tomph

    I second the shout for a Kickstarter campaign.  I would donate!

  • http://nikdudnik.com Nek

    Great news! Will try it right now.

  • http://twitter.com/Werdn Andrew Motrenko

    Works fine on Linux, but it does not work in Windows.

    UPD: After installing mono-2.10, and rebuilding the project from source code it worked.

  • http://nikdudnik.com Nek

    I’ve tried it. Works great! 

  • Ivan Podrug

    this is probably common knowledge but to try it under windows I’ve had to add in MonoDevelop.exe.config
    ≶loadFromRemoteSources enabled=”true” />

    to “enable the loadFromRemoteSources switch” error.

  • Alex

    I’ve got it installed, it seems to build my ‘hello nme’ but get the following error when trigger a debug run.
    Cannot execute ‘haxelib run nme run “NMEWorld.nmml” html5 -debug’

    I trie a couple of targets (flash , android) and got same error.

    Any ideas ?

  • Alex

    Run works fine though :) Great start.

  • NateJC

    Great stuff! Is there a way to get code templates working? Is there a certain mime type I need to be using?

  • http://www.abdulqabiz.com/blog/ Abdul Qabiz

    Awesome! I am going to check it out, I tried to do a few stuff some years back but never really got chance to do more.

    Thanks

  • Shawn

    Installed MonoDevelop 3.0.2 and am unable to get the add in to show up in the manager. I don’t see anything at all actually. The xml at addins.monodevelop.com/Beta/Mac/2.9.0/main.mrep ( which it looks like the 3.0.2 points back to only contains this:

    MonoDevelop Add-in Repository (Beta channel)It should be listing repositories, right? Stable is the same.

  • Robin Rowinski

    Yep, same problem here on OS X Lion 10.7.4 w/ MonoDev 3.0.2 I installed the plugin from github but it only completes when i enter the package name e.g. “nme.display.Sprite …” but not when just typing “Spr …”

  • Bas

    I installed it, and can add ‘Haxe’ solutions, but see very little code highlighting or other cool features. It seems to work but have no good features at all. Can you please describe what features should be there? So that I can decide if something went wrong in my case or the solution is too limited?

  • Bas

    Exciting, but.. not working! At least not on the latest install of Monodevelop (3.1). I’ll be waiting for the new release and will try it again then.

  • http://www.joshuagranick.com Joshua Granick

    Currently, you can create Haxe-based projects, either for a Haxe target (C++, Javascript, Flash, etc) or for NME.

    For NME or Haxe, you can receive code completion when typing a period or a parenthesis. All of the completion is driven directly from the Haxe compiler, and these are the only times it provides completion.

    It includes syntax highlighting for Haxe, and does not currently include other features that would modify your source code, like automatic imports, etc.

  • joseph zizys

    installed the mono framework and monodevelop, but the add in manager only lists F# as an available language add on, is there a repository I have to add, or do I need to download a file and install it locally, or what? Very excited about this project btw, and appreciate it much! have editid this comment slightly for tone, it was late and i was listening to nico.

  • http://www.joshuagranick.com Joshua Granick

    You can download it here: http://addins.monodevelop.com/Project/Index/41

    I’m not sure why, but they keep breaking their repository, and don’t roll-over existing add-ons :/

  • Antonio Brandao

    What is the state of this project as of March 2014 ?

  • Wolfos

    Abandoned by the looks of the repository.

  • indolering

    “I explored the first approach, but …. Also, Philippe made the excellent point that much of an IDE is common features, like find and replace, so it would make sense to try and focus on the important things, like haxe language support.” Unfortunately, this option means that the two IDE’s split momentum and don’t share developers, the lifeblood of any OSS effort. Given that the Github repo hasn’t been touched in 8 months, I would suggest future developers go with option 1 :p

  • VinodkumarKN

    Haxe is becoming more popular, so this project has to be keep updated. I want a mature Haxe IDE for Ubuntu.

  • http://www.joshuagranick.com Joshua Granick

    Hey guys,

    I know you deserve an update, so here’s the deal:

    I really that MonoDevelop would be a good solution, but ultimately I don’t like the move to Xamarin Studio.

    I use Linux full-time, and currently use Sublime Text. I wish the code completion were stronger, and that it supported projects a little bit more.

    If you drag a folder to Sublime Text, and use only files within that directory (and that directory has an OpenFL project) then I believe it provides code completion, but in the course of improving OpenFL, I am constantly using files outside the scope of a single project folder. As a result, I don’t tend to get code completion at all, but this wouldn’t be a problem for other people.

    The recent addition of a Haxe Python could yield some interesting collaborations on Haxe support (generic) plugged into multiple IDEs, for example, Sublime Text, gedit and geany all support Python-based plugins, to name a few editors.

    I’m really open (and interested!) in your input, because as much as I love FlashDevelop, I’m happier using Linux, and don’t want to use a VM for a code editor. I don’t like “heavy” editors like Eclipse, but I prefer an editor that can tie files together as a project (but I do prefer the loose behavior of FlashDevelop, which doesn’t require adding each file specifically) so that you can easily switch contexts for building/running/testing

    There’s obviously the HIDE project based on webkit, but I personally would prefer something native, but am still watching the project.

    Let me know, and thanks :)