Java Code Examples for org.eclipse.lsp4j.SymbolKind#Function

The following examples show how to use org.eclipse.lsp4j.SymbolKind#Function . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SymbolKindCalculationHelper.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
/** */
public SymbolKind getSymbolKind(Object obj) {
	if (obj == null) {
		return null;
	}
	if (obj instanceof ParameterizedTypeRef) {
		return null;
	}
	if (obj instanceof Script) {
		return SymbolKind.Module;
	}
	if (obj instanceof ImportDeclaration) {
		return SymbolKind.Namespace;
	}
	if (obj instanceof NamedImportSpecifier) {
		return SymbolKind.Namespace;
	}
	if (obj instanceof N4ClassifierDeclaration) {
		return SymbolKind.Class;
	}
	if (obj instanceof N4GetterDeclaration) {
		return SymbolKind.Property;
	}
	if (obj instanceof N4SetterDeclaration) {
		return SymbolKind.Property;
	}
	if (obj instanceof ExportedVariableStatement) {
		return SymbolKind.Variable;
	}
	if (obj instanceof NamedElement) {
		return SymbolKind.Property;
	}
	if (obj instanceof TModule) {
		return SymbolKind.Module;
	}
	if (obj instanceof TClass) {
		return SymbolKind.Class;
	}
	if (obj instanceof TInterface) {
		return SymbolKind.Interface;
	}
	if (obj instanceof TEnum) {
		return SymbolKind.Enum;
	}
	if (obj instanceof TEnumLiteral) {
		return SymbolKind.EnumMember;
	}
	if (obj instanceof NullLiteral) {
		return SymbolKind.Null;
	}
	if (obj instanceof NumericLiteral) {
		return SymbolKind.Number;
	}
	if (obj instanceof BooleanLiteral) {
		return SymbolKind.Boolean;
	}
	if (obj instanceof StringLiteral) {
		return SymbolKind.String;
	}
	if (obj instanceof ObjectLiteral) {
		return SymbolKind.Object;
	}
	if (obj instanceof TGetter) {
		return SymbolKind.Property;
	}
	if (obj instanceof TSetter) {
		return SymbolKind.Property;
	}
	if (obj instanceof FunctionTypeExpression) {
		return SymbolKind.Operator;
	}
	if (obj instanceof TMethod) {
		return SymbolKind.Method;
	}
	if (obj instanceof TFunction) {
		return SymbolKind.Function;
	}
	if (obj instanceof TFormalParameter) {
		return null;
	}
	if (obj instanceof TField) {
		return SymbolKind.Field;
	}
	if (obj instanceof TypeVariable) {
		return SymbolKind.TypeParameter;
	}
	if (obj instanceof IdentifiableElement) {
		return SymbolKind.Property;
	}
	if (obj instanceof IEObjectDescription) {
		return SymbolKind.Property;
	}
	return null;
}
 
Example 2
Source File: LanguageServerCompilerUtils.java    From vscode-as3mxml with Apache License 2.0 4 votes vote down vote up
public static SymbolKind getSymbolKindFromDefinition(IDefinition definition)
{
    if (definition instanceof IPackageDefinition)
    {
        return SymbolKind.Package;
    }
    else if (definition instanceof IClassDefinition)
    {
        return SymbolKind.Class;
    }
    else if (definition instanceof IInterfaceDefinition)
    {
        return SymbolKind.Interface;
    }
    else if (definition instanceof IAccessorDefinition)
    {
        return SymbolKind.Property;
    }
    else if (definition instanceof IFunctionDefinition)
    {
        IFunctionDefinition functionDefinition = (IFunctionDefinition) definition;
        if (functionDefinition.isConstructor())
        {
            return SymbolKind.Constructor;
        }
        IDefinition parentDefinition = functionDefinition.getParent();
        if (parentDefinition != null && parentDefinition instanceof ITypeDefinition)
        {
            return SymbolKind.Method;
        }
        return SymbolKind.Function;
    }
    else if (definition instanceof IConstantDefinition)
    {
        return SymbolKind.Constant;
    }
    else if (definition instanceof IVariableDefinition)
    {
        IVariableDefinition variableDefinition = (IVariableDefinition) definition;
        VariableClassification variableClassification = variableDefinition.getVariableClassification();
        if (variableClassification != null)
        {
            switch(variableClassification)
            {
                case INTERFACE_MEMBER:
                case CLASS_MEMBER:
                {
                    return SymbolKind.Field;
                }
                default:
                {
                    return SymbolKind.Variable;
                }
            }
        }
    }
    else if (definition instanceof IEventDefinition)
    {
        return SymbolKind.Event;
    }
    else if (definition instanceof IStyleDefinition)
    {
        return SymbolKind.Field;
    }
    return SymbolKind.Object;
}