Bug 372875

Summary: problem with semantic highlighting: operator[ std::string ]
Product: [Applications] kdevelop Reporter: OlafLostViking <olaf.the.lost.viking>
Component: Language Support: CPP (Clang-based)Assignee: kdevelop-bugs-null
Status: RESOLVED NOT A BUG    
Severity: minor CC: kogiokkafrms, mail
Priority: NOR    
Version: 5.0.2   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:

Description OlafLostViking 2016-11-24 08:54:20 UTC
The most awesome semantic highlighting (one if the main selling points for KDevelop ;-) ) seems to have a problem when using the operator[] with strings. I saw it first when using libconfig++, but I built a minimal example with unordered_map:

	std::unordered_map< std::string, std::string > kde_map;
	std::cout << "KDevelop is " << kde_map[ "kdevelop" ] << "!" << std::endl;

Here you can see that the squared brackets are coloured differently.
Comment 1 Sven Brauch 2016-11-24 18:52:03 UTC
Not a bug; the [ is a use of std::unordered_map<std::string,std::string>::operator[std::string]. Move your mouse or cursor over it to see uses of the same operator or get further information.

Closing as invalid.
Comment 2 OlafLostViking 2016-11-24 20:41:06 UTC
Thanks for having a look!

While I agree that [ is the u_map::op[str], I am wondering why the second bracket is coloured differently (like a normal array ]) and not in the special colour of the first bracket [.

Just to clarify what I meant (I simply don't understand the different colours) - not to insist that I'm right or whatever ;)
Comment 3 Sven Brauch 2016-11-26 15:24:17 UTC
Certainly a debatable choice, I guess the simple answer is that a single use always has a single range in KDevelop, and for this you'd need to associate two ranges to one use, i.e. technical reasons.
Comment 4 Francis Herne 2020-03-30 21:49:40 UTC
*** Bug 419423 has been marked as a duplicate of this bug. ***