This commit is contained in:
parent
57ebb267ae
commit
e7f39523cf
|
|
@ -220,6 +220,8 @@ struct Scope
|
|||
|
||||
struct ImportInformation
|
||||
{
|
||||
/// Import statement parts
|
||||
string[] importParts;
|
||||
/// module relative path
|
||||
string modulePath;
|
||||
/// symbols to import from this module
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ import constants;
|
|||
import messages;
|
||||
import semantic;
|
||||
import stupidlog;
|
||||
import modulecache; // circular import
|
||||
import modulecache;
|
||||
|
||||
/**
|
||||
* First Pass handles the following:
|
||||
|
|
@ -138,6 +138,12 @@ final class FirstPass : ASTVisitor
|
|||
visitAggregateDeclaration(dec, CompletionKind.className);
|
||||
}
|
||||
|
||||
override void visit(TemplateDeclaration dec)
|
||||
{
|
||||
// Log.trace(__FUNCTION__, " ", typeof(dec).stringof);
|
||||
visitAggregateDeclaration(dec, CompletionKind.templateName);
|
||||
}
|
||||
|
||||
override void visit(InterfaceDeclaration dec)
|
||||
{
|
||||
// Log.trace(__FUNCTION__, " ", typeof(dec).stringof);
|
||||
|
|
@ -281,11 +287,13 @@ final class FirstPass : ASTVisitor
|
|||
currentSymbol.addChild(symbol);
|
||||
}
|
||||
|
||||
override void visit(ModuleDeclaration dec)
|
||||
override void visit(ModuleDeclaration moduleDeclaration)
|
||||
{
|
||||
// Log.trace(__FUNCTION__, " ", typeof(dec).stringof);
|
||||
foreach (Token t; dec.moduleName.identifiers)
|
||||
moduleName ~= getCached(t.text);
|
||||
foreach (identifier; moduleDeclaration.moduleName.identifiers)
|
||||
{
|
||||
moduleName ~= getCached(identifier.text);
|
||||
}
|
||||
}
|
||||
|
||||
// creates scopes for
|
||||
|
|
@ -318,6 +326,7 @@ final class FirstPass : ASTVisitor
|
|||
a => a !is null && a.identifierChain !is null))
|
||||
{
|
||||
ImportInformation info;
|
||||
info.importParts = single.identifierChain.identifiers.map!(a => a.text).array;
|
||||
info.modulePath = convertChainToImportPath(single.identifierChain);
|
||||
info.isPublic = protection == tok!"public";
|
||||
currentScope.importInformation ~= info;
|
||||
|
|
@ -327,6 +336,8 @@ final class FirstPass : ASTVisitor
|
|||
ImportInformation info;
|
||||
info.modulePath = convertChainToImportPath(
|
||||
importDeclaration.importBindings.singleImport.identifierChain);
|
||||
info.importParts = importDeclaration.importBindings.singleImport
|
||||
.identifierChain.identifiers.map!(a => a.text).array;
|
||||
foreach (bind; importDeclaration.importBindings.importBinds)
|
||||
{
|
||||
Tuple!(string, string) bindTuple;
|
||||
|
|
@ -540,6 +551,26 @@ private:
|
|||
if (importInfo.importedSymbols.length == 0)
|
||||
{
|
||||
currentScope.symbols ~= symbols;
|
||||
ACSymbol* a;
|
||||
ACSymbol* b;
|
||||
foreach (i, s; importInfo.importParts)
|
||||
{
|
||||
immutable kind = i + 1 < importInfo.importParts.length
|
||||
? CompletionKind.packageName : CompletionKind.moduleName;
|
||||
ACSymbol* modPart = new ACSymbol(s, kind);
|
||||
if (a is null)
|
||||
{
|
||||
a = modPart;
|
||||
b = a;
|
||||
}
|
||||
else
|
||||
{
|
||||
b.parts ~= modPart;
|
||||
b = modPart;
|
||||
}
|
||||
}
|
||||
b.parts ~= symbols;
|
||||
currentScope.symbols ~= a;
|
||||
if (importInfo.isPublic && currentScope.parent is null)
|
||||
{
|
||||
rootSymbol.acSymbol.parts ~= symbols;
|
||||
|
|
@ -649,7 +680,9 @@ private:
|
|||
}
|
||||
|
||||
foreach (child; currentSymbol.children)
|
||||
{
|
||||
thirdPass(child);
|
||||
}
|
||||
}
|
||||
|
||||
void resolveInheritance(SemanticSymbol* currentSymbol)
|
||||
|
|
|
|||
|
|
@ -643,7 +643,7 @@ void setImportCompletions(T)(T tokens, ref AutocompleteResponse response)
|
|||
response.completions ~= name.baseName();
|
||||
response.completionKinds ~=
|
||||
exists(buildPath(name, "package.d")) || exists(buildPath(name, "package.di"))
|
||||
? CompletionKind.packageName : CompletionKind.moduleName;
|
||||
? CompletionKind.moduleName : CompletionKind.packageName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
2
dscanner
2
dscanner
|
|
@ -1 +1 @@
|
|||
Subproject commit 62df18f4894f3aec71d50f656f6592f314039dcc
|
||||
Subproject commit 3df1324e9b524a6c409450cb3b8e169fabc8ce61
|
||||
|
|
@ -17,6 +17,7 @@ function M.registerImages()
|
|||
buffer:register_image(9, M.INTERFACE)
|
||||
buffer:register_image(10, M.ENUM)
|
||||
buffer:register_image(11, M.ALIAS)
|
||||
buffer:register_image(12, M.TEMPLATE)
|
||||
end
|
||||
|
||||
local function showCompletionList(r)
|
||||
|
|
@ -53,6 +54,8 @@ local function showCompletionList(r)
|
|||
completion = completion .. "?3"
|
||||
elseif kind == "l" then
|
||||
completion = completion .. "?11"
|
||||
elseif kind == "t" or kind == "T" then
|
||||
completion = completion .. "?12"
|
||||
end
|
||||
completions[#completions + 1] = completion
|
||||
end
|
||||
|
|
@ -517,6 +520,7 @@ static char * module_xpm[] = {
|
|||
" "};
|
||||
]]
|
||||
|
||||
-- enum icon
|
||||
M.ENUM = [[
|
||||
/* XPM */
|
||||
static char * enum_dec_xpm[] = {
|
||||
|
|
@ -604,4 +608,42 @@ static char * keyword_xpm[] = {
|
|||
" "};
|
||||
]]
|
||||
|
||||
-- template icon
|
||||
M.TEMPLATE = [[
|
||||
/* XPM */
|
||||
static char * template_xpm[] = {
|
||||
"16 16 14 1",
|
||||
" c None",
|
||||
". c #00A2A4",
|
||||
"+ c #00A9AB",
|
||||
"@ c #E1FFFF",
|
||||
"# c #EBFFFF",
|
||||
"$ c #F7FFFF",
|
||||
"% c #FBFFFF",
|
||||
"& c #EFFFFF",
|
||||
"* c #E5FFFF",
|
||||
"= c #D9FFFF",
|
||||
"- c #00A5A7",
|
||||
"; c #CFFEFF",
|
||||
"> c #00A0A3",
|
||||
", c #009A9C",
|
||||
" ",
|
||||
" ",
|
||||
" .......... ",
|
||||
" ++++++++++++ ",
|
||||
" +++@@@@@@+++ ",
|
||||
" +++######+++ ",
|
||||
" +++++$$+++++ ",
|
||||
" +++++%%+++++ ",
|
||||
" +++++&&+++++ ",
|
||||
" +++++**+++++ ",
|
||||
" +++++==+++++ ",
|
||||
" -----;;----- ",
|
||||
" >>>>>>>>>>>> ",
|
||||
" ,,,,,,,,,, ",
|
||||
" ",
|
||||
" "};
|
||||
|
||||
]]
|
||||
|
||||
return M
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
/* XPM */
|
||||
static char * template_xpm[] = {
|
||||
"16 16 14 1",
|
||||
" c None",
|
||||
". c #00A2A4",
|
||||
"+ c #00A9AB",
|
||||
"@ c #E1FFFF",
|
||||
"# c #EBFFFF",
|
||||
"$ c #F7FFFF",
|
||||
"% c #FBFFFF",
|
||||
"& c #EFFFFF",
|
||||
"* c #E5FFFF",
|
||||
"= c #D9FFFF",
|
||||
"- c #00A5A7",
|
||||
"; c #CFFEFF",
|
||||
"> c #00A0A3",
|
||||
", c #009A9C",
|
||||
" ",
|
||||
" ",
|
||||
" .......... ",
|
||||
" ++++++++++++ ",
|
||||
" +++@@@@@@+++ ",
|
||||
" +++######+++ ",
|
||||
" +++++$$+++++ ",
|
||||
" +++++%%+++++ ",
|
||||
" +++++&&+++++ ",
|
||||
" +++++**+++++ ",
|
||||
" +++++==+++++ ",
|
||||
" -----;;----- ",
|
||||
" >>>>>>>>>>>> ",
|
||||
" ,,,,,,,,,, ",
|
||||
" ",
|
||||
" "};
|
||||
Loading…
Reference in New Issue