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

#import <XcodeKit/XcodeKitDefines.h>

#import <XcodeKit/XCSourceTextPosition.h>


NS_ASSUME_NONNULL_BEGIN


/// A half-open range of text in a buffer you use to select text or specify the insertion point for new text.
///
/// Source text ranges are half-open ranges. As a result, source text ranges include the character at the start position but exclude the character at the end position.
///
/// A range with equal start and end positions may be used to indicate a point within the buffer, such as an insertion point. The `start` and `end`
/// position may be improperly ordered while you prepare them in your own code, but must be properly ordered before passing an `XCSourceTextRange` instance to other methods.
@interface XCSourceTextRange : NSObject <NSCopying>

/// The start position of the range.
@property XCSourceTextPosition start;

/// The end position of the range.
@property XCSourceTextPosition end;

/// Creates a new source text range defined by its starting and ending positions.
- (instancetype)initWithStart:(XCSourceTextPosition)start end:(XCSourceTextPosition)end NS_DESIGNATED_INITIALIZER;

@end


NS_ASSUME_NONNULL_END
