logic: show real code of signatures in tooltips
* added new location type * refactored old recording code * record signature locations for cxx functions and java methods * added signature locations to sample project indexer tests * ignore signature locations in ui * signatures in tooltip with qualified name of the function/method * added test for finding signature location of constructor with initializer list
This commit is contained in:
@@ -234,11 +234,39 @@ public abstract class AstVisitor extends ASTVisitor
|
||||
|
||||
DeclName symbolName = DeclNameResolver.getQualifiedDeclName(node, m_filePath, m_compilationUnit);
|
||||
|
||||
m_client.recordSymbolWithLocationAndScope(
|
||||
|
||||
Range signatureRange = getRange(node);
|
||||
if (!node.thrownExceptionTypes().isEmpty())
|
||||
{
|
||||
Object lastExceptionType = node.thrownExceptionTypes().get(node.thrownExceptionTypes().size() - 1);
|
||||
if (lastExceptionType instanceof ASTNode)
|
||||
{
|
||||
signatureRange.end = getRange((ASTNode) lastExceptionType).end;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
signatureRange.end = getRange(node.getName()).end;
|
||||
|
||||
if (!node.parameters().isEmpty())
|
||||
{
|
||||
Object lastParametersType = node.parameters().get(node.parameters().size() - 1);
|
||||
if (lastParametersType instanceof ASTNode)
|
||||
{
|
||||
signatureRange.end = getRange((ASTNode) lastParametersType).end;
|
||||
}
|
||||
}
|
||||
|
||||
signatureRange.end = m_fileContent.findStartPosition(")", signatureRange.end);
|
||||
}
|
||||
|
||||
|
||||
m_client.recordSymbolWithLocationAndScopeAndSignature(
|
||||
symbolName.toNameHierarchy(),
|
||||
SymbolKind.METHOD,
|
||||
getRange(node.getName()),
|
||||
getRange(node),
|
||||
signatureRange,
|
||||
AccessKind.fromModifiers(node.getModifiers()),
|
||||
DefinitionKind.EXPLICIT);
|
||||
|
||||
|
||||
@@ -20,12 +20,19 @@ public abstract class AstVisitorClient
|
||||
NameHierarchy symbolName, SymbolKind symbolKind,
|
||||
Range range,
|
||||
AccessKind access, DefinitionKind definitionKind);
|
||||
|
||||
|
||||
public abstract void recordSymbolWithLocationAndScope(
|
||||
NameHierarchy symbolName, SymbolKind symbolKind,
|
||||
Range range,
|
||||
Range scopeRange,
|
||||
AccessKind access, DefinitionKind definitionKind);
|
||||
|
||||
public abstract void recordSymbolWithLocationAndScopeAndSignature(
|
||||
NameHierarchy symbolName, SymbolKind symbolKind,
|
||||
Range range,
|
||||
Range scopeRange,
|
||||
Range signatureRange,
|
||||
AccessKind access, DefinitionKind definitionKind);
|
||||
|
||||
public abstract void recordReference(
|
||||
ReferenceKind referenceKind, NameHierarchy referencedName, NameHierarchy contextName,
|
||||
|
||||
@@ -252,6 +252,14 @@ public class JavaIndexer
|
||||
int scopeBeginLine, int scopeBeginColumn, int scopeEndLine, int scopeEndColumn,
|
||||
int access, int definitionKind
|
||||
);
|
||||
|
||||
static public native void recordSymbolWithLocationAndScopeAndSignature(
|
||||
int address, String symbolName, int symbolType,
|
||||
int beginLine, int beginColumn, int endLine, int endColumn,
|
||||
int scopeBeginLine, int scopeBeginColumn, int scopeEndLine, int scopeEndColumn,
|
||||
int signatureBeginLine, int signatureBeginColumn, int signatureEndLine, int signatureEndColumn,
|
||||
int access, int definitionKind
|
||||
);
|
||||
|
||||
static public native void recordReference(
|
||||
int address, int referenceKind, String referencedName, String contextName, int beginLine, int beginColumn, int endLine, int endColumn);
|
||||
|
||||
@@ -68,6 +68,19 @@ public class JavaIndexerAstVisitorClient extends AstVisitorClient
|
||||
access.getValue(), definitionKind.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordSymbolWithLocationAndScopeAndSignature(
|
||||
NameHierarchy symbolName, SymbolKind symbolKind, Range range,
|
||||
Range scopeRange, Range signatureRange, AccessKind access, DefinitionKind definitionKind)
|
||||
{
|
||||
JavaIndexer.recordSymbolWithLocationAndScopeAndSignature(
|
||||
m_address, symbolName.serialize(), symbolKind.getValue(),
|
||||
range.begin.line, range.begin.column, range.end.line, range.end.column,
|
||||
scopeRange.begin.line, scopeRange.begin.column, scopeRange.end.line, scopeRange.end.column,
|
||||
signatureRange.begin.line, signatureRange.begin.column, signatureRange.end.line, signatureRange.end.column,
|
||||
access.getValue(), definitionKind.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordReference(
|
||||
ReferenceKind referenceKind, NameHierarchy referencedName,
|
||||
|
||||
Reference in New Issue
Block a user