how to make my intelliprompt.memberlist end by pressing the spacebar?

SyntaxEditor for Windows Forms Forum

Posted 11 years ago by nick.wang
Version: 12.1.0304
Avatar

Hi,

I am using your perfect product(evaluation version) SyntaxEditor ,my project is to build an IDE with C compiler. I want to realize the functionalities like VS, especially popping up the intelligent prompt .But I met an issue, I know how to popping up the memberlist of a struct, but I don’t know how to realize the variable intelligent prompt, could you please tell me how to realize it?thank you .

P.S. main issue is that I can not realize the selection when I am pressing the Spacebar, I add the intellipromptMemberlist in the editor_KeyTyping event.always get the information: IntelliPromptMemberListClosing: (Cancelled),something wrong in the “Perform auto-complete”

Nick

Comments (6)

Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Nick,

For our advanced C# language in the .NET Languages Add-on, we generally figure out where the caret offset is in the AST, which is the syntax tree generated by the parser we made for C#.  Then we walk up through the ancestor AST nodes and if we get to a place where there is a statement collection, we walk backwards through the statements from the current statement, and collect the names and declared types of variables along the way.  Then we include those in hte member list.

Generally in VS, Tab is the only key that will perform the auto-complete of a member list, even if no selection has been made.  If a partial selection has been (one or more letters match the start of a member list item), then spacebar should trigger an auto-complete.  If there is no partial selection, then spacebar will cancel the member list.  Is that what you see?


Actipro Software Support

Posted 11 years ago by nick.wang
Avatar

Hi,

thanks for your reply, I am still confused.

The Language I said in above is defined by our team, so the .Net Add-on is not suitable for our purpose,we wrote the parse for it . now we can get the AST and get the variable infomation while the Keypressing event occurs, in this event,we add the valid variables info and basic types info to the editor.IntelliPromptMemberlist,such as :

//beginning of code

private void editor_KeyTyping(object sender, ActiproSoftware.SyntaxEditor.KeyTypingEventArgs e)
{

editor.IntelliPrompt.MemberList.Add(new IntelliPromptMemberListItem("1111", 1, "11"));
editor.IntelliPrompt.MemberList.Add(new IntelliPromptMemberListItem("2222", 1, "22"));
editor.IntelliPrompt.MemberList.Add(new IntelliPromptMemberListItem("3333", 1, "33"));
editor.IntelliPrompt.MemberList.Add(new IntelliPromptMemberListItem("4444", 1, "44"));
editor.IntelliPrompt.MemberList.Show();
return;

//end of code

the info displays well ,and the partial selection works well too,but when pressing the spacebar,always get the get the information: IntelliPromptMemberListClosing: (Cancelled).

to solve this problem,I add the code in the event of editor_TriggerActivated,and set space as trigger too in Csharp.xml

//beginning of code

private void editor_TriggerActivated(object sender, ActiproSoftware.SyntaxEditor.TriggerEventArgs e) {
editor.IntelliPrompt.MemberList.Clear();
editor.IntelliPrompt.MemberList.Add(new IntelliPromptMemberListItem("aaa", 1, "11"));
editor.IntelliPrompt.MemberList.Add(new IntelliPromptMemberListItem("2222", 1, "22"));
editor.IntelliPrompt.MemberList.Add(new IntelliPromptMemberListItem("3333", 1, "33"));
editor.IntelliPrompt.MemberList.Add(new IntelliPromptMemberListItem("5555", 1, "44"));
editor.IntelliPrompt.MemberList.Show();
return;

//end of code

<!--<KeyPressTrigger Key="chardTrigger" Character=" ">
<KeyPressTriggerValidStates>
<KeyPressTriggerValidState State="DefaultState" />
</KeyPressTriggerValidStates>
</KeyPressTrigger>-->

 

while pressing the spacebar,it works well .

I 'd like to implement the auto-complete in the event of Keypressing ,how to solve this problem? thank you.

Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Nick,

I understand, I was just saying that if your custom language had a parser that produced an AST (as our .NET Languages Add-on does), then that info will be available to you on the document's SemanticParseData.  And you could use logic such as what I described to walk up the AST and find variables.  This again assumes your custom language is parsing an AST with that data.

As for the spacebar, if you show the list, type "2" then press spacebar, it should auto-complete since the "2222" item will be selected.  If you only show the list (nothing selected) and press spacebar, it won't.


Actipro Software Support

Posted 11 years ago by nick.wang
Avatar

Hi,

I have implemented our parser ,got the AST and all the information that you said before.The main problem is now that I add the information to memberlist, partial selection is ok,but pressing spacebar to finish the selection does not work.

For example I pressed the "2" when the memeberlist showed, and the backcolor of "2222" is blue ,then I pressed the spacebar to select this item, got the "cacelled" information,nothing was selected. after reading your reply, it seems that I must store the memerlist info into the SemanticParseData,it is not right adding the inforamtion to memberlist in Keypressing event directly like above code I pasted,is that right? thank you

[Modified 11 years ago]

Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Nick,

I'm not sure since if you open our SDI Editor sample with the C# language open and do Ctrl+Space, type "a", and you'll see something get selected, then press spacebar and it auto-completes.

For a good example of automated IntelliPrompt, you should look at our SimpleAddon example, specifically in the SimpleSyntaxLanguage class.  In there we return true for IntelliPromptMemberListSupported and implement the IntelliPromptCompleteWord and ShowIntelliPromptMemberList methods.  These show the member list on demand, using info from the AST.  Note that our own advanced add-on languages (like the .NET Languages Add-on ones) are implemented with the same concepts as displayed in the Simple language example.

My guess is that in your case, you aren't doing things similar to our sample, and you probably have something that executes code on Space presses that ends up closing the member list.


Actipro Software Support

Posted 11 years ago by nick.wang
Avatar

OK,I got it,it works well,thank you.

The latest build of this product (v24.1.0) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.