Bug 63164 - Code/Function completion done in comments
Summary: Code/Function completion done in comments
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Code completion (show other bugs)
Version: git master
Platform: openSUSE Linux
: VLO wishlist
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
: 91832 114521 123068 126858 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-08-23 13:36 UTC by ecarpenter
Modified: 2006-12-23 01:04 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ecarpenter 2003-08-23 13:36:26 UTC
Version:           gideon 3.0.0 5a (CVS Date 2003/8/23) (using KDE KDE 3.1.3)
Installed from:    SuSE RPMs
OS:          Linux

The editor is displaying the function dropdown list with suggested function names while the cursor is positioned in a comment block.  The dropdown should only be displayed while the cursor is in "active" code.

This a real problem in the following case (using PHP) where the developer wants to place comment at the end of a piece of code.

<some php code> //if

The above results in the function drowndown list being  displayed with all the functions starting if "if".
Comment 1 Jens Dagerbo 2003-08-24 03:01:48 UTC
Confirmed. Hardly a severe problem though.. 
Comment 2 ecarpenter 2003-08-24 16:04:05 UTC
true, but it can get very annoying when one moves up and down through a 
document and every time the cursor moves pass a comment like "//if" it displays 
a dropdown box. 
Comment 3 Jens Dagerbo 2004-10-22 00:35:14 UTC
*** Bug 91832 has been marked as a duplicate of this bug. ***
Comment 4 Amilcar do Carmo Lucas 2005-10-16 18:45:18 UTC
*** Bug 114521 has been marked as a duplicate of this bug. ***
Comment 5 Dan Bullok 2005-10-16 22:46:54 UTC
I agree that this behavior might not always be desired, but it's hardly a bug.
When typing comments, I frequently refer to variables and functions in the code, and the completion saves me time, and makes sure that I spell the names correctly.  I can understand wanting to disable this behavior.  But I don't think it's a bug.  Please consider turning this into a wishlist item instead of a bug report (I could do that, but I think it's fair to get feedback first).  A simple checkbox that disables the completion in comments would please the people that think it's a problem without annoying those of us who like it.

Comment 6 Pau Capdevila 2005-12-20 14:31:02 UTC
For me: severity = wish.

Thanks,
Comment 7 Jakob Petsovits 2006-03-05 22:13:55 UTC
*** Bug 123068 has been marked as a duplicate of this bug. ***
Comment 8 Haris Kouzinopoulos 2006-04-23 05:17:45 UTC
No please, not another option :/ 
Compare the times you want to refer to a function inside a comment vs the times you don't. This is a bug and a very irritating one.
Comment 9 Maciej Pilichowski 2006-05-09 19:38:58 UTC
I accidently wrote similar report for kate directly, so here is the most important part from that report:

Please add an option to control the "source" for auto word completion feature: 
 Whole document except [ ] comments [ ] quotations 

and I agree that getting words from comments are pretty annoying.
Comment 10 Dirk Mueller 2006-05-09 22:49:07 UTC
*** Bug 126858 has been marked as a duplicate of this bug. ***
Comment 11 Diederik van der Boor 2006-05-09 22:56:38 UTC
> I accidently wrote similar report for kate directly,
> so here is the most important part from that report: 
> Please add an option to control the "source" for auto
> word completion feature: Whole document except
> [ ] comments [ ] quotations 
> and I agree that getting words from comments are
> pretty annoying. 

At this point I wonder what happens when the usability people see this. My guess is, they'd recommend to remove the option straight away. I'll agree with Haris: there are hardly any reasons why you want code completion in comments. And most comments contain English text, not code.

But for what it's worth.. I'd even rather have another (stupid IMHO) option that a long debate about what to do, because this bug is getting a big annoying. ;-)
Comment 12 Ferenc Veres 2006-05-10 00:03:56 UTC
I agree with complete removal of completion in comments and string constants. Maybe it's not a question of voting which solution to do, but let me add a little pointer: if Microsoft in Visual Studio decided to go that way, there may be some good reason... ;-)
Comment 13 Amilcar do Carmo Lucas 2006-05-10 00:25:48 UTC
Sorry, but I agree with comment #5.
I like code completion in the comments.

And nobody as yet provided a scenario where this can be considered a bug.

So basically it should be configurable.
This is IMHO a very low priority wishlist.
Comment 14 Jens Dagerbo 2006-05-10 01:05:40 UTC
No, it really shouldn't be an option. 

Fortunately, we're currently testing a recently submitted patch that appears to do the Right Thing for C++: It does not automatically complete inside comments, but it does complete when explicitly asked to do so (using the ctrl+space shortcut).

Unfortunately, this doesn't affect the PHP Code Completion that the reporter used as an example.
Nor will it affect the "word completion" that Maciej Pilichowski talks about, since that is a KTextEditor plugin (part of the kate codebase) and works completely on strings and has no knowledge (afaik) about context.
Comment 15 Haris Kouzinopoulos 2006-05-10 01:21:16 UTC
I completely disagree with #13. Its definately a bug and a very high priority IMHO. With annoyances like this one people are turned away from kdevelop

The times you don't need autocompletion in a comment and having an annoying popup in EACH word you write over the times you actually need autocompletion in comments is around 100/1

And diederik is right: please no more configuration bloat :/
Comment 16 Maciej Pilichowski 2006-05-10 07:40:26 UTC
> It does not automatically complete inside comments, but it does complete
> when explicitly asked to do so (using the ctrl+space shortcut). 

> Nor will it affect the "word completion" that Maciej Pilichowski talks
> about, since that is a KTextEditor plugin (part of the kate codebase) and
> works completely on strings and has no knowledge (afaik) about context. 

Now I am a bit puzzled -- if plugin/engine/program knows where to put AC words why it doesn't know where to get AC words. It is the same context recognition I guess.

Btw. after your reply I realized that this whole report is similar but not so similar after all to my original report -- should I open new report with wish about this reversed-AC ;-) problem?
Comment 17 Diederik van der Boor 2006-05-10 19:23:11 UTC
quoting comment #5:
> And nobody as yet provided a scenario where this can be considered a bug.

End your sentence with a period, then press enter. you'll get code completion instead of a newline.

quoting comment #14
> not automatically complete inside comments, but it does complete when explicitly asked to do so (using the ctrl+space shortcut).

That sounds really cool! I hope this version will be implemented as solution. Nobody will be bothered with unwanted code completion, unless you ask for it :)
Comment 18 Maciej Pilichowski 2006-05-10 19:44:14 UTC
>  The times you don't need autocompletion in a comment and having an annoying
> popup in EACH word you write over the times you actually need autocompletion
> in comments is around 100/1 

You are just saying that you would like to be 99% instead of 100%. Excuse me, but I would like to be 100% productive. Clip your "wings" in other areas like this and wonder why you spend so much time fighting with every-day work.

> And diederik is right: please no more configuration bloat :/ 

Why not? Because Kdevelop would be too powerful tool?

After another session with writing code I think (I still opt for configuring AC) that the best would be even more flexible approach -- configuring sources for AC and for each source possible target.

Source and target would be -- source code, comments, quotations. This way I could configure AC that I can use words from source code in comments, but not vice versa (plus source code in source code, comments in comments, etc.).

Writing code and comments for it (when I use names of variables, methods, etc) would be much faster (and less stressing my hands -- which I greatly appreciate).
Comment 19 Jens Dagerbo 2006-05-10 20:31:37 UTC
This started out as a bug report against php code completion. (Is it still valid?) And now it's.. what, exactly?

Unless an issue can be reasonably "scoped", it can never be implemented/fixed and the report just turns into bug database bloat.
Comment 20 Maciej Pilichowski 2006-05-10 22:11:25 UTC
> This started out as a bug report against php code completion. (Is it still
> valid?) 

For C++ -- sure.

> And now it's.. what, exactly? 

Original report -- AC kicks in within comments. Complementary problem (if I should "fork" this please let me know) -- AC gets words from comments.

Try to type:
const
// co|

and vice-versa

// football
fo|
Comment 21 Jens Dagerbo 2006-05-10 22:34:44 UTC
@Maciej
Yeah, I suspected that.. What you are seeing is completion from the katepart wordcompletion plugin. Go into Settings->Configure Editor->Plugins. I'm betting you have "KTextEditor Word Completion Plugin" active. Right?

That feature, as Anders Lund explained in Bug #126858 only "searches for text" and has no concept of "inside comments" or such.

If you have both it, the kdevelop abbrev plugin and c++ code completion active, you will probably have a bit of a mess (and sometimes confusing results).
Comment 22 Maciej Pilichowski 2006-05-10 22:47:05 UTC
> What you are seeing is completion from the katepart wordcompletion plugin.
> Go into Settings->Configure Editor->Plugins. I'm betting you have
> "KTextEditor Word Completion Plugin" active. Right? 

Right. But is this something wrong?
 
> That feature, as Anders Lund explained in Bug #126858 only "searches for
> text" and has no concept of "inside comments" or such. 

Yes, I know, my point is -- it should get that concept :-) I understand why it works the way it does.
 
> If you have both it, the kdevelop abbrev plugin and c++ code completion
> active, you will probably have a bit of a mess (and sometimes confusing
> results). 

Why? AC kicks in automatically, abbreviations -- not. I have to press ctrl+l to "unfold" abbreviation.
Comment 23 Jens Dagerbo 2006-05-10 22:59:36 UTC
Well, if you disagree with how the katepart word completion works, you should make a wish against that software, not kdevelop. (Which you already have with bug #126858...)

Looks like you are right about abbrev.. I think it has changed behaviour since I last used it (I've had it off for years) ;)

We have "CC" - CodeCompletion (This is implemented in KDevelop and is based on a language parser.) and "WC" - Word Completion (This is implemented in Kate(part).) "AC" is your invention. :) 

CC is the only thing that can be affected from KDevelop, and for C++, it will be updated in 3.4. I don't know the state of PHP-CC.
Comment 24 Darrell Duffy 2006-06-30 18:10:44 UTC
Can we please just get a checkbox that will cause code completion to be turned off in comments. Looks like there are significant numbers of us that are on both sides of this issue. Personally I find that it's impossible to comment my code with this enabled.

I'm using 3.3.3 on 3.5.1 level 'a' on SUSE 10.1 btw,

Thanks for listening.
dd
Comment 25 Keri R. Hedman 2006-09-16 00:31:29 UTC
This line of concern/interest was opened 2003-08-23. I am new to the kde website system. Has this bug/wish been put to rest? If so, how do I fix it/turn it off? I am currently using KDevelop 3.3.2 (KDE 3.5.4). I really must turn this off or remove it, I don't care. My productivity is going down due to this issue and that is a problem. I use a lot of comments in my code and having this pop up show up for every character or add stuff to the end of my comments simply because I hit return is causing me MAJOR problems. If a fix isn't presented soon, even if it is to turn off all auto completion capability, I will have to stop using KDevelop. Please help.
Comment 26 greatbunzinni 2006-09-17 01:59:53 UTC
Keri

The bug is still marked as new, which indicates that the KDevelop developers are still looking at it. 

Unfortunately that doesn't mean anything. There are still bug reports which are marked as new since 1999 and which were sent when KDevelop was in 1.0-beta1. So what means that a report with a New status can mean anything at all. It can mean that the developers are indeed seriously looking at it but it can also mean that they know that the bug exists but they don't feel like fixing it.

To make matters worse, sometimes you can even fix the bug yourself and post the patch and not only that fix won't be accepted but also the bug will persist.

Sad but true.
Comment 27 Gunther Piez 2006-09-17 11:56:06 UTC
You can disable automatic Code Completion completly, I think it is in the "C++ Settings". I have disabled it for exact that reason.
Comment 28 Amilcar do Carmo Lucas 2006-09-17 20:40:44 UTC
This has been fixed three months ago already:
http://websvn.kde.org/branches/kdevelop/3.4/?rev=546311&view=rev
Comment 29 James 2006-12-23 00:33:13 UTC
This "feature" doesn't seem fixed to me using Fedora Core 6, KDE 3.5.5-0.2.fc6 and KDevelop 3.3.5.

Autocomplete still pops up within comments.
Comment 30 Andreas Pakulat 2006-12-23 01:04:31 UTC
Hi James, 

of course this is not fixed in 3.3.5, because there's basically no development on 3.3 anymore. Any development for kdevelop3 is taking place in the 3.4 branch, including the fix for this bug.

Check the kdevelop.org website for the rc2 or install directly from the svn version.