Skip to content

Commit

Permalink
Add Xcode 8.3 support and prevent folding manager related crashes.
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanceriu committed Apr 9, 2017
1 parent 92357cb commit 1005a45
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 102 deletions.
2 changes: 2 additions & 0 deletions SCXcodeMinimap/SCXcodeMinimap-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
<string>ACA8656B-FEA8-4B6D-8E4A-93F4C95C362C</string>
<string>1637F4D5-0B27-416B-A78D-498965D64877</string>
<string>DA4FDFD8-C509-4D8B-8B55-84A7B66AE701</string>
<string>E0A62D1F-3C18-4D74-BFE5-A4167D643966</string>
<string>DFFB3951-EB0A-4C09-9DAC-5F2D28CC839C</string>
</array>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
Expand Down
54 changes: 27 additions & 27 deletions SCXcodeMinimap/SCXcodeMinimapView.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#import "SCXcodeMinimapTheme.h"
#import "DVTPreferenceSetManager.h"

#import "DVTFoldingManager.h"
//#import "DVTFoldingManager.h"

#import "DVTAnnotationManager.h"
#import "DBGBreakpointAnnotationProvider+SCXcodeMinimap.h"
Expand Down Expand Up @@ -74,7 +74,7 @@ typedef NS_ENUM(NSUInteger, SCXcodeMinimapAnnotationType) {


@interface SCXcodeMinimapView () < NSLayoutManagerDelegate,
DVTFoldingManagerDelegate,
//DVTFoldingManagerDelegate,
DBGBreakpointAnnotationProviderDelegate,
IDEIssueAnnotationProviderDelegate,
DVTLayoutManagerMinimapDelegate,
Expand Down Expand Up @@ -159,7 +159,7 @@ - (instancetype)initWithEditor:(IDESourceCodeEditor *)editor
[(NSMutableArray *)storage.layoutManagers removeObject:layoutManager];
[(NSMutableArray *)storage.layoutManagers addObject:layoutManager];

[self.editorTextView.layoutManager.foldingManager setDelegate:self];
//[self.editorTextView.layoutManager.foldingManager setDelegate:self];

[self.textView setEditable:NO];
[self.textView setSelectable:NO];
Expand Down Expand Up @@ -413,9 +413,9 @@ - (NSDictionary *)layoutManager:(NSLayoutManager *)layoutManager
}
}

short nodeType = [(DVTTextStorage *)[self.textView textStorage] nodeTypeAtCharacterIndex:charIndex
effectiveRange:effectiveRange
context:self.editorTextView.syntaxColoringContext];
short nodeType = [(DVTTextStorage *)[self.editorTextView textStorage] nodeTypeAtCharacterIndex:charIndex
effectiveRange:effectiveRange
context:[self.editor syntaxColoringContextForTextView:self.editorTextView]];



Expand Down Expand Up @@ -459,24 +459,29 @@ - (void)layoutManager:(DVTLayoutManager *)layoutManager didCompleteLayoutForText
}
}

#pragma mark - DVTFoldingManagerDelegate

- (void)foldingManager:(DVTFoldingManager *)foldingManager didFoldRange:(NSRange)range
{
[(DVTLayoutManager *)self.editorTextView.layoutManager foldingManager:foldingManager didFoldRange:range];

[self.textView.layoutManager.foldingManager foldRange:range];

[self updateOffset];
}
//#pragma mark - DVTFoldingManagerDelegate
//
//- (void)foldingManager:(DVTFoldingManager *)foldingManager didFoldRange:(NSRange)range
//{
// [(DVTLayoutManager *)self.editorTextView.layoutManager foldingManager:foldingManager didFoldRange:range];
//
// [self.textView.layoutManager.foldingManager foldRange:range];
//
// [self updateOffset];
//}
//
//- (void)foldingManager:(DVTFoldingManager *)foldingManager didUnfoldRange:(NSRange)range
//{
// [(DVTLayoutManager *)self.editorTextView.layoutManager foldingManager:foldingManager didUnfoldRange:range];
//
// [self.textView.layoutManager.foldingManager unfoldRange:range];
//
// [self updateOffset];
//}

- (void)foldingManager:(DVTFoldingManager *)foldingManager didUnfoldRange:(NSRange)range
- (id)foldingTokenTypesForLayoutManager:(DVTLayoutManager *)layoutManager
{
[(DVTLayoutManager *)self.editorTextView.layoutManager foldingManager:foldingManager didUnfoldRange:range];

[self.textView.layoutManager.foldingManager unfoldRange:range];

[self updateOffset];
return [self.editorTextView foldingTokenTypesForLayoutManager:layoutManager];
}

#pragma mark - IDEEditorAreaMinimapDelegate
Expand Down Expand Up @@ -507,11 +512,6 @@ - (void)layoutManagerDidRequestSelectedSymbolInstancesHighlight:(DVTLayoutManage
[self invalidateHighligtedSymbols];
}

- (id) foldingTokenTypesForLayoutManager:(DVTLayoutManager *)layoutManager
{
return nil;
}

#pragma mark - IDESourceCodeEditorSearchResultsDelegate

- (void)sourceCodeEditorDidUpdateSearchResults:(IDESourceCodeEditor *)editor
Expand Down
173 changes: 98 additions & 75 deletions SCXcodeMinimap/Xcode Headers/DVTSourceTextView.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,70 +6,73 @@

#import "DVTCompletingTextView.h"

@class DVTAnnotationManager, DVTMutableRangeArray, DVTObservingToken, DVTTextAnnotationIndicatorAnimation, DVTTextDocumentLocation, DVTTextPageGuideVisualization, NSAnimation, NSArray, NSDictionary, NSHashTable, NSMutableArray, NSString, NSTimer, NSView, NSWindow;
@class DVTAnnotationManager, DVTMutableRangeArray, DVTObservingToken, DVTTextAnnotationIndicatorAnimation, DVTTextDocumentLocation, DVTTextPageGuideVisualization, NSAnimation, NSArray, NSColor, NSHashTable, NSMutableArray, NSMutableIndexSet, NSString, NSTimer, NSView, NSWindow;

@interface DVTSourceTextView : DVTCompletingTextView
{
unsigned long long _oldFocusLocation;
NSAnimation *_blockAnimation;
struct CGPoint _lastMouseMovedLocation;
struct _NSRange _foldingHoverRange;
DVTTextAnnotationIndicatorAnimation *_annotationIndicatorAnimation;
unsigned long long _temporaryLinkHoverModifierFlags;
unsigned long long _temporaryLinkHoverAltModifierFlags;
NSArray *_clickedTemporaryLinkRanges;
NSMutableArray *_clickedLinkProgressIndicators;
struct _NSRange _ghostStringRange;
NSTimer *_autoHighlightTokenMenuTimer;
struct _NSRange _autoHighlightTokenMenuRange;
double _autoHighlightTokenMenuAnimationDuration;
NSTimer *_autoHighlightTokenMenuAnimationTimer;
double _autoHighlightTokenMenuAnimationStartTime;
NSWindow *_autoHighlightTokenWindow;
NSArray *_foundLocations;
DVTTextDocumentLocation *_currentFoundLocation;
NSMutableArray *_visualizations;
unsigned long long _pageGuideColumn;
DVTTextPageGuideVisualization *_pageGuideVisualization;
unsigned long long _locationOfAutoOpenedCloseBracket;
unsigned long long _locationOfOpenBracePendingClose;
NSTimer *_scrollbarMarkerUpdateTimer;
DVTAnnotationManager *_annotationManager;
NSHashTable *_preparedViewAnnotations;
NSView *_staticVisualizationView;
int _findResultStyle;
DVTMutableRangeArray *_typeOverCompletionRanges;
DVTMutableRangeArray *_typeOverCompletionOpenRanges;
NSString *_pendingTypeOverCompletion;
struct _NSRange _pendingTypeOverCompletionOpenRange;
BOOL _didChangeText;
struct {
unsigned int dDidFinishAnimatingScroll:1;
unsigned int dDidScroll:1;
unsigned int dColoringContext:1;
unsigned int delegateRespondsToWillReturnPrintJobTitle:1;
unsigned int updatingInsertionPoint:1;
unsigned int wasPostsFrameChangedNotifications:1;
unsigned int doingDidChangeSelection:1;
unsigned int delegateRespondsToConstrainMinAccessoryAnnotationWidth:1;
unsigned int delegateRespondsToConstrainMaxAccessoryAnnotationWidth:1;
unsigned int delegateRespondsToConstrainAccessoryAnnotationWidth:1;
} _sFlags;
BOOL _isDoingBatchEdit;
BOOL _allowsCodeFolding;
BOOL _showingCodeFocus;
BOOL _lastMouseEventWasClick;
BOOL _tokenizedEditingEnabled;
BOOL _animatesCurrentScroll;
BOOL _disableUpdatingInsertionPointCount;
BOOL _currentlyAutoCompletingBracket;
BOOL _currentlyDoingNonUserEditing;
BOOL _wrapsLines;
BOOL _postsLayoutManagerNotifications;
BOOL _scrollingInScrollView;
DVTObservingToken *_autoHighlightTokenRangesObservingToken;
struct _NSRange _selectedRangeBeforeMouseDown;
BOOL _ensuringLayoutForScroll;
unsigned long long _oldFocusLocation;
NSAnimation *_blockAnimation;
struct CGPoint _lastMouseMovedLocation;
struct _NSRange _foldingHoverRange;
DVTTextAnnotationIndicatorAnimation *_annotationIndicatorAnimation;
unsigned long long _temporaryLinkHoverModifierFlags;
unsigned long long _temporaryLinkHoverAltModifierFlags;
NSArray *_clickedTemporaryLinkRanges;
NSMutableArray *_clickedLinkProgressIndicators;
struct _NSRange _ghostStringRange;
NSTimer *_autoHighlightTokenMenuTimer;
struct _NSRange _autoHighlightTokenMenuRange;
double _autoHighlightTokenMenuAnimationDuration;
NSTimer *_autoHighlightTokenMenuAnimationTimer;
double _autoHighlightTokenMenuAnimationStartTime;
NSWindow *_autoHighlightTokenWindow;
NSArray *_foundLocations;
DVTTextDocumentLocation *_currentFoundLocation;
NSMutableArray *_visualizations;
unsigned long long _pageGuideColumn;
DVTTextPageGuideVisualization *_pageGuideVisualization;
unsigned long long _locationOfAutoOpenedCloseBracket;
unsigned long long _locationOfOpenBracePendingClose;
NSTimer *_scrollbarMarkerUpdateTimer;
DVTAnnotationManager *_annotationManager;
NSHashTable *_preparedViewAnnotations;
NSView *_staticVisualizationView;
int _findResultStyle;
DVTMutableRangeArray *_typeOverCompletionRanges;
DVTMutableRangeArray *_typeOverCompletionOpenRanges;
NSString *_pendingTypeOverCompletion;
struct _NSRange _pendingTypeOverCompletionOpenRange;
NSMutableIndexSet *_linesNeedingToTrimTrailingShitespace;
BOOL _didChangeText;
struct {
unsigned int dDidFinishAnimatingScroll:1;
unsigned int dDidScroll:1;
unsigned int delegateRespondsToWillReturnPrintJobTitle:1;
unsigned int updatingInsertionPoint:1;
unsigned int wasPostsFrameChangedNotifications:1;
unsigned int doingDidChangeSelection:1;
unsigned int disableDrawingCurrentLineHighlight:1;
unsigned int delegateRespondsToConstrainMinAccessoryAnnotationWidth:1;
unsigned int delegateRespondsToConstrainMaxAccessoryAnnotationWidth:1;
unsigned int delegateRespondsToConstrainAccessoryAnnotationWidth:1;
} _sFlags;
BOOL _isDoingBatchEdit;
BOOL _allowsCodeFolding;
BOOL _showingCodeFocus;
BOOL _lastMouseEventWasClick;
BOOL _tokenizedEditingEnabled;
BOOL _animatesCurrentScroll;
BOOL _disableUpdatingInsertionPointCount;
BOOL _currentlyAutoCompletingBracket;
BOOL _wrapsLines;
BOOL _postsLayoutManagerNotifications;
BOOL _scrollingInScrollView;
DVTObservingToken *_autoHighlightTokenRangesObservingToken;
struct _NSRange _selectedRangeBeforeMouseDown;
BOOL _ensuringLayoutForScroll;
BOOL _suppressRecentColorTracking;
NSColor *_recentlySelectedColorToTrack;
struct _NSRange _recentlySelectedColorLiteralRange;
}

+ (BOOL)isCompatibleWithResponsiveScrolling;
Expand All @@ -79,6 +82,7 @@
+ (id)foldingLogAspect;
+ (id)drawingLogAspect;
+ (void)initialize;

@property BOOL postsLayoutManagerNotifications; // @synthesize postsLayoutManagerNotifications=_postsLayoutManagerNotifications;
@property int findResultStyle; // @synthesize findResultStyle=_findResultStyle;
@property(nonatomic) unsigned long long pageGuideColumn; // @synthesize pageGuideColumn=_pageGuideColumn;
Expand All @@ -87,6 +91,30 @@
@property unsigned long long temporaryLinkHoverAltModifierFlags; // @synthesize temporaryLinkHoverAltModifierFlags=_temporaryLinkHoverAltModifierFlags;
@property unsigned long long temporaryLinkHoverModifierFlags; // @synthesize temporaryLinkHoverModifierFlags=_temporaryLinkHoverModifierFlags;
@property(nonatomic) BOOL wrapsLines; // @synthesize wrapsLines=_wrapsLines;

- (id)mediaResourceProviderForLiteralInLayoutManager:(id)arg1;
- (id)directoriesForLiteralInLayoutManager:(id)arg1;
- (id)foldingTokenTypesForLayoutManager:(id)arg1;
- (void)doubleClickedOnCell:(id)arg1 inRect:(struct CGRect)arg2 atIndexInToken:(unsigned long long)arg3;
- (void)colorQuickEdit:(id)arg1 didSelectMoreColorOptions:(id)arg2;
- (void)colorQuickEdit:(id)arg1 didSelectColor:(id)arg2;
- (void)colorQuickEdit:(id)arg1 didHighlightColor:(id)arg2;
- (void)imageQuickEdit:(id)arg1 didClickMoreButtonForFilePath:(id)arg2;
- (void)imageQuickEdit:(id)arg1 didSelectFilePath:(id)arg2;
- (void)fileQuickEdit:(id)arg1 didClickMoreButtonForFilePath:(id)arg2;
- (void)fileQuickEdit:(id)arg1 didSelectFilePath:(id)arg2;
- (void)changeColor:(id)arg1;
- (void)updateSelectedColorLiteralWithColor:(id)arg1;
- (void)presentOpenPanelForObjectLiteralAtFilePath:(id)arg1;
- (void)presentPopoverRelativeToSelection:(id)arg1;
- (void)insertObjectLiteralSyntaxForObjects:(id)arg1 selectLastObjectLiteral:(BOOL)arg2;
- (BOOL)readObjectLiteralFromPasteboard:(id)arg1 type:(id)arg2;
- (BOOL)readSelectionFromPasteboard:(id)arg1 type:(id)arg2;
- (id)readablePasteboardTypes;
- (BOOL)performDragOperation:(id)arg1;
- (unsigned long long)dragOperationForDraggingInfo:(id)arg1 type:(id)arg2;
- (id)acceptableDragTypes;
- (id)_addingRedablePasteboardTypesForObjectLiterals:(id)arg1;
- (void)viewDidEndLiveResize;
- (void)viewWillStartLiveResize;
- (void)updateInsertionPointStateAndRestartTimer:(BOOL)arg1;
Expand Down Expand Up @@ -116,7 +144,6 @@
- (void)foldRecursive:(id)arg1;
- (void)fold:(id)arg1;
- (BOOL)writeSelectionToPasteboard:(id)arg1 type:(id)arg2;
- (BOOL)writeRTFSelectionToPasteboard:(id)arg1;
- (id)writablePasteboardTypes;
- (void)balance:(id)arg1;
- (void)shiftLeft:(id)arg1;
Expand All @@ -126,7 +153,6 @@
- (void)indentSelectionIfIndentable:(id)arg1;
- (void)indentSelection:(id)arg1;
- (struct _NSRange)_adjustedSelectedRange:(struct _NSRange)arg1 fromChangeIndex:(unsigned long long)arg2;
- (void)commentAndUncommentCurrentLines:(id)arg1;
- (void)moveCurrentLineDown:(id)arg1;
- (void)moveCurrentLineUp:(id)arg1;
- (void)_didChangeSelection:(id)arg1;
Expand All @@ -140,7 +166,7 @@
- (id)accessibilityAXAttributedStringForCharacterRange:(struct _NSRange)arg1 parent:(id)arg2;
- (BOOL)scrollRectToVisible:(struct CGRect)arg1;
- (void)scrollPoint:(struct CGPoint)arg1;
- (void)setMarkedText:(id)arg1 selectedRange:(struct _NSRange)arg2;
- (void)setMarkedText:(id)arg1 selectedRange:(struct _NSRange)arg2 replacementRange:(struct _NSRange)arg3;
- (BOOL)shouldChangeTextInRanges:(id)arg1 replacementStrings:(id)arg2;
- (void)_invalidateAllRevealovers;
- (BOOL)isEditable;
Expand Down Expand Up @@ -168,7 +194,6 @@
- (void)textStorage:(id)arg1 willEndEditRange:(struct _NSRange)arg2 changeInLength:(long long)arg3;
- (void)didEndTokenizedEditingWithRanges:(id)arg1;
- (void)willStartTokenizedEditingWithRanges:(id)arg1;
- (void)tokenizableRangesWithRange:(struct _NSRange)arg1 completionBlock:(id)arg2;
- (void)_scheduleAutoHighlightTokenMenuTimerIfNeeded;
- (void)_showAutoHighlightTokenMenuWithTimer:(id)arg1;
- (id)_autoHighlightTokenWindowWithTokenRect:(struct CGRect)arg1;
Expand All @@ -182,16 +207,14 @@
- (void)_clearAutoHighlightTokenMenu;
- (void)removeStaticVisualizationView;
- (void)addStaticVisualizationView:(id)arg1;
- (void)removeVisualization:(id)arg1 fadeOut:(BOOL)arg2 completionBlock:(id)arg3;
- (void)addVisualization:(id)arg1 fadeIn:(BOOL)arg2 completionBlock:(id)arg3;
- (void)adjustTypeOverCompletionForSelectionChange:(struct _NSRange)arg1;
- (void)removeInvalidTypeOverCompletion;
- (void)removeTypeOverCompletionIfAppropriateForEditedRange:(struct _NSRange)arg1 changeInLength:(long long)arg2;
- (void)adjustTypeOverCompletionForEditedRange:(struct _NSRange)arg1 changeInLength:(long long)arg2;
- (void)addTypeOverCompletionForRange:(struct _NSRange)arg1 openRange:(struct _NSRange)arg2;
- (struct _NSRange)lastTypeOverCompletionRange;
- (struct _NSRange)typeOverCompletionRangeFollowingLocation:(unsigned long long)arg1;
- (void)didInsertCompletionTextAtRange:(struct _NSRange)arg1;
- (void)textCompletionSession:(id)arg1 didInsertCompletionItem:(id)arg2 range:(struct _NSRange)arg3;
- (struct _NSRange)_suggestedOpenRangeForTypeOverRange:(struct _NSRange)arg1;
- (BOOL)shouldAutoCompleteAtLocation:(unsigned long long)arg1;
- (BOOL)shouldSuppressTextCompletion;
Expand All @@ -215,6 +238,7 @@
- (void)paste:(id)arg1;
- (void)_paste:(id)arg1 indent:(BOOL)arg2;
- (void)insertNewline:(id)arg1;
- (BOOL)handleInsertNewline;
- (BOOL)handleInsertTab;
- (BOOL)handleSelectPreviousPlaceholder;
- (BOOL)handleSelectNextPlaceholder;
Expand All @@ -240,6 +264,7 @@
- (void)mouseMoved:(id)arg1;
- (void)_mouseInside:(id)arg1;
- (void)resetCursorRects;
- (void)keyDown:(id)arg1;
- (void)removeFromSuperview;
- (void)viewDidMoveToWindow;
- (void)_refreshScrollerMarkers;
Expand Down Expand Up @@ -268,21 +293,22 @@
- (void)toggleCodeFocus:(id)arg1;
- (BOOL)codeFocusFollowsSelection;
- (void)_drawViewBackgroundInRect:(struct CGRect)arg1;
- (void)_drawCurrentLineHighlight:(struct CGRect)arg1;
- (void)_drawCaretForTextAnnotationsInRect:(struct CGRect)arg1;
- (void)drawTextAnnotationsInRect:(struct CGRect)arg1;
- (long long)_drawRoundedBackgroundForFoldableBlockRangeAtLocation:(unsigned long long)arg1;
- (double)_grayLevelForDepth:(long long)arg1;
- (id)alternateColor;
- (void)setFoldingHoverRange:(struct _NSRange)arg1;
- (struct _NSRange)foldingHoverRange;
- (void)_loadColorsFromCurrentTheme;
- (void)_themeColorsChanged:(id)arg1;
- (void)_loadFontsAndColorsFromTheme:(id)arg1;
- (void)_fontAndColorSettingsChanged:(id)arg1;
- (void)_scheduleAnnotationLayout;
- (void)drawRect:(struct CGRect)arg1;
- (void)prepareContentInRect:(struct CGRect)arg1;
- (unsigned long long)foldedCharacterIndexForPoint:(struct CGPoint)arg1;
- (void)setSelectedRanges:(id)arg1 affinity:(unsigned long long)arg2 stillSelecting:(BOOL)arg3;
- (void)_delayedTrimTrailingWhitespaceForLine:(id)arg1;
- (void)_delayedTrimTrailingWhitespaceForLines;
- (void)trimTrailingWhitespaceOnLine:(unsigned long long)arg1;
- (void)_trimTrailingWhitespaceOnLineAfterIndent:(unsigned long long)arg1 trimWhitespaceOnlyLine:(BOOL)arg2;
- (void)trimTrailingWhitespaceOnLine:(unsigned long long)arg1 trimWhitespaceOnlyLine:(BOOL)arg2;
Expand All @@ -291,7 +317,6 @@
- (void)setSelectedRange:(struct _NSRange)arg1;
- (void)contextMenu_toggleMessageBubbleShown:(id)arg1;
- (void)toggleMessageBubbleShown:(id)arg1;
- (void)_enumerateMessageBubbleAnnotationsInSelection:(id)arg1;
@property(readonly, getter=isAccessoryAnnotationCollapsed) BOOL accessoryAnnotationCollapsed;
- (void)setAccessoryAnnotationWidth:(double)arg1;
- (double)_maxAllowableAccessoryAnnotationWidth;
Expand All @@ -314,16 +339,14 @@
- (struct _NSRange)lineNumberRangeForBoundingRect:(struct CGRect)arg1;
- (unsigned long long)lineNumberForPoint:(struct CGPoint)arg1;
- (id)printJobTitle;
- (void)setIsCurrentlyDoingNonUserEditing:(BOOL)arg1;
@property(readonly) BOOL isCurrentlyDoingNonUserEditing;
@property(readonly) NSDictionary *syntaxColoringContext;
- (id)language;
- (BOOL)allowsCodeFolding;
- (void)setAllowsCodeFolding:(BOOL)arg1;
- (void)setTextStorage:(id)arg1;
- (void)setTextStorage:(id)arg1 keepOldLayout:(BOOL)arg2;
- (void)setTextContainer:(id)arg1;
- (id)initWithCoder:(id)arg1;
- (void)dealloc;
- (id)initWithFrame:(struct CGRect)arg1 textContainer:(id)arg2;
- (void)_commonInitDVTSourceTextView;
- (id)menuForEvent:(id)arg1;
Expand Down

0 comments on commit 1005a45

Please sign in to comment.