@@ -40,6 +40,7 @@ import constants;
4040import modulecache;
4141import conversion.astconverter;
4242import stupidlog;
43+ import string_interning;
4344
4445/**
4546 * Gets documentation for the symbol at the cursor
@@ -805,33 +806,42 @@ void setCompletions(T)(ref AutocompleteResponse response,
805806 }
806807 else if (completionType == CompletionType.calltips)
807808 {
808- // Log.trace("Showing call tips for ", symbols[0].name, " of type ", symbols[0].kind);
809+ // Log.trace("Showing call tips for ", symbols[0].name, " of kind ", symbols[0].kind);
809810 if (symbols[0 ].kind != CompletionKind.functionName
810811 && symbols[0 ].callTip is null )
811812 {
812813 if (symbols[0 ].kind == CompletionKind.variableName)
813814 {
814815 auto dumb = symbols[0 ].type;
815- if (isBracket )
816+ if (dumb ! is null )
816817 {
817- auto index = dumb.getPartsByName(" opIndex" );
818- if (index.length > 0 )
818+ if (dumb.kind == CompletionKind.functionName)
819819 {
820- symbols = index;
820+ symbols = [dumb];
821+ goto setCallTips;
822+ }
823+ if (isBracket)
824+ {
825+ auto index = dumb.getPartsByName(internString(" opIndex" ));
826+ if (index.length > 0 )
827+ {
828+ symbols = index;
829+ goto setCallTips;
830+ }
831+ }
832+ auto call = dumb.getPartsByName(internString(" opCall" ));
833+ if (call.length > 0 )
834+ {
835+ symbols = call;
821836 goto setCallTips;
822837 }
823838 }
824- auto call = dumb.getPartsByName(" opCall" );
825- if (call.length > 0 )
826- {
827- symbols = call;
828- goto setCallTips;
829- }
839+
830840 }
831841 if (symbols[0 ].kind == CompletionKind.structName
832842 || symbols[0 ].kind == CompletionKind.className)
833843 {
834- auto constructor = symbols[0 ].getPartsByName(" *constructor*" );
844+ auto constructor = symbols[0 ].getPartsByName(internString( " *constructor*" ) );
835845 if (constructor.length == 0 )
836846 {
837847 // Build a call tip out of the struct fields
@@ -853,7 +863,7 @@ void setCompletions(T)(ref AutocompleteResponse response,
853863 response.completionType = CompletionType.calltips;
854864 foreach (symbol; symbols)
855865 {
856- if (symbol.kind != CompletionKind.aliasName)
866+ if (symbol.kind != CompletionKind.aliasName && symbol.callTip ! is null )
857867 response.completions ~= symbol.callTip;
858868 }
859869 }
@@ -1015,7 +1025,8 @@ bool shouldSwapWithType(CompletionType completionType, CompletionKind kind,
10151025 || kind == CompletionKind.memberVariableName
10161026 || kind == CompletionKind.enumMember
10171027 || kind == CompletionKind.functionName;
1018- return completionType == CompletionType.identifiers && isInteresting;
1028+ return isInteresting && (completionType == CompletionType.identifiers
1029+ || (completionType == completionType.calltips && kind == CompletionKind.variableName)) ;
10191030}
10201031
10211032/**
0 commit comments