This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 168059 - Code completion without ::->. triggers or Hotkey
Summary: Code completion without ::->. triggers or Hotkey
Status: NEW
Alias: None
Product: cnd
Classification: Unclassified
Component: Code Completion (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker with 2 votes (vote)
Assignee: Vladimir Voskresensky
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-02 19:12 UTC by ksc91u
Modified: 2009-12-14 08:30 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
code completion after key stroke (10.98 KB, patch)
2009-12-12 10:34 UTC, ksc91u
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description ksc91u 2009-07-02 19:12:25 UTC
I wish there could be a Xcode  like code completion.

For instance, if I type p, Xcode shows printf, perror ... functions or variables start with p.

In NetBeans, I have to use Ctrl+Space or :: trigger.

Also, if I type ::p, code completion won't show up, I have to type ::, wait for 0.5 seconds to type p, hope this can be
fixed.
Comment 1 Vladimir Voskresensky 2009-07-05 17:17:02 UTC
thanks for request
Comment 2 ksc91u 2009-12-12 10:34:45 UTC
Created attachment 92464 [details]
code completion after key stroke

Hello,
I have made some changes to code completion module and testes myself.

Now code completion shows up after every key stroke other than ") ; }", these three chars often indicate an end of statement.

Sorry that I am new to hg, do not know how to combine two change sets.

Also do not know how to hint after only one char is typed, eg 'p' -> printf, now hint only begins after at least two chars.

Could anybody kindly give comments and hint to some simple mercurial tutorial.

Thanks a lot.
Comment 3 Vladimir Voskresensky 2009-12-12 14:39:54 UTC
Hi,
Thanks for trying :-)
I think, we should be consistent with Java editor.
Java editor has a Code Completion option which allow to popup completion window on typing any character.
what do you think?

Thanks,
Vladimir
Comment 4 ksc91u 2009-12-12 19:35:38 UTC
(In reply to comment #3)
> Hi,
> Thanks for trying :-)
> I think, we should be consistent with Java editor.
> Java editor has a Code Completion option which allow to popup completion window
> on typing any character.
> what do you think?
> 
> Thanks,
> Vladimir

You meant the Popup on Typing Any Java Identifier Part option?

That would be nice but I don't see Xcode does that, maybe Visual Assist X does.

The difference between C/Java is that Java has much fewer hint candidates. C/C++ may have too many macro definitions, structure...etc, all in the global namespace.

If the list could be sorted in some way, like put function definition to the top of list(now it is behind structure and macros).  Then hint at first character would more useful.
Comment 5 ksc91u 2009-12-13 07:24:50 UTC
I found there is a CPP_AUTO_COMPLETION_TRIGGER in options/CodeCompletionPanel.java, cplusplus/CsmCompletionUtils.java but not used in cplusplus/ext/CompletionSupport.java:needShowCompletionOnText.

Is that the reason configuration in GUI does not change anything?
Comment 6 Vladimir Voskresensky 2009-12-13 13:59:55 UTC
you are right, CPP_AUTO_COMPLETION_TRIGGER is not used.
But I was talking about analog of Java's "Auto Popup on Typing Any Java Identifier Part"

Can we decide what exactly you'd like to have (do not forget consistency with java) :-)
Comment 7 Vladimir Voskresensky 2009-12-13 14:04:30 UTC
> The difference between C/Java is that Java has much fewer hint candidates.
> C/C++ may have too many macro definitions, structure...etc, all in the global
> namespace.

there are two modes of Code Completion lists. One is small and the second is full.

> 
> If the list could be sorted in some way, like put function definition to the
> top of list(now it is behind structure and macros).  Then hint at first
> character would more useful.

I agree that sorting could be better considering the current context where code completion is invoked. But can we define such rules?
Comment 8 ksc91u 2009-12-13 23:55:31 UTC
Rules I think of so far,

1. hide #define macros unless they are defined in the same project, or have been used once on the project. 

2. put functions at the top of list, then structures, then macros.

3. put whatever functions/macros/structures that have been used in the project at the top.
Comment 9 Vladimir Voskresensky 2009-12-14 02:58:51 UTC
what about put local variables at the top of list, not functions?
Comment 10 ksc91u 2009-12-14 08:30:20 UTC
(In reply to comment #9)
> what about put local variables at the top of list, not functions?

I think that pretty make sense.

1. local variable
2. variable/function in the same file
3. others from include headers.

sort by how close they are to the cursor, ;)