Bug 243200

Summary: Code completion mis-parses //* resulting in not working
Product: [Applications] kdevelop Reporter: Andrew Fuller <mactalla.obair>
Component: Code completionAssignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: minor CC: nalvarez
Priority: NOR    
Version: git master   
Target Milestone: 4.0.1   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Andrew Fuller 2010-06-29 22:20:14 UTC
Version:           SVN (using KDE 4.4.3) 
OS:                Linux

Code completion won't trigger after a comment beginning in //* until the scope changes.

Reproducible: Always

Steps to Reproduce:
Step 1: Open a c++ file and chose a place to use code completion.
Step 2: Type a bit or use ctrl-space to confirm the popup appears.
Step 3: Add a comment beginning in //* within the same scope.
Step 4: Try to trigger code completion after this comment (within the same scope).

Actual Results:  
Code completion won't trigger.

Expected Results:  
Code completion should trigger.

This is a valid one-line comment, but the code completion refuses to trigger.  I expect it's parsing it as a /* comment.

Severity is minor as it is easy to work around, but it is non-obvious for anyone who encounters it and feels like kdevelop is broken until my typo is discovered.
Comment 1 Nicolás Alvarez 2010-10-07 04:12:14 UTC
I can reproduce this in 4.1.
Comment 2 Nicolás Alvarez 2010-10-07 05:12:34 UTC
I think the solution is simply to make KDevelop::clearComments clear //comments before /*comments*/. After clearing //comments, it won't find a "/*" anymore, and it won't wrongly think the cursor is inside a comment.

I'll try this tomorrow.
Comment 3 Olivier.jg 2011-06-09 04:34:40 UTC
Git commit 1b51218cd6122230e40698934e7bcc311a92be07 by Olivier JG.
Committed on 09/06/2011 at 04:31.
Pushed by olivierjg into branch 'master'.

Fix clearComments() to work with "//*" and "/*//*/" stuff that it used to choke on
(See testClearComments in test_cppcodecompletion)
BUG: 243200

M  +30   -39   language/duchain/stringhelpers.cpp     

http://commits.kde.org/kdevplatform/1b51218cd6122230e40698934e7bcc311a92be07