Page 2 of 4

Re: MonoDevelop Cobra add-in

PostPosted: Wed Aug 01, 2012 11:19 am
by Charles
In other news, I have found that MonoDevelop can open a foo.exe file directly and if there is a foo.exe.mdb then it can debug it. You don't even need a project solution or any other special MonoDevelop files. On the other hand, it's not feasible with Cobra yet because the .mdb file will have "foo.cobra.cs" in it instead of "foo.cobra" despite the fact that Cobra generates the correct directive to address this:
Code: Select all
#line 1 "foo.cobra"
// generated C#
...

However, I have been digging into the Mono.Cecil.Mdb library and expect to be able to rewrite the .mdb file with the correct filenames.

Another piece of the puzzle.

Still can't wait til we have autocompletion. :)

Re: MonoDevelop Cobra add-in

PostPosted: Wed Aug 01, 2012 11:50 am
by nerdzero
Re: 2.8 vs 3.0: What I've found so far is that the Parser and Refactorer properties have been removed from the IDotNetLanguage Binding interface.

So, I think if you remove these two properties from CobraLanguageBinding.cs, then update the version number requirements in CobraBinding.addin.xml from 2.8.5 to 3.0, and then recompile it should work (fingers crossed).

I believe this link to a Windows MSI should install 2.8.6 though if you wanted to do some more windows testing for 2.8: http://download.xamarin.com/monodevelop ... -2.8.6.msi You'll still need GTK# and .NET installed as that MSI doesn't provide those. Just make sure you don't let it auto-update :)

There seems to be issues running the debugger though on a 64-bit system with a 32-bit install of MonoDevelop. But other than that, syntax highlighting, compiling and running (sans debugger w/ CTRL+F5) should still work with this setup.

DelphiGuy, however you can help would be awesome. If you want, you can try what I've listed above to get this addin working on MonoDevelop 3.0 (remove those two properties and update the version number) or look at the C# binding mentioned in the README to try and get some kind of autocomplete started. Just having 'a', 'b', 'c' show up in a list regardless of what the actual code is would be a big step. You can also look at the project or file templates in CobraBinding/templates and start working on some new file templates or tutorial-type project templates. I believe the F# binding mentioned towards the bottom of the README file has at least one tutorial template.

You can get the code here: https://github.com/ramon-rocha/MonoDevelop.CobraBinding
If you are not familiar with GitHub or Git, that's okay, just download the code as a ZIP (download link is on the right-hand side). It will say "no downloads yet" but click the "Download as zip" button to get the source. Feel free to ask questions or for help as I check the forums frequently.

Re: MonoDevelop Cobra add-in

PostPosted: Wed Aug 01, 2012 11:59 am
by nerdzero
Charles wrote:In other news, I have found that MonoDevelop can open a foo.exe file directly and if there is a foo.exe.mdb then it can debug it...

Hey, it can debug it too! Neat! Yesterday, when I was working on references, I accidentally double clicked on a reference to a cobra generated dll. I could see the C# and was like...Whoa 8-)

Re: MonoDevelop Cobra add-in

PostPosted: Thu Aug 02, 2012 4:21 pm
by DelphiGuy
ok, for the moment i'm going to focus solely on autocomplete on MD3.0xxx running under Win 7. I will see if I can figure out how to get autocomplete to do something, anything. since you guys are both real programmers, you're probably about 10-20 times more efficient than me. therefore, if one of you takes an interest in the autocomplete issue and actually does something, please tell me about it, because 10 mins from you, with me not informed, might lead to me duplicating your efforts for hours and hours. presumably, just as in all programming, i'll become smarter about autocomplete as i knock my head against it.

charles, on another topic, if you have any say over the user session timeout period, could we make it a heckuva lot longer? i often leave an instance of firefox open with cobra-language.com up and me logged in, as i contemplate my cobra programming project and now my feeble attempt to help you guys get monodevelop running. with the current timeout period, every single time i come back to cobra-language i've been logged out again. for goodness sake, cobra-language is not a banking site. are we sure we even need an automatic logout with a time period shorter than 24 hours?

Re: MonoDevelop Cobra add-in

PostPosted: Thu Aug 02, 2012 11:48 pm
by Charles
I get logged out of the discussion forums maybe once a year. Are you sure you are checking off the "Remember me" checkbox or whatever it's called. I don't recall the exact name phpBB uses because I haven't seen it in months.

Re: MonoDevelop Cobra add-in

PostPosted: Fri Aug 03, 2012 1:24 am
by DelphiGuy
there's a "log me on automatically" checkbox below the login fields (username and password). can't find anything else that sounds relevant. true, i had that unchecked so i checked it, and we'll see if that solves the problem. thanks.

Re: MonoDevelop Cobra add-in

PostPosted: Fri Aug 03, 2012 9:35 am
by Charles
nerdzero wrote:Re: 2.8 vs 3.0: What I've found so far is that the Parser and Refactorer properties have been removed from the IDotNetLanguage Binding interface.

Is this because those functions are being done through something else like NRefactory?

Re: MonoDevelop Cobra add-in

PostPosted: Fri Aug 03, 2012 10:59 am
by nerdzero
I haven't figured it all out yet but if you take a look at this MonoDevelop commit: https://github.com/mono/monodevelop/com ... Binding.cs and look towards the bottom at CSharpLanguageBinding.cs, you'll see that they've been removed.

I believe code completion for C# is now handled by this class which utilizes the NRefactory library but to what extent I'm not sure: https://github.com/mono/monodevelop/blo ... tension.cs You can also see the list of supporting classes here: https://github.com/mono/monodevelop/tre ... Completion

So, it would appear that we would need to define a completion class that inherits CompletionTextEditorExtension and implements the ICompletionDataFactory, IParameterCompletionDataFactory, and ITextEditorMemberPositionProvider interfaces and then make MonoDevelop aware of this class by adding the relevant entry in the addin XML file.

We could probably save some time by asking on the MonoDevelop forums but I've got an exam next week and I know if I start this for real I won't stop until I have something working. Too much fun.

DelphiGuy, I am not working on this in the near term so go nuts!

Re: MonoDevelop Cobra add-in

PostPosted: Fri Aug 03, 2012 8:41 pm
by Charles
I have pulled the lastest Cobra add-in and tested it. Looks to be working fine.

I noticed a Console.WriteLine. In an MD add-in, where do the Console.WriteLines go to?

Re: MonoDevelop Cobra add-in

PostPosted: Fri Aug 03, 2012 8:44 pm
by Charles
Btw it would also be useful to see what MD and SharpDevelop do for Visual Basic in order to compare to C# and see what the commonalities and differences are.