This commit is contained in:
parent
57ebb267ae
commit
e7f39523cf
|
|
@ -220,6 +220,8 @@ struct Scope
|
||||||
|
|
||||||
struct ImportInformation
|
struct ImportInformation
|
||||||
{
|
{
|
||||||
|
/// Import statement parts
|
||||||
|
string[] importParts;
|
||||||
/// module relative path
|
/// module relative path
|
||||||
string modulePath;
|
string modulePath;
|
||||||
/// symbols to import from this module
|
/// symbols to import from this module
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ import constants;
|
||||||
import messages;
|
import messages;
|
||||||
import semantic;
|
import semantic;
|
||||||
import stupidlog;
|
import stupidlog;
|
||||||
import modulecache; // circular import
|
import modulecache;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* First Pass handles the following:
|
* First Pass handles the following:
|
||||||
|
|
@ -138,6 +138,12 @@ final class FirstPass : ASTVisitor
|
||||||
visitAggregateDeclaration(dec, CompletionKind.className);
|
visitAggregateDeclaration(dec, CompletionKind.className);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override void visit(TemplateDeclaration dec)
|
||||||
|
{
|
||||||
|
// Log.trace(__FUNCTION__, " ", typeof(dec).stringof);
|
||||||
|
visitAggregateDeclaration(dec, CompletionKind.templateName);
|
||||||
|
}
|
||||||
|
|
||||||
override void visit(InterfaceDeclaration dec)
|
override void visit(InterfaceDeclaration dec)
|
||||||
{
|
{
|
||||||
// Log.trace(__FUNCTION__, " ", typeof(dec).stringof);
|
// Log.trace(__FUNCTION__, " ", typeof(dec).stringof);
|
||||||
|
|
@ -281,11 +287,13 @@ final class FirstPass : ASTVisitor
|
||||||
currentSymbol.addChild(symbol);
|
currentSymbol.addChild(symbol);
|
||||||
}
|
}
|
||||||
|
|
||||||
override void visit(ModuleDeclaration dec)
|
override void visit(ModuleDeclaration moduleDeclaration)
|
||||||
{
|
{
|
||||||
// Log.trace(__FUNCTION__, " ", typeof(dec).stringof);
|
// Log.trace(__FUNCTION__, " ", typeof(dec).stringof);
|
||||||
foreach (Token t; dec.moduleName.identifiers)
|
foreach (identifier; moduleDeclaration.moduleName.identifiers)
|
||||||
moduleName ~= getCached(t.text);
|
{
|
||||||
|
moduleName ~= getCached(identifier.text);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// creates scopes for
|
// creates scopes for
|
||||||
|
|
@ -318,6 +326,7 @@ final class FirstPass : ASTVisitor
|
||||||
a => a !is null && a.identifierChain !is null))
|
a => a !is null && a.identifierChain !is null))
|
||||||
{
|
{
|
||||||
ImportInformation info;
|
ImportInformation info;
|
||||||
|
info.importParts = single.identifierChain.identifiers.map!(a => a.text).array;
|
||||||
info.modulePath = convertChainToImportPath(single.identifierChain);
|
info.modulePath = convertChainToImportPath(single.identifierChain);
|
||||||
info.isPublic = protection == tok!"public";
|
info.isPublic = protection == tok!"public";
|
||||||
currentScope.importInformation ~= info;
|
currentScope.importInformation ~= info;
|
||||||
|
|
@ -327,6 +336,8 @@ final class FirstPass : ASTVisitor
|
||||||
ImportInformation info;
|
ImportInformation info;
|
||||||
info.modulePath = convertChainToImportPath(
|
info.modulePath = convertChainToImportPath(
|
||||||
importDeclaration.importBindings.singleImport.identifierChain);
|
importDeclaration.importBindings.singleImport.identifierChain);
|
||||||
|
info.importParts = importDeclaration.importBindings.singleImport
|
||||||
|
.identifierChain.identifiers.map!(a => a.text).array;
|
||||||
foreach (bind; importDeclaration.importBindings.importBinds)
|
foreach (bind; importDeclaration.importBindings.importBinds)
|
||||||
{
|
{
|
||||||
Tuple!(string, string) bindTuple;
|
Tuple!(string, string) bindTuple;
|
||||||
|
|
@ -540,6 +551,26 @@ private:
|
||||||
if (importInfo.importedSymbols.length == 0)
|
if (importInfo.importedSymbols.length == 0)
|
||||||
{
|
{
|
||||||
currentScope.symbols ~= symbols;
|
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)
|
if (importInfo.isPublic && currentScope.parent is null)
|
||||||
{
|
{
|
||||||
rootSymbol.acSymbol.parts ~= symbols;
|
rootSymbol.acSymbol.parts ~= symbols;
|
||||||
|
|
@ -649,7 +680,9 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (child; currentSymbol.children)
|
foreach (child; currentSymbol.children)
|
||||||
|
{
|
||||||
thirdPass(child);
|
thirdPass(child);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void resolveInheritance(SemanticSymbol* currentSymbol)
|
void resolveInheritance(SemanticSymbol* currentSymbol)
|
||||||
|
|
|
||||||
|
|
@ -643,7 +643,7 @@ void setImportCompletions(T)(T tokens, ref AutocompleteResponse response)
|
||||||
response.completions ~= name.baseName();
|
response.completions ~= name.baseName();
|
||||||
response.completionKinds ~=
|
response.completionKinds ~=
|
||||||
exists(buildPath(name, "package.d")) || exists(buildPath(name, "package.di"))
|
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(9, M.INTERFACE)
|
||||||
buffer:register_image(10, M.ENUM)
|
buffer:register_image(10, M.ENUM)
|
||||||
buffer:register_image(11, M.ALIAS)
|
buffer:register_image(11, M.ALIAS)
|
||||||
|
buffer:register_image(12, M.TEMPLATE)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function showCompletionList(r)
|
local function showCompletionList(r)
|
||||||
|
|
@ -53,6 +54,8 @@ local function showCompletionList(r)
|
||||||
completion = completion .. "?3"
|
completion = completion .. "?3"
|
||||||
elseif kind == "l" then
|
elseif kind == "l" then
|
||||||
completion = completion .. "?11"
|
completion = completion .. "?11"
|
||||||
|
elseif kind == "t" or kind == "T" then
|
||||||
|
completion = completion .. "?12"
|
||||||
end
|
end
|
||||||
completions[#completions + 1] = completion
|
completions[#completions + 1] = completion
|
||||||
end
|
end
|
||||||
|
|
@ -517,6 +520,7 @@ static char * module_xpm[] = {
|
||||||
" "};
|
" "};
|
||||||
]]
|
]]
|
||||||
|
|
||||||
|
-- enum icon
|
||||||
M.ENUM = [[
|
M.ENUM = [[
|
||||||
/* XPM */
|
/* XPM */
|
||||||
static char * enum_dec_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
|
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