[Gambas-user] Change to the Gambas IDE to improve the workflow

Robert Rowe robert.c.rowe at ...626...
Tue Mar 11 01:52:56 CET 2008


Yes, you are correct that CTRL+Space will trigger completion in Gambas2. 
This is a key combo the VB uses but VB will also complete on the space, 
periond and left parnethesis too. I looked at the section that you 
mentioned.

ELSE IF InStr("([.!", Key.Text) > 0 AND InStr(". ", $sMode) > 0 THEN

It appears that it is looking for a period in the $sMode variable too. 
The $sMode variable gets assigned the value in sMode which is a 
parameter on the Open sub.

I commented out my code and added a message.info($sMode) at the 
beginning of the outermost case else (where the above mentioned line 
lives). It has an A in it.

In my test I was in STATIC PUBLIC SUB Main() of FNotepad.class in the 
Notepad example. I did not press the tab. I typed hFo which made the 
complete window appear. I then type a . and the complete window hid. I 
backspaced and tried again with ( and it hid again. I found some code in 
PUBLIC SUB edtEditor_KeyPress() of the FEditor class that is also trying 
to handle these keys. This code makes the spacebar complete if you are 
indented. I think that it works under certain conditions but it is 
inconsistent.

I didn't mean to raise a fuss. I was really just messing around to learn 
a bit about Gambas. The IDE is like an example on steroids. I thought 
that others might like these hotkeys to work this way. I'm not really 
asking for this to be  changed in the official version. Unless a lot of 
other users request it also.

It would be nice if this was configurable though.

Robert Rowe

Benoit Minisini wrote:
> On dimanche 9 mars 2008, Robert Rowe wrote:
>   
>> I've made a small change to my copy of the IDE that I feel is a great
>> improvement. I love the completion menu but I don't like that you have
>> to press the enter key to trigger it. The three keys that I most often
>> press after entering a keyword or object name are the space key, the
>> period or the left parenthesis. My change adds these three keys to the
>> list that triggers the completion. Benoît, if you agree that these
>> changes are positive could you add them to the official copy of the IDE
>> source?
>>
>> You will need to get the latest gambas2 source from subversion. The
>> specific line(s) on which to make the changes will probably be different
>> in different versions. I haven't checked gambas3 but I'm sure that the
>> code is in the same procedure (ManageKey).
>>
>> Here are the changes:
>>
>> In the FCompletion class, line 515, comment the line that says:
>>
>> ME.Hide
>>
>> and insert a line that says:
>>
>> InsertItem(TRUE)
>>
>> This enables the spacebar to trigger completion.
>>     
>
> Actually what you want for space was the code for CTRL+Space. I bet that it 
> worked as you want before, but somebody wanted the VB shortcut instead! I 
> think some configuration options would be the right way, but I can do that 
> only for Gambas 3, not Gambas 2. And I think that if I change the behaviour 
> as you want, other people will cry. I need more people's opinion!
>
>   
>> Add the following 2 case blocks to enable the period and left
>> parenthesis keys:
>>
>>     CASE 40 'Left Parenthesis
>>         InsertItem(TRUE)
>>         RETURN FALSE
>>
>>     CASE 46 'Period
>>         InsertItem(TRUE)
>>         RETURN FALSE
>>
>>     
>
> Strange, as it already works like that: if I press a left parenthesis or a 
> period on my Gambas 2, the completion is done. Look at line 548 in 
> FCompletion.class.
>
> Can you check that?
>
> Regards,
>
>   





More information about the User mailing list