This commit is contained in:
parent
84092c36e7
commit
aa8f2f4556
|
@ -1 +1 @@
|
|||
Subproject commit c99dd0b83afe80d3b647f73e400fa4bb8e48aace
|
||||
Subproject commit d3ce885de5a838347254cc41d702ffa53bbb3a5e
|
|
@ -1 +1 @@
|
|||
Subproject commit 99527e49cd194a2cf72da2154cc8b0d9ba30816d
|
||||
Subproject commit 01d42177ca8fab5a0fea22f3f20873bc81e8257a
|
|
@ -49,6 +49,7 @@ int main(string[] args)
|
|||
bool query;
|
||||
bool printVersion;
|
||||
bool listImports;
|
||||
bool getIdentifier;
|
||||
string search;
|
||||
version(Windows)
|
||||
{
|
||||
|
@ -68,7 +69,8 @@ int main(string[] args)
|
|||
"clearCache", &clearCache, "symbolLocation|l", &symbolLocation,
|
||||
"doc|d", &doc, "query|status|q", &query, "search|s", &search,
|
||||
"version", &printVersion, "listImports", &listImports,
|
||||
"tcp", &useTCP, "socketFile", &socketFile);
|
||||
"tcp", &useTCP, "socketFile", &socketFile,
|
||||
"getIdentifier", &getIdentifier);
|
||||
}
|
||||
catch (ConvException e)
|
||||
{
|
||||
|
@ -204,11 +206,11 @@ int main(string[] args)
|
|||
request.cursorPosition = cursorPos;
|
||||
request.searchName = search;
|
||||
|
||||
if (symbolLocation)
|
||||
if (symbolLocation | getIdentifier)
|
||||
request.kind |= RequestKind.symbolLocation;
|
||||
else if (doc)
|
||||
request.kind |= RequestKind.doc;
|
||||
else if(search)
|
||||
else if (search)
|
||||
request.kind |= RequestKind.search;
|
||||
else
|
||||
request.kind |= RequestKind.autocomplete;
|
||||
|
@ -223,6 +225,8 @@ int main(string[] args)
|
|||
|
||||
if (symbolLocation)
|
||||
printLocationResponse(response);
|
||||
else if (getIdentifier)
|
||||
printIdentifierResponse(response);
|
||||
else if (doc)
|
||||
printDocResponse(response);
|
||||
else if (search !is null)
|
||||
|
@ -325,13 +329,22 @@ Socket createSocket(string socketFile, ushort port)
|
|||
return socket;
|
||||
}
|
||||
|
||||
void printDocResponse(AutocompleteResponse response)
|
||||
void printDocResponse(ref const AutocompleteResponse response)
|
||||
{
|
||||
import std.array: join;
|
||||
response.docComments.join("\n").writeln;
|
||||
}
|
||||
|
||||
void printLocationResponse(AutocompleteResponse response)
|
||||
void printIdentifierResponse(ref const AutocompleteResponse response)
|
||||
{
|
||||
if (response.completions.length == 0)
|
||||
return;
|
||||
write(response.completions[0]);
|
||||
write("\t");
|
||||
writeln(response.symbolIdentifier);
|
||||
}
|
||||
|
||||
void printLocationResponse(ref const AutocompleteResponse response)
|
||||
{
|
||||
if (response.symbolFilePath is null)
|
||||
writeln("Not found");
|
||||
|
@ -339,7 +352,7 @@ void printLocationResponse(AutocompleteResponse response)
|
|||
writefln("%s\t%d", response.symbolFilePath, response.symbolLocation);
|
||||
}
|
||||
|
||||
void printCompletionResponse(AutocompleteResponse response)
|
||||
void printCompletionResponse(ref const AutocompleteResponse response)
|
||||
{
|
||||
if (response.completions.length > 0)
|
||||
{
|
||||
|
|
|
@ -55,7 +55,6 @@ enum CompletionType : string
|
|||
enum RequestKind : ushort
|
||||
{
|
||||
// dfmt off
|
||||
|
||||
uninitialized = 0b00000000_00000000,
|
||||
/// Autocompletion
|
||||
autocomplete = 0b00000000_00000001,
|
||||
|
@ -75,7 +74,6 @@ enum RequestKind : ushort
|
|||
search = 0b00000000_10000000,
|
||||
/// List import directories
|
||||
listImports = 0b00000001_00000000,
|
||||
|
||||
// dfmt on
|
||||
}
|
||||
|
||||
|
@ -160,6 +158,11 @@ struct AutocompleteResponse
|
|||
* Import paths that are registered by the server.
|
||||
*/
|
||||
string[] importPaths;
|
||||
|
||||
/**
|
||||
* Symbol identifier
|
||||
*/
|
||||
ulong symbolIdentifier;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -783,7 +783,7 @@ DSymbol*[] getSymbolsByTokenChain(T)(Scope* completionScope,
|
|||
|
||||
if (shouldSwapWithType(completionType, symbols[0].kind, 0, tokens.length - 1))
|
||||
{
|
||||
symbols = symbols[0].type is null ? [] : [symbols[0].type];
|
||||
symbols = symbols[0].type is null || symbols[0].type is symbols[0] ? [] : [symbols[0].type];
|
||||
if (symbols.length == 0)
|
||||
return [];
|
||||
}
|
||||
|
@ -849,7 +849,7 @@ DSymbol*[] getSymbolsByTokenChain(T)(Scope* completionScope,
|
|||
|| symbols[0].kind == CompletionKind.importSymbol
|
||||
|| symbols[0].kind == CompletionKind.aliasName)
|
||||
{
|
||||
symbols = symbols[0].type is null ? [] : [symbols[0].type];
|
||||
symbols = symbols[0].type is null || symbols[0].type is symbols[0] ? [] : [symbols[0].type];
|
||||
if (symbols.length == 0)
|
||||
break loop;
|
||||
}
|
||||
|
@ -865,7 +865,7 @@ DSymbol*[] getSymbolsByTokenChain(T)(Scope* completionScope,
|
|||
}
|
||||
if (shouldSwapWithType(completionType, symbols[0].kind, i, tokens.length - 1))
|
||||
{
|
||||
symbols = symbols[0].type is null ? [] : [symbols[0].type];
|
||||
symbols = symbols[0].type is null || symbols[0].type is symbols[0] ? [] : [symbols[0].type];
|
||||
if (symbols.length == 0)
|
||||
break loop;
|
||||
}
|
||||
|
@ -874,7 +874,7 @@ DSymbol*[] getSymbolsByTokenChain(T)(Scope* completionScope,
|
|||
&& (completionType == CompletionType.identifiers
|
||||
|| i + 1 < tokens.length))
|
||||
{
|
||||
symbols = symbols[0].type is null ? [] : [symbols[0].type];
|
||||
symbols = symbols[0].type is null || symbols[0].type is symbols[0] ? [] : [symbols[0].type];
|
||||
}
|
||||
if (symbols.length == 0)
|
||||
break loop;
|
||||
|
@ -892,14 +892,14 @@ DSymbol*[] getSymbolsByTokenChain(T)(Scope* completionScope,
|
|||
skip();
|
||||
if (!isSliceExpression(tokens, i))
|
||||
{
|
||||
symbols = symbols[0].type is null ? [] : [symbols[0].type];
|
||||
symbols = symbols[0].type is null || symbols[0].type is symbols[0] ? [] : [symbols[0].type];
|
||||
if (symbols.length == 0)
|
||||
break loop;
|
||||
}
|
||||
}
|
||||
else if (symbols[0].qualifier == SymbolQualifier.assocArray)
|
||||
{
|
||||
symbols = symbols[0].type is null ? [] : [symbols[0].type];
|
||||
symbols = symbols[0].type is null || symbols[0].type is symbols[0] ? [] : [symbols[0].type];
|
||||
skip();
|
||||
}
|
||||
else
|
||||
|
@ -1001,7 +1001,7 @@ void setCompletions(T)(ref AutocompleteResponse response,
|
|||
{
|
||||
if (symbols[0].kind == CompletionKind.aliasName)
|
||||
{
|
||||
if (symbols[0].type is null)
|
||||
if (symbols[0].type is null || symbols[0].type is symbols[0])
|
||||
return;
|
||||
symbols = [symbols[0].type];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue