Page 1 of 1

Code Completion Video

PostPosted: Wed Nov 28, 2012 1:59 am
by nerdzero
I finally made some time today to sit down and really focus on getting autocompletion working. This video shows some keyword, class, and member completion. I haven't been able to get local variables in methods to work yet.

http://www.youtube.com/watch?v=pgJKQRm25qI&hd=1

Apologies about crappy video quality (screen flickers at times) but it's really late and I don't feel like messing with the settings. It's best watched in fullscreen.

There are a lot of bugs and still a lot of work to be done but I was quite happy when I got something that was working without crashing and was actually useful. If you want to play with it yourself, download the 'completion' branch from GitHub but please remember this is not considered stable: https://github.com/ramon-rocha/MonoDeve ... completion

I should have all day to work on this Saturday so hopefully I can squash some bugs, clean up the code, and get us that much closer to proper code completion for Cobra!

Re: Code Completion Video

PostPosted: Wed Nov 28, 2012 9:28 am
by kobi7
Congratulations!! nice work!

Re: Code Completion Video

PostPosted: Wed Nov 28, 2012 10:02 am
by Charles
Excellent! Thanks.

Re: Code Completion Video

PostPosted: Wed Nov 28, 2012 2:17 pm
by Nefarel
Nice.

It would be nice not to have do indentation manually with TAB key. It is so annoying.

Re: Code Completion Video

PostPosted: Wed Nov 28, 2012 2:38 pm
by Charles
Does your editor maintain indentation? Many do out of the box or can be configured to do so.

Presuming you get that going, then indentation in Cobra is two keystrokes:
<ENTER> <TAB>

In Python it's typically <SHIFT><:;><ENTER> and C-like languages are typically <SHIFT><{[><ENTER>.

Re: Code Completion Video

PostPosted: Wed Nov 28, 2012 3:02 pm
by nerdzero
Agreed, Nefarel. In MonoDevelop, this would be accomplished by developing a Formatting text editor extension.

Re: Code Completion Video

PostPosted: Wed Nov 28, 2012 6:57 pm
by jaegs
Nice!

Re: Code Completion Video

PostPosted: Wed Nov 28, 2012 10:23 pm
by hopscc
Cool stuff, excellent work...

One thing that struck me watching the video is that with cobra theres another opportunity for completion:
If you are entering the first non whitespace token (word) on a new line, more often than not ( or pretty often, or sometimes (:-))
it's a keyword
assert, print, raise, def, while, .....

if you can detect that condition (only whitespace before cursor back to SOLn ) perhaps add the matching keywords to the filter list

( enhancement v2 :) )

Good stuff with what you've got working so far...
...

Re: Code Completion Video

PostPosted: Thu Nov 29, 2012 9:42 am
by nerdzero
Thanks, hops. I've tried something similar so far with mixed results. After determining what region the cursor is in, the completion extension will examine the text of the first line of the region. It will include a different list of keywords depending on if the region starts with "class ", or "def ", etc. I've been thinking about maybe seeing if I can utilize the CobraTokenizer here to simplify this or possibly use regular expressions instead.