Class LspTypeInformationPresenter.LspTypeInformationReporter
java.lang.Object
com.sun.source.util.TreeScanner<Void,Void>
com.sun.source.util.TreePathScanner<Void,Void>
org.checkerframework.framework.util.visualize.AbstractTypeInformationPresenter.TypeInformationReporter
org.checkerframework.framework.util.visualize.LspTypeInformationPresenter.LspTypeInformationReporter
- All Implemented Interfaces:
TreeVisitor<Void,
Void>
- Enclosing class:
LspTypeInformationPresenter
protected class LspTypeInformationPresenter.LspTypeInformationReporter
extends AbstractTypeInformationPresenter.TypeInformationReporter
Type information reporter that uses a format suitable for the LSP server.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final SourcePositions
Computes positions of a sub-tree.Fields inherited from class org.checkerframework.framework.util.visualize.AbstractTypeInformationPresenter.TypeInformationReporter
checker, classTree, currentRoot
-
Method Summary
Modifier and TypeMethodDescriptionprotected @Nullable TypeOccurrenceRange
Computes the 0-based inclusive message range for the given tree.protected void
reportTreeType
(Tree tree, AnnotatedTypeMirror type, TypeOccurrenceKind occurrenceKind) Reports a diagnostic message indicating the range corresponding to the given tree has the given type.Methods inherited from class org.checkerframework.framework.util.visualize.AbstractTypeInformationPresenter.TypeInformationReporter
visitAssignment, visitBinary, visitClass, visitCompoundAssignment, visitIdentifier, visitLiteral, visitMemberReference, visitMemberSelect, visitMethod, visitMethodInvocation, visitReturn, visitTypeParameter, visitUnary, visitVariable
Methods inherited from class com.sun.source.util.TreePathScanner
getCurrentPath, scan, scan
Methods inherited from class com.sun.source.util.TreeScanner
reduce, scan, visitAnnotatedType, visitAnnotation, visitAnyPattern, visitArrayAccess, visitArrayType, visitAssert, visitBindingPattern, visitBlock, visitBreak, visitCase, visitCatch, visitCompilationUnit, visitConditionalExpression, visitConstantCaseLabel, visitContinue, visitDeconstructionPattern, visitDefaultCaseLabel, visitDoWhileLoop, visitEmptyStatement, visitEnhancedForLoop, visitErroneous, visitExports, visitExpressionStatement, visitForLoop, visitIf, visitImport, visitInstanceOf, visitIntersectionType, visitLabeledStatement, visitLambdaExpression, visitModifiers, visitModule, visitNewArray, visitNewClass, visitOpens, visitOther, visitPackage, visitParameterizedType, visitParenthesized, visitPatternCaseLabel, visitPrimitiveType, visitProvides, visitRequires, visitStringTemplate, visitSwitch, visitSwitchExpression, visitSynchronized, visitThrow, visitTry, visitTypeCast, visitUnionType, visitUses, visitWhileLoop, visitWildcard, visitYield
-
Field Details
-
sourcePositions
Computes positions of a sub-tree.
-
-
Method Details
-
reportTreeType
protected void reportTreeType(Tree tree, AnnotatedTypeMirror type, TypeOccurrenceKind occurrenceKind) Reports a diagnostic message indicating the range corresponding to the given tree has the given type. Specifically, the message has key "lsp.type.information", and it contains the name of the checker, the given occurrenceKind, the given type, and the computed message range for the tree. If the tree is an artificial tree, this does not report anything.- Specified by:
reportTreeType
in classAbstractTypeInformationPresenter.TypeInformationReporter
- Parameters:
tree
- the tree that is used to find the corresponding range to reporttype
- the type that we are going to displayoccurrenceKind
- the kind of the given type
-
computeTypeOccurrenceRange
Computes the 0-based inclusive message range for the given tree.Note that the range sometimes don't cover the entire source code of the tree. For example, in "int a = 0", we have a variable tree "int a", but we only want to report the range of the identifier "a". This customizes the positions where we want the type information to show.
- Parameters:
tree
- the tree for which we want to compute the message range- Returns:
- a message range corresponds to the tree
-