import structure = require("./structure/structureInterfaces"); import structureDefaultInterfaces = require("./structure/structureDefaultInterfaces"); import detailsInterface = require("./node_details/detailsInterfaces"); import detailsImplementation = require("./node_details/detailsImpl"); import commonInterfaces = require("./common/commonInterfaces"); import loggerModule = require("./common/logger"); /** * Structure node JSON representation. */ export declare type StructureNodeJSON = structure.StructureNodeJSON; /** * Arbitrary structure tree node. * Depending on the highly customizable filters and * look-and-feel providers results in a read-to-display structure tree * for RAML document. */ export declare type StructureNode = structure.StructureNode; /** * Constructs node text for high-level node. */ export declare type LabelProvider = commonInterfaces.LabelProvider; /** * Provides node decoration info. */ export declare type Decorator = commonInterfaces.Decorator; /** * Core tree builder, not recommended to set directly. */ export declare type ContentProvider = structure.ContentProvider; /** * Checks if node belongs to a category. */ export declare type CategoryFilter = commonInterfaces.CategoryFilter; /** * Can hide nodes from the resulting tree. */ export declare type VisibilityFilter = commonInterfaces.VisibilityFilter; /** * Provides current AST state. * If set via setASTProvider method, will be used instead of a new AST calculation * by parsing the text provided by IEditorProvider. */ export declare type IASTProvider = commonInterfaces.IASTProvider; /** * Gets unique node identifier. */ export declare type KeyProvider = commonInterfaces.KeyProvider; /** * Types of node recognizable by default decorator. */ export import NodeType = structureDefaultInterfaces.NodeType; /** * Icon and text style. */ export declare type Decoration = structureDefaultInterfaces.Decoration; /** * Structured node having default type assigned by decorator. */ export declare type TypedStructureNode = structureDefaultInterfaces.TypedStructureNode; /** * The node of details tree converted to JSON */ export declare type DetailsItemJSON = detailsInterface.DetailsItemJSON; /** * Details item having a value text. */ export declare type DetailsValuedItemJSON = detailsInterface.DetailsValuedItemJSON; /** * Details item having potential value options */ export declare type DetailsItemWithOptionsJSON = detailsInterface.DetailsItemWithOptionsJSON; /** * Details item pointing to an executable action. */ export declare type DetailsActionItemJSON = detailsInterface.DetailsActionItemJSON; /** * Type of details item. */ export declare type DetailsItemType = detailsInterface.DetailsItemType; /** * Subtype for action items. */ export declare type ActionItemSubType = detailsInterface.ActionItemSubType; /** * Details tree node. */ export declare type DetailsItem = detailsInterface.DetailsItem; /** * Provider, which can return current text editor */ export declare type IEditorProvider = commonInterfaces.IEditorProvider; /** * Abstract text editor, able to provide document text buffer and cursor position. */ export declare type IAbstractTextEditor = commonInterfaces.IAbstractTextEditor; /** * Text editor buffer. */ export declare type IEditorTextBuffer = commonInterfaces.IEditorTextBuffer; /** * Range of positions in text. */ export declare type IRange = commonInterfaces.IRange; /** * Position in text. */ export declare type IPoint = commonInterfaces.IPoint; /** * Initializes default contributors. */ export declare function initialize(): void; /** * Sets AST provider. Must be called to use the module. */ export declare function setASTProvider(astProvider: commonInterfaces.IASTProvider): void; /** * Adds label provider. The system can contain several label providers at once, * the first one returning a label will be used. * @param provider */ export declare function addLabelProvider(provider: commonInterfaces.LabelProvider): void; /** * Adds decorator. The system can contain severla decorators. The first one providing * data will be used. * @param decorator */ export declare function addDecorator(decorator: commonInterfaces.Decorator): void; /** * Adds new category and its filter. Each category creates its own structure tree. * Several categories may contain the same node. * Adding the same category the second tie overrides the filter. * @param categoryFilter */ export declare function addCategoryFilter(categoryName: string, categoryFilter: commonInterfaces.CategoryFilter): void; /** * Sets global visibility filters. Nodes being rejected by the filter are not * going into the structure tree of any category. * @param visibilityFilter */ export declare function setVisibilityFilter(visibilityFilter: commonInterfaces.VisibilityFilter): void; /** * Sets content provider. It is recommended to use the default one. * @param contentProvider */ export declare function setContentProvider(contentProvider: structure.ContentProvider): void; /** * Sets key provider. It is recommended to use the default one. * @param keyProvider */ export declare function setKeyProvider(keyProvider: commonInterfaces.KeyProvider): void; /** * Gets structure tree for the category. If category is not specified (null), or its * filter is not found, returns the whole tree. * The root node of the tree always match RAML HL tree root. * @param categoryName */ export declare function getStructure(categoryName: string): structure.StructureNode; /** * Gets structure tree for the category. If category is not specified (null), or its * filter is not found, returns the whole tree. * The root node of the tree always match RAML HL tree root. * @param categoryName */ export declare function getStructureJSON(categoryName: string): structure.StructureNodeJSON; /** * Returns a map from category name to a category structure subtree. * @returns {{}} */ export declare function getStructureForAllCategories(): { [categoryName: string]: structure.StructureNode; }; /** * Adds another decoration to the default decorator, allowing simple set up * of decorations as a map from node type to its icon and text style. * @param nodeType * @param decoration */ export declare function addDecoration(nodeType: NodeType, decoration: Decoration): void; /** * Chesk if instance is of TypedStructureNode type. * @param node */ export declare function isTypedStructureNode(node: StructureNode): node is TypedStructureNode; /** * Gets details for a position. * Requires AST provider to be set up via setASTProvider method call. * * In case of the optional position parameter missing, AST provider's getSelectedNode method * will be called to determine the node to return detaisl for. * @param position - position index in text counting from 0. Optional. */ export declare function getDetails(position?: number): detailsInterface.DetailsItem; /** * Gets details for a raml ast node. * @param node - raml ast node. */ export declare function buildDetailsItem(node: detailsImplementation.IParseResult): detailsInterface.DetailsItem; /** * Gets details JSON for a position. * Requires AST provider to be set up via setASTProvider method call. * * In case of the optional position parameter missing, AST provider's getSelectedNode method * will be called to determine the node to return detaisl for. * @param position */ export declare function getDetailsJSON(position?: number): detailsInterface.DetailsItemJSON; /** * Sets editor provider. This method MUST be called at least once, otherwise * it will be impossible to calculate the state and an empty state will be returned. * @param editorProvider */ export declare function setEditorProvider(editorProvider: commonInterfaces.IEditorProvider): void; /** * Changes the value of details item. * @param position - cursor position * @param itemID - details item ID * @param value - new value */ export declare function changeDetailValue(position: number, itemID: string, value: string | number | boolean): commonInterfaces.IChangedDocument; /** * Runs details action * @param position - cursor position * @param itemID - details item ID */ export declare function runDetailsAction(position: number, itemID: string): commonInterfaces.IChangedDocument; /** * Sets logger for the suggestions. * @param logger */ export declare function setLogger(logger: loggerModule.ILogger): void;