Also compare full definition if matches
This commit is contained in:
parent
93fcbc827b
commit
88f04e5d16
|
|
@ -592,7 +592,17 @@ void setCompletions(T)(ref AutocompleteResponse response,
|
|||
{
|
||||
if (sym.name !is null && sym.name.length > 0 && isPublicCompletionKind(sym.kind)
|
||||
&& (p is null ? true : toUpper(sym.name.data).startsWith(toUpper(p)))
|
||||
&& !r.completions.canFind!(a => a.identifier == sym.name && a.kind == sym.kind)
|
||||
&& !r.completions.canFind!((a) {
|
||||
// this filters out similar symbols
|
||||
// this is needed because similar symbols can exist do to version conditionals
|
||||
// fast check first, only compare full definition if it matches
|
||||
bool same = a.identifier == sym.name && a.kind == sym.kind;
|
||||
if (same) {
|
||||
auto info = makeSymbolCompletionInfo(sym, sym.kind);
|
||||
if (info.definition != a.definition) same = false;
|
||||
}
|
||||
return same;
|
||||
})
|
||||
&& sym.name[0] != '*'
|
||||
&& mightBeRelevantInCompletionScope(sym, completionScope))
|
||||
{
|
||||
|
|
@ -610,7 +620,17 @@ void setCompletions(T)(ref AutocompleteResponse response,
|
|||
auto currentSymbols = completionScope.getSymbolsInCursorScope(cursorPosition);
|
||||
foreach (s; currentSymbols.filter!(a => isPublicCompletionKind(a.kind)
|
||||
&& toUpper(a.name.data).startsWith(toUpper(partial))
|
||||
&& !response.completions.canFind!(r => r.identifier == a.name && r.kind == a.kind)
|
||||
&& !response.completions.canFind!((r) {
|
||||
// this filters out similar symbols
|
||||
// this is needed because similar symbols can exist do to version conditionals
|
||||
// fast check first, only compare full definition if it matches
|
||||
bool same = (r.identifier == a.name && r.kind == a.kind);
|
||||
if (same) {
|
||||
auto info = makeSymbolCompletionInfo(a, a.kind);
|
||||
if (info.definition != r.definition) same = false;
|
||||
}
|
||||
return same;
|
||||
})
|
||||
&& mightBeRelevantInCompletionScope(a, completionScope)))
|
||||
{
|
||||
response.completions ~= makeSymbolCompletionInfo(s, s.kind);
|
||||
|
|
|
|||
Loading…
Reference in New Issue