diff --git a/src/dcd/server/autocomplete/complete.d b/src/dcd/server/autocomplete/complete.d index a1cade1..b3a9b4c 100644 --- a/src/dcd/server/autocomplete/complete.d +++ b/src/dcd/server/autocomplete/complete.d @@ -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); } } diff --git a/src/dcd/server/autocomplete/util.d b/src/dcd/server/autocomplete/util.d index 0eacd85..8a3df97 100644 --- a/src/dcd/server/autocomplete/util.d +++ b/src/dcd/server/autocomplete/util.d @@ -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); } \ No newline at end of file