Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 Context sensitive auto completion list.

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
GennadiyKorol Posted - Sep 13 2008 : 5:15:02 PM
I think it would be nice if VAX's completion list for functions and members would be context based in the following way:


If you are working inside a scope that can access a private/protected member - show it.
If you are working inside a scope that cannot have access to private/protected members - do not show it.


Same logic can be applied for the _member filtering.

If I am in a scope that cannot access the private members, filter the _ members as well (optionally).
If I am in the scope that can access private members, do not filter _ members.

This makes sense because you cannot access private members neither you want to see them when using other classes. This makes the completion list much clearer.


Right now clicking "only public filter" every time is just cumbersome.
19   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Mar 04 2010 : 5:07:35 PM
This is down as a high priority for us, and it is something we would like to do sooner rather than later. But unfortunately no progress to report yet.

Our main focus right now is getting support for VS2010 working reliably. This IDE is still something of a moving target, but it is important that we support it.

For KDevelop I wonder if they are able to use a compiler to help with their code parsing. We don't have that luxury, which can make some of the edge cases quite hard to handle.
GennadiyKorol Posted - Feb 26 2010 : 7:39:16 PM
I was just looking at "what's new in KDevelop 4.0 and I can see that they have also implemented this feature (just as Netbeans).
And it works perfectly with macros, templates and friends.

What about us, bound to be using Visual Studio on windows, is there any update about this feature?
GennadiyKorol Posted - Mar 21 2009 : 09:05:25 AM
What I meant was:

if I am in Banana class member function and just press ctrl+space, class members should have some priority amongst the sea of other external symbols. Because many times you don't remember the exact name of the member and just start typing to use VAX's help in figuring it out. And often times VAX displays lots of symbols from all include files you almost never even use.

And thanks! I am anxiously looking forward to this feature being implemented.
feline Posted - Mar 02 2009 : 2:41:08 PM
We are considering having VA hide items from listboxes that you cannot currently access:

case=24551
feline Posted - Feb 28 2009 : 09:02:42 AM
quote:
Originally posted by GennadiyKorol

When I wrote about giving the priority to class members I have meant that if I use autocompletion on an empty space or partially typed name, the completion list should show me class members first.

Right now it will show bunch of other symbols coming from various include files.



Can you post a screen shot of what you are seeing? It sounds like you are looking at a suggestion listbox, which is just VA's best guess, and is not tied to any class or structure.

A completion listbox will show you only the things that should be valid at this point, e.g. class members.
GennadiyKorol Posted - Feb 27 2009 : 6:43:32 PM
Here is how Netbeans handles my example + your problematic macro:




It perfectly understands our macro-declared smart pointer.
It also has context-sensitive completion beautifully understanding friend function and filtering private member from within the main() method.
And all that while working via a -> operator of a macro-declared template class...



When I wrote about giving the priority to class members I have meant that if I use autocompletion on an empty space or partially typed name, the completion list should show me class members first.

Right now it will show bunch of other symbols coming from various include files.
feline Posted - Feb 27 2009 : 12:51:55 PM
Pre-processors, I was once sent a file that was something like 7,000 lines of solid macro's, #if, #else, #endif code, where symbols were defined and undefined as the file went on.

Surprisingly enough VA did not understand the file correctly.

A simpler example of the sort of thing that people like to do:

#define MacroDeclareSharedPtr( classname ) \    class classname; \    typedef MacroTyoeSharedPtr<classname> classname##Ptr

MacroDeclareSharedPtr( TestType );


I have just pulled this from a bug report, and not tried to construct a full test case.

Consider a pile of code like this, and add in inheritance, where base classes came from a macro constructed class...

Without running the code through a full pre-processor it gets very hard to process it.

A pre-processor is easy *IF* you have all the required information. However VA often does not have all required information. Remember that a header file that uses:

#ifdef FOO_THING
#else
#endif

can expand into block 1 in foo.cpp and block 2 in bar.cpp in the same solution.

Also the IDE uses macro's that our users actually want VA to treat as functions, and not expand them. Any of the macros that hide unicode / non unicode functions are a good example.

Remember we plug into the IDE, but the IDE does not know we are there. If you control the entire environment, and thus have access to all of the information about the state of the environment things are a lot easier


Your sample code, this is exactly why I am wary of sticky filters. As soon as you turn one on (perhaps by accident), and forget (do not know) it is turned on, you contact support complaining that VA is broken.


In the code you had the comment:

// Here the privateRyan is visible in the completion list!
// By the way, some priority to class members should be given here as well.

yes, private members are visible since in general VA does not know if you have access to them or not.

Priority to class members??? You have a listbox showing only class members, there are no non class members to give lower priority to. If you mean prefer variables over functions then why? I can make an argument that functions should have priority over variables.
alexandrk Posted - Feb 24 2009 : 11:23:53 AM
I think this idea with scope aware completion list is very good. I also work in the IntelliJ IDEA (it is the Java IDE) and this feature is implemented there, and it help alot.
Of course Java and C++ differ in many ways, because of preprocessor dirrectives it is harder to implement this feature in VAX (as mentioned in previous posts) but the preprocessor is not used every where. But there are many simple cases.
Even if VAX confused it can always decide to show what he 'thinks' is right and if programmer wants to see all members/functions then just make 'ctrl-space' and show all of them. And in very difficult case just show all members/function.

Another suggestion is to show the completion list with the different order of functions: show public functions first, then protected and only then private. Constructor and destructor can always be in the end of completion list or even just remove them from completion list. I dont think that some one would call destructor from the code. Event if someone does it is very rare.
GennadiyKorol Posted - Feb 22 2009 : 2:24:17 PM
quote:
Originally posted by feline

There is confusion I do not understand what you are talking about here.



The code example hopefully explains it a bit better:


class Apple 
{
public:
   int compare(const Orange & orange) const;
   float juiciness() const;

   double _weird;

private:
   Person privateRyan;
};


// Writing other code:
int Apple::compare(const Orange & orange) const 
{
   // Here the privateRyan is visible in the completion list!
   // By the way, some priority to class members should be given here as well.
   Apple apple;
   apple. | compare()    |
          | juiciness()  |
          | _weird       |
          | privateRyan  |
}


void squeezeTheApple(Apple & apple)
{ 
     // This function has no private access to the Apple class.
     // Only the public members are visible.
     // _weird member is optionally hidden here as well, just because of the prefix, even though it's accessible.
     apple. | compare()    |
            | juiciness()  |
}



quote:
Originally posted by feline
Firstly you need to know ALL pre-processor declarations in order to do this correctly. If it works 90% of the time this is a problem, since 10% of the time you are getting the wrong result. The IDE lets you set pre-processor directives in lots of places.

Secondly the code after running the pre-processor may be quite different to the code you are editing, causing all sorts of problems with scope, etc.

Thirdly, VA is designed to help you with code that is inactive. Code inside a #if 0 block, or a #ifdef LINUX block. This code would be removed as soon as you run the pre-processor, making it rather hard to help you with it.

Before you say "no one ever does that" what about #ifdef DEBUG blocks?



The idea is to run the pre-processor to be able to deal with those hard-cases.

But after all there are only so many places in the IDE where you can affect the preprocessor definitions.

VAX is already working with #ifdef SYMBOL example, how different is it from any other preprocessor case? The SYMBOL can as well be defined in various places in the IDE and yet VAX supports it (?).

It doesn't seem hard (personally) to implement the C++'s preprocessor (which is basically that one of C). Not nearly as hard as a C++ parser.


quote:

The sample code you posted, if NetBeans is running the code through a pre-processor then it is not going to have any problems with macro's, since it never sees them. I do wonder how it handles "commented out" code though.



The example I posted is actually an example of commented out code using an #ifdef and Netbeans is handling it with ease. If you have time, let me know of a problematic example so we could see how Netbeans deals with it.


Let me know what you think :)
feline Posted - Feb 09 2009 : 10:44:34 AM
quote:
Originally posted by GennadiyKorol

I don't think we're on the same page for my latest suggestion about _members.

What I meant was, given you implement context-sensitivity in the suggestion lists, you will not have the problem with _members that are declared public in the STL and at the same time you won't have the problem of not showing the private _members of user classes (the case you suggested is a possible problem), since in this case the _filtering shouldn't be applied.


There is confusion I do not understand what you are talking about here.


Running the pre-processor, I don't know enough to give you a complete answer, but there are a few good reasons for VA not running the pre-processor.

Firstly you need to know ALL pre-processor declarations in order to do this correctly. If it works 90% of the time this is a problem, since 10% of the time you are getting the wrong result. The IDE lets you set pre-processor directives in lots of places.

Secondly the code after running the pre-processor may be quite different to the code you are editing, causing all sorts of problems with scope, etc.

Thirdly, VA is designed to help you with code that is inactive. Code inside a #if 0 block, or a #ifdef LINUX block. This code would be removed as soon as you run the pre-processor, making it rather hard to help you with it.

Before you say "no one ever does that" what about #ifdef DEBUG blocks?


The sample code you posted, if NetBeans is running the code through a pre-processor then it is not going to have any problems with macro's, since it never sees them. I do wonder how it handles "commented out" code though.
GennadiyKorol Posted - Feb 06 2009 : 10:04:16 AM
I have just tried this code:


#define DUMMY

#ifdef DUMMY
#define DECLARE_MEMBER(name, args) \void name(args) { \    \}
#else
#define DECLARE_MEMBER(name, args)
#endif


template <typename T>
class A
{
    public:
        DECLARE_MEMBER(cool, int)
        DECLARE_MEMBER(cool, double)
};




All completion features and compiler error highlighting works as expected. As soon as you undefine the DUMMY, cool(int) and cool(double) disappear from the completion list and the code using them is marked as erroneous.


And Netbeans is doing this without running the compiler.
GennadiyKorol Posted - Feb 06 2009 : 09:54:44 AM
I don't think we're on the same page for my latest suggestion about _members.

What I meant was, given you implement context-sensitivity in the suggestion lists, you will not have the problem with _members that are declared public in the STL and at the same time you won't have the problem of not showing the private _members of user classes (the case you suggested is a possible problem), since in this case the _filtering shouldn't be applied.


Can't you run just the compiler's preprocessor on the source file, to obtain the source file after macros have been applied and parse that file, solving the Macro problem?


Btw, can you give me the example of interesting code, I could check it out with NetBeans. So far it worked like a charm with all complex libraries I threw at it.
feline Posted - Feb 06 2009 : 09:16:43 AM
This assumes that VA can correctly work out the scope. In simple cases this is easy, no problem at all. However quite a lot of code is not simple.

I have lost count of the number of bug reports centred around using macro's to create classes.

Then you get friend classes / functions, macro's used to implement inheritance, etc.

Plus of course overloaded functions. VA currently does not know which overload is which. If ALL overloads of a given function always have the same "scope" (public, private, etc) then this problem can be ignored, but this is unlikely to be the case.

Members that start with _, as far as I can tell on a quick check of std::string these are all public members. So even assuming we did this, it would not actually help with your very good example case, since they should be shown, since they are available and valid members.

I have never worked with eclipse or NetBeans, but as I said before, I wonder how well they work with some of the more "interesting" code that gets posted here as part of the bug reports.
GennadiyKorol Posted - Feb 06 2009 : 07:01:24 AM
That's why I suggested that the filtering should be context sensitive as it is in NetBeans or Eclipse.
The idea is very simple:

If you are working inside a scope that can access a private/protected member - show it.
If you are working inside a scope that cannot have access to private/protected members - do not show it.


Same logic can be applied for the _member filtering.

If I am in a scope that cannot access the private members, filter the _ members as well (optionally).
If I am in the scope that can access private members, do not filter _ members.


This way you have both problems solved.
feline Posted - Feb 02 2009 : 5:50:03 PM
Automatically hiding private members, it depends on what you are doing. Personally I often work on a class, so I actually need to see the private members in the listboxes, since I am writing the class its self.

Automatically filtering out items that start with underscore will cause problems for anyone who starts all member variables with an underscore. I have seen this as a code standard. Having said that, I do see the appeal for the STL, so I have put in a feature request to add a filter button for this:

case=23533
GennadiyKorol Posted - Jan 29 2009 : 5:13:43 PM
You guys should really check NetBeans 6.5. Given it is not optimal it is doing many things right for C++.

For instance this requested feature is implemented in there which makes for a much cleaner code completion experience.




Using the same opportunity I would like to ask for an option to hide the symbols prefixed with _ from the suggestion list unless asked otherwise (with one of the buttons underneath the suggestion list).

That helps a lot with template libraries like stl, where you have a lot of _Assign, _Construct and other functions in public namespace.
feline Posted - Sep 22 2008 : 11:37:29 AM
I have put in a feature request to add an option to make the listbox filter sticky:

case=19892

This is an interesting idea.

The broader point about only showing accessible items by default, I am tempted to agree with you. This is a reasonable idea, but I am concerned about some of the edge cases.

Friend functions are simply an easy one to describe. Quite a lot of our users do "interesting" things with IDE macro's. I know from the support queries this generates.

Another area to consider are people who like to type a private member just so they can use alt-g on this to jump into the code. I have done this myself any number of times.

I think that in part it depends on what you are doing, and how you work. When working with my own classes I often am interested in the internal, private details, even if only to remind myself of how I implemented the class. But with library classes (black boxes) I don't care about the private members.
GennadiyKorol Posted - Sep 19 2008 : 11:39:29 AM
Yeah, but you absolutely prefer the private items to be hidden when you're using other classes, because all that matters to you is the public interface.

They can both help and disturb. A toggling hotkey could help a lot. For instance alt+p toggles the completion list to be only public or not.

But ideally VAX should figure the stuff by context. Ie, if I'm implementing class function that can access private variables - show them. If I'm implementing static function - do not show them.

This will probably have to extend to derived classes, so the same applies to protected members (ie, hide private, show protected if in derived class).

Personally for me, friends are of least priority, using them very rarely cause often time better design solutions exist. If they overcomplicate the implementation (which otherwise seems easy having VAX parser working) you could just ignore them in the first revision and make this feature optional.

I still think the programmers workflow should be optimized for the common case. Friends are not common case for most of the programmers (are they?) so having to click on "show private" icon in those rare cases is much better than having to always click "show only public" in the common case.
feline Posted - Sep 17 2008 : 5:12:04 PM
The main problem here is that VA does not always know when you only want to see the public members of a class. Friend classes / functions are a good example of when it is hard for VA to work this out.

We did consider making the filter buttons sticky, but we were concerned that this would cause problems, with people wanting to know why most of the items are missing from the listboxes. You normally want to see all of the items when working on your own classes, or inside a class.

Would sticky filters actually help you, or are they going to get in the way when you are writing / working on your own classes?

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000