Added support for single files as import paths (fix #278)
This commit is contained in:
parent
ea2eca23c9
commit
b810daaa8f
|
@ -643,9 +643,26 @@ void setImportCompletions(T)(T tokens, ref AutocompleteResponse response,
|
||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
foreach (importDirectory; cache.getImportPaths())
|
foreach (importPath; cache.getImportPaths())
|
||||||
{
|
{
|
||||||
string p = buildPath(importDirectory, path);
|
if (importPath.isFile)
|
||||||
|
{
|
||||||
|
if (!exists(importPath))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
found = true;
|
||||||
|
|
||||||
|
auto n = importPath.baseName(".d").baseName(".di");
|
||||||
|
if (isFile(importPath) && (importPath.endsWith(".d") || importPath.endsWith(".di"))
|
||||||
|
&& (partial is null || n.startsWith(partial)))
|
||||||
|
{
|
||||||
|
response.completions ~= n;
|
||||||
|
response.completionKinds ~= CompletionKind.moduleName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string p = buildPath(importPath, path);
|
||||||
if (!exists(p))
|
if (!exists(p))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -676,6 +693,7 @@ void setImportCompletions(T)(T tokens, ref AutocompleteResponse response,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (!found)
|
if (!found)
|
||||||
warning("Could not find ", moduleParts);
|
warning("Could not find ", moduleParts);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue