Fixed #34. Also fixed an issue where modules would be corrupted when performing a selective import.
This commit is contained in:
parent
b1b4444cdb
commit
5ee2192c6f
|
|
@ -253,12 +253,11 @@ public:
|
|||
//writeln("Could not find it due to null type");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (type.type2.builtinType != TokenType.invalid)
|
||||
{
|
||||
//writeln("It was a built-in type");
|
||||
// This part is easy. Autocomplete properties of built-in types
|
||||
s.resolvedType = findSymbolsInScope(getTokenValue(type.type2.builtinType))[0];
|
||||
auto foundSymbols = findSymbolsInScope(getTokenValue(type.type2.builtinType));
|
||||
s.resolvedType = foundSymbols[0];
|
||||
}
|
||||
else if (type.type2.symbol !is null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -457,7 +457,8 @@ class AutocompleteVisitor : ASTVisitor
|
|||
if (b.right == TokenType.invalid)
|
||||
{
|
||||
// Selecive import
|
||||
importedSymbols.filter!(a => a.name == b.left).copy(scope_.symbols);
|
||||
foreach (ACSymbol symbol; importedSymbols.filter!(a => a.name == b.left))
|
||||
scope_.symbols ~= symbol;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -496,9 +496,11 @@ T getExpression(T)(T beforeTokens)
|
|||
|
||||
void setImportCompletions(T)(T tokens, ref AutocompleteResponse response)
|
||||
{
|
||||
writeln("Setting import collections");
|
||||
response.completionType = CompletionType.identifiers;
|
||||
string path = buildPath(tokens.filter!(a => a.type == TokenType.identifier).map!("a.value").array());
|
||||
auto moduleParts = tokens.filter!(a => a.type == TokenType.identifier).map!("a.value").array();
|
||||
if (moduleParts.length == 0)
|
||||
return;
|
||||
string path = buildPath(moduleParts);
|
||||
foreach (importDirectory; ModuleCache.getImportPaths())
|
||||
{
|
||||
string p = format("%s%s%s", importDirectory, dirSeparator, path);
|
||||
|
|
|
|||
|
|
@ -123,7 +123,6 @@ function M.autocomplete(ch)
|
|||
p:close()
|
||||
local tmpFile = io.open(fileName, "r")
|
||||
local r = tmpFile:read("*a")
|
||||
print(r)
|
||||
if r ~= "\n" then
|
||||
if r:match("^identifiers.*") then
|
||||
showCompletionList(r)
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ struct ModuleCache
|
|||
*/
|
||||
static void clear()
|
||||
{
|
||||
cache.clear();
|
||||
cache = cache.init;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue