Author Topic: Sub-word pattern matching for completion with Java enum  (Read 1350 times)

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
Sub-word pattern matching for completion with Java enum
« on: July 25, 2020, 09:50:32 PM »
I love the new feature for sub-word pattern matching for completion! I really wanted this feature!

I have found it working in many cases, but I think I found a case where it doesn't work in Java with enums in 25.0.0.1 on Windows x64.

Sample:

Code: [Select]
public class EnclosingClass
{
  enum EnumInClass
{
ITEM1,
ITEM2
}

// Constructor
EnclosingClass()
{
// After the dot type "TEM" as below and ITEM1, ITEM2 don't show up in completion list
EnumInClass.TEM
}
}

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6866
  • Hero Points: 528
Re: Sub-word pattern matching for completion with Java enum
« Reply #1 on: July 26, 2020, 12:24:06 AM »
Have you tried a different "Subword matching stategy:" Languages>Java>AutoComplete

My understanding is that most of the the subword matching strategies are optimized by creating an index based on the symbol name (casing, underscores, etc.). Try "Simple subword matching". I think that one is a raw search. It will be slower. It worked for me.

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
Re: Sub-word pattern matching for completion with Java enum
« Reply #2 on: July 26, 2020, 04:00:53 PM »
It was set to "Stone-skipping with subword boundaries". When I change to "Simple substring matching" it does work.

How come it doesn't work with the default strategy? Is that a bug? Shouldn't it also work with the default strategy?

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6866
  • Hero Points: 528
Re: Sub-word pattern matching for completion with Java enum
« Reply #3 on: July 26, 2020, 04:11:29 PM »
Definitely not a bug. It's an intentional limitation which provides better performance.

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
Re: Sub-word pattern matching for completion with Java enum
« Reply #4 on: July 26, 2020, 05:40:32 PM »
But I don't have this problem with Java non-enums?

Why only this problem with Java enums, but not with Java member functions or member variables?

Since it only happens with enums but not member functions/variables, I suspect that it is a bug.

I don't need to change the strategy with member functions/variables, sub word completion works fine with those and the default strategy.
« Last Edit: July 26, 2020, 05:42:23 PM by rowbearto »

Dennis

  • Senior Community Member
  • Posts: 3961
  • Hero Points: 517
Re: Sub-word pattern matching for completion with Java enum
« Reply #5 on: July 27, 2020, 02:44:58 PM »
That definitely is a bug, both items should show up in the list.  I'll test and see what is going wrong there.  Thanks for the example.

Note:  "tem" would not generally be a good subword pattern for "Item" when searching using the stone skipping technique.  You get away with it in this case because it is the first subword, and we have a special case for short identifier prefixes (like Polish notation).  In general, stone skipping on word boundaries means hitting the top of the wave, that is, the first letter needs to match, you can't drop into the middle of a subword.  The "pure stone skipping" technique would allow that, because it ignores subword boundaries, as would the "Simple substring matching" that Clark suggested, but that is not a very powerful technique because it can't complete identifiers using acronyms.

Dennis

  • Senior Community Member
  • Posts: 3961
  • Hero Points: 517
Re: Sub-word pattern matching for completion with Java enum
« Reply #6 on: July 27, 2020, 05:32:01 PM »
This will be fixed in the next beta build.