nordfalk / jsyntaxpane

An updated version of code.google.com/p/jsyntaxpane r096 branch
36 stars 22 forks source link

Customizable StringUtils#camelCaseMatch()? #169

Closed GoogleCodeExporter closed 7 years ago

GoogleCodeExporter commented 9 years ago
Hi

I modified the StringUtils#camelCaseMatch() like this:

public static boolean camelCaseMatch(String word, String abbr) {
  return word.toLowerCase().startsWith(abbr.toLowerCase());
}

for my Symja project, to use lower case inputs also for keywords with upper 
case letters.

See the Symja-0.0.11-SNAPSHOT.jar and type "int Ctrl+SPACE" as input to see the 
effect:
http://code.google.com/p/symja/downloads/list

From the coding it seems you are planning to allow a Comparator for 
camelCaseMatch()?
How should this Comparator be customized?
Through a method in the corresponding Lexer class?

Have you considered using a TreeMap<String, Object> instead of a List<String> 
for huge completion lists to associate some "extra information" for the 
completion (like a help text)?

Original issue reported on code.google.com by axelclk@gmail.com on 4 Jan 2011 at 10:07

GoogleCodeExporter commented 9 years ago
It's been a while since I had a chance to look or modify the code.

Anyway, if I recall correctly, the camelCaseMatch, or any other language 
specific code, should be in an Action.  Then you map that specific Action to a 
certain key, or menu item in the properties of that language.  This was done, 
or supposed to be anyway, so that you can easily configure your own action for 
your language without breaking anything else.  Some languages are case-less, 
and their completion may be different than other case sensitive languages.  

As for the use of TreeMap, I think the main reason was to keep it simple and 
small.  This is still an editor, any performance for searching did not warrant 
the complexity of using a tree for me.

I'll be glad to see a benchmark of the difference and get your code 
incorporated in the mainstream if you'd like to share. 

Original comment by ayman.al...@gmail.com on 26 Feb 2011 at 5:50