Decrease the size of the ACSymbol struct
This commit is contained in:
parent
02063b87a3
commit
6a3cf3c572
|
@ -123,11 +123,8 @@ public:
|
|||
auto app = appender!(ACSymbol*[])();
|
||||
foreach (part; parts.equalRange(&s))
|
||||
app.put(part);
|
||||
foreach (extra; aliasThisParts.equalRange(&s))
|
||||
app.put(extra.getPartsByName(name));
|
||||
foreach (im; parts.equalRange(&p))
|
||||
foreach (part; im.type.parts.equalRange(&s))
|
||||
app.put(part);
|
||||
app.put(im.type.getPartsByName(name));
|
||||
return app.data();
|
||||
}
|
||||
|
||||
|
@ -142,11 +139,6 @@ public:
|
|||
*/
|
||||
TTree!(ACSymbol*, true, "a < b", false) parts;
|
||||
|
||||
/**
|
||||
* Symbols included due to an alias this.
|
||||
*/
|
||||
TTree!(ACSymbol*, true, "a < b", false) aliasThisParts;
|
||||
|
||||
/**
|
||||
* Calltip to display if this is a function
|
||||
*/
|
||||
|
|
|
@ -642,18 +642,20 @@ void setCompletions(T)(ref AutocompleteResponse response,
|
|||
if (symbols.length == 0)
|
||||
return;
|
||||
}
|
||||
TTree!(ACSymbol*, true, "a < b", false) parts;
|
||||
parts.insert(symbols[0].parts[]);
|
||||
foreach (s; symbols[0].aliasThisParts[])
|
||||
parts.insert(s.parts[]);
|
||||
foreach (s; parts[].filter!(a => a.name !is null
|
||||
&& a.name.length > 0 && a.name[0] != '*'
|
||||
&& (partial is null ? true : a.name.toUpper().startsWith(partial.toUpper()))
|
||||
&& !response.completions.canFind(a.name)))
|
||||
foreach (sym; symbols[0].parts[])
|
||||
{
|
||||
// Log.trace("Adding ", s.name, " to the completion list");
|
||||
response.completionKinds ~= s.kind;
|
||||
response.completions ~= s.name.dup;
|
||||
if (sym.kind == CompletionKind.importSymbol) foreach (s; sym.type.parts[])
|
||||
{
|
||||
response.completionKinds ~= s.kind;
|
||||
response.completions ~= s.name.dup;
|
||||
}
|
||||
else if (sym.name !is null && sym.name.length > 0 && sym.name[0] != '*'
|
||||
&& (partial is null ? true : sym.name.toUpper().startsWith(partial.toUpper()))
|
||||
&& !response.completions.canFind(sym.name))
|
||||
{
|
||||
response.completionKinds ~= sym.kind;
|
||||
response.completions ~= sym.name.dup;
|
||||
}
|
||||
}
|
||||
response.completionType = CompletionType.identifiers;
|
||||
}
|
||||
|
@ -865,10 +867,14 @@ void setImportCompletions(T)(T tokens, ref AutocompleteResponse response)
|
|||
}
|
||||
else if (isDir(name))
|
||||
{
|
||||
response.completions ~= name.baseName();
|
||||
response.completionKinds ~=
|
||||
exists(buildPath(name, "package.d")) || exists(buildPath(name, "package.di"))
|
||||
? CompletionKind.moduleName : CompletionKind.packageName;
|
||||
string n = name.baseName();
|
||||
if (n[0] != '.')
|
||||
{
|
||||
response.completions ~= n;
|
||||
response.completionKinds ~=
|
||||
exists(buildPath(name, "package.d")) || exists(buildPath(name, "package.di"))
|
||||
? CompletionKind.moduleName : CompletionKind.packageName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -146,7 +146,10 @@ private:
|
|||
auto parts = currentSymbol.acSymbol.getPartsByName(aliasThis);
|
||||
if (parts.length == 0 || parts[0].type is null)
|
||||
continue;
|
||||
currentSymbol.acSymbol.aliasThisParts.insert(parts[0].type);
|
||||
ACSymbol* s = allocate!ACSymbol(symbolAllocator, IMPORT_SYMBOL_NAME,
|
||||
CompletionKind.importSymbol);
|
||||
s.type = parts[0].type;
|
||||
currentSymbol.acSymbol.parts.insert(s);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue