public class CompletionVisitorUtil extends Object
Modifier and Type | Method and Description |
---|---|
static BLangSimpleVariableDef |
createVarDef(BLangSimpleVariable var)
Generate a variable Definition.
|
static BLangBlockStmt |
generateCodeBlock(StatementNode... statements)
Generate a Block statement from a given set of statements.
|
static List<BLangNode> |
getObjectItemsOrdered(BLangObjectTypeNode objectTypeNode) |
static boolean |
isCursorAtResourceIdentifier(BLangResource bLangResource,
LSContext context,
TreeVisitor treeVisitor)
Check whether the cursor is at the resource identifier.
|
static boolean |
isCursorWithinBlock(DiagnosticPos nodePosition,
SymbolEnv symbolEnv,
LSContext lsContext,
TreeVisitor treeVisitor)
Check whether the cursor is located within the given node's block scope.
|
static boolean |
isWithinParameterContext(String nodeName,
String nodeType,
SymbolEnv env,
LSContext lsContext,
TreeVisitor treeVisitor)
Check whether the cursor resides within the given node type's parameter context.
|
public static boolean isCursorWithinBlock(DiagnosticPos nodePosition, @Nonnull SymbolEnv symbolEnv, LSContext lsContext, TreeVisitor treeVisitor)
nodePosition
- Position of the current nodesymbolEnv
- Symbol EnvironmentlsContext
- Language Server Operation ContexttreeVisitor
- Completion tree visitor instanceBoolean
Whether the cursor within the block scopepublic static boolean isWithinParameterContext(String nodeName, String nodeType, SymbolEnv env, LSContext lsContext, TreeVisitor treeVisitor)
nodeName
- Name of the nodenodeType
- Node type (Function, Resource, Action or Connector)env
- Symbol EnvironmentlsContext
- Language Server Operation ContexttreeVisitor
- Completion tree visitor instanceBoolean
Whether the cursor is within the parameter contextpublic static BLangSimpleVariableDef createVarDef(BLangSimpleVariable var)
var
- BLang VariableBLangSimpleVariableDef
Generated BLang Variable Definitionpublic static BLangBlockStmt generateCodeBlock(StatementNode... statements)
statements
- Statements to be populatedBLangBlockStmt
Generated block statementpublic static boolean isCursorAtResourceIdentifier(BLangResource bLangResource, LSContext context, TreeVisitor treeVisitor)
bLangResource
- Resource to be considercontext
- Language Server Operation ContexttreeVisitor
- Completion Tree Visitor instanceBoolean
Whether the cursor is at the resource identifier or notpublic static List<BLangNode> getObjectItemsOrdered(BLangObjectTypeNode objectTypeNode)
Copyright © 2019 WSO2. All rights reserved.