Class FuzzySymbolSearch
java.lang.Object
org.ek9lang.compiler.search.FuzzySymbolSearch
Provides fuzzy symbol search functionality using Levenshtein distance.
Used to generate "Did you mean?" suggestions when symbols cannot be resolved.
This class searches scopes and aggregates for symbols with names similar to a target name, returning the best matches ordered by similarity (lowest cost first).
Callers should check whether fuzzy suggestions are enabled (E2+ error level)
before invoking these methods, via ErrorListener.isFuzzySuggestionsEnabled().
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfindSimilarMethods(IAggregateSymbol aggregate, String methodName) Search for methods with names similar to the target method name in the given aggregate and its super aggregates.findSimilarProperties(IAggregateSymbol aggregate, String propertyName) Search for properties with names similar to the target property name in the given aggregate.findSimilarSymbols(IScope scope, String targetName) Search for symbols with names similar to the target name in the given scope and all enclosing scopes.findSimilarTypes(IScope scope, String typeName) Search for types with names similar to the target type name in the given scope and all enclosing scopes.
-
Constructor Details
-
FuzzySymbolSearch
public FuzzySymbolSearch()
-
-
Method Details
-
findSimilarSymbols
Search for symbols with names similar to the target name in the given scope and all enclosing scopes.- Parameters:
scope- The scope to start searching fromtargetName- The name to find similar matches for- Returns:
- MatchResults containing the best matches (up to MAX_RESULTS)
-
findSimilarMethods
Search for methods with names similar to the target method name in the given aggregate and its super aggregates.- Parameters:
aggregate- The aggregate to search inmethodName- The method name to find similar matches for- Returns:
- MatchResults containing the best matching methods (up to MAX_RESULTS)
-
findSimilarProperties
Search for properties with names similar to the target property name in the given aggregate.- Parameters:
aggregate- The aggregate to search inpropertyName- The property name to find similar matches for- Returns:
- MatchResults containing the best matching properties (up to MAX_RESULTS)
-
findSimilarTypes
Search for types with names similar to the target type name in the given scope and all enclosing scopes.- Parameters:
scope- The scope to start searching fromtypeName- The type name to find similar matches for- Returns:
- MatchResults containing the best matching types (up to MAX_RESULTS)
-