Adjust to requested changes

This commit is contained in:
WebFreak001 2017-11-29 11:17:13 +01:00
parent ad0335b1ad
commit 17789292e0
2 changed files with 10 additions and 9 deletions

View File

@ -385,12 +385,12 @@ void setImportCompletions(T)(T tokens, ref AutocompleteResponse response,
{
if (n[0] != '.' && (partial is null || n.startsWith(partial)))
{
string packageDPath = buildPath(name, "package.d");
string packageDIPath = buildPath(name, "package.di");
bool packageD = exists(packageDPath);
bool packageDI = exists(packageDIPath);
auto kind = packageD || packageDI ? CompletionKind.moduleName : CompletionKind.packageName;
string file = packageD ? packageDPath : packageDI ? packageDIPath : name;
immutable packageDPath = buildPath(name, "package.d");
immutable packageDIPath = buildPath(name, "package.di");
immutable packageD = exists(packageDPath);
immutable packageDI = exists(packageDIPath);
immutable kind = packageD || packageDI ? CompletionKind.moduleName : CompletionKind.packageName;
immutable file = packageD ? packageDPath : packageDI ? packageDIPath : name;
response.completions ~= AutocompleteResponse.Completion(n, kind, null, file, 0);
}
}

View File

@ -742,12 +742,13 @@ unittest
AutocompleteResponse.Completion makeSymbolCompletionInfo(const DSymbol* symbol, char kind)
{
string definition;
if ((kind == 'v' || kind == 'm') && symbol.type)
if ((kind == CompletionKind.variableName || kind == CompletionKind.memberVariableName) && symbol.type)
definition = symbol.type.name ~ ' ' ~ symbol.name;
else if (kind == 'e')
definition = symbol.name;
else if (kind == CompletionKind.enumMember)
definition = symbol.name; // TODO: add enum value to definition string
else
definition = symbol.callTip;
// TODO: definition strings could include more information, like on classes inheritance
return AutocompleteResponse.Completion(symbol.name, kind, definition,
symbol.symbolFile, symbol.location, symbol.doc);
}