//
//  XCSourceEditorExtension.h
//  Xcode
//
//  Copyright © 2016-2022 Apple Inc. All rights reserved.
//

#import <XcodeKit/XcodeKitDefines.h>


NS_ASSUME_NONNULL_BEGIN


/// A key in the dictionary that defines a source editor command.
typedef NSString * XCSourceEditorCommandDefinitionKey NS_TYPED_ENUM;

/// The identifier of the source editor command in its attributes.
XCODE_EXPORT XCSourceEditorCommandDefinitionKey const XCSourceEditorCommandIdentifierKey;

/// The name of the source editor command in its attributes.
XCODE_EXPORT XCSourceEditorCommandDefinitionKey const XCSourceEditorCommandNameKey;

/// The class of the source editor command, in its attributes.
XCODE_EXPORT XCSourceEditorCommandDefinitionKey const XCSourceEditorCommandClassNameKey;

/// The protocol you implement to create Xcode source editor extensions.
///
/// There are no guarantees about the thread or queue on which any Xcode Source Editor Extension methods are executed, including the designated initializer.
@protocol XCSourceEditorExtension <NSObject>

@optional

/// Tells the extension that it successfully launched and may begin to receive editor commands.
///
/// There are no guarantees about the thread or queue on which this method is called.
- (void)extensionDidFinishLaunching;

/// The array of command definitions used by Xcode to associate command names with their implementation in an extension.
///
/// Implement this property when you need to override the command definitions specified in your extension target's Info.plist file. There are no guarantees about the thread or queue on which this property is accessed.
@property (readonly, copy) NSArray <NSDictionary <XCSourceEditorCommandDefinitionKey, id> *> *commandDefinitions;

@end


NS_ASSUME_NONNULL_END
