C# Class AppKit.TextKit.Formatter.LanguageFormatter

Inheritance: NSObject
Show file Open project: xamarin/mac-samples Class Usage Examples

Public Methods

Method Description
FindEndOfLine ( string text, NSRange position ) : NSRange

Finds the start of end for the given location in the text as defined by the NewLine, LineSeparator and ParagraphSeparator characters.

FindLineBoundries ( string text, NSRange position ) : NSRange

Finds the line boundries as defined by the NewLine, LineSeparator and ParagraphSeparator characters.

FindStartOfLine ( string text, NSRange position ) : NSRange

Finds the start of line for the given location in the text as defined by the NewLine, LineSeparator and ParagraphSeparator characters.

FindWordBoundries ( string text, NSRange position ) : NSRange

Finds the word boundries as defined by the LanguageSeparators in the AppKit.TextKit.Formatter.LanguageDescriptor that is currently being syntax highlighted.

HighlightSyntax ( string word, NSRange range ) : void

Uses the current Language (AppKit.TextKit.Formatter.LanguageDescriptor) to syntax highlight the given word in the attached TextEditor (NSTextView) at the given character locations.

TODO: The Text Kit SetTemporaryAttributes routines are handiling the format of character strings such as HTML or XML tag incorrectly.

HighlightSyntaxRegion ( string text, NSRange position ) : void

Based on the current Language (AppKit.TextKit.Formatter.LanguageDescriptor), highlight the syntax of the given character region.

IsLanguageSeparator ( char c ) : bool

Determines whether the passed in character is a language separator.

LanguageFormatter ( NSTextView textEditor, LanguageDescriptor language ) : System

Initializes a new instance of the AppKit.TextKit.Formatter.LanguageFormatter class.

PreceedingCharacterIsWhitespaceOrTerminator ( string text, NSRange position ) : bool

Tests to see if the preceeding character is whitespace or terminator.

Returns true if at start of line.

Reformat ( ) : void

Forces all of the text in the attached NSTextView (the TextEditor property) to have its syntax rehighlighted by re-running the formatter.

TrailingCharacterIsWhitespaceOrTerminator ( string text, NSRange position ) : bool

Tests to see if the trailing character is whitespace or terminator.

Returns true if at end of line.

Method Details

FindEndOfLine() public method

Finds the start of end for the given location in the text as defined by the NewLine, LineSeparator and ParagraphSeparator characters.
public FindEndOfLine ( string text, NSRange position ) : NSRange
text string The text to find the end of the line in.
position NSRange The current location of the cursor in the text and possible selection.
return NSRange

FindLineBoundries() public method

Finds the line boundries as defined by the NewLine, LineSeparator and ParagraphSeparator characters.
public FindLineBoundries ( string text, NSRange position ) : NSRange
text string The string to be searched.
position NSRange The NSRange specifying the starting location of a possible /// line of text.
return NSRange

FindStartOfLine() public method

Finds the start of line for the given location in the text as defined by the NewLine, LineSeparator and ParagraphSeparator characters.
public FindStartOfLine ( string text, NSRange position ) : NSRange
text string The text to find the start of the line in.
position NSRange The current location of the cursor in the text and possible selection.
return NSRange

FindWordBoundries() public method

Finds the word boundries as defined by the LanguageSeparators in the AppKit.TextKit.Formatter.LanguageDescriptor that is currently being syntax highlighted.
public FindWordBoundries ( string text, NSRange position ) : NSRange
text string The string to be searched.
position NSRange The NSRange specifying the starting location of a possible word.
return NSRange

HighlightSyntax() public method

Uses the current Language (AppKit.TextKit.Formatter.LanguageDescriptor) to syntax highlight the given word in the attached TextEditor (NSTextView) at the given character locations.
TODO: The Text Kit SetTemporaryAttributes routines are handiling the format of character strings such as HTML or XML tag incorrectly.
public HighlightSyntax ( string word, NSRange range ) : void
word string The possible keyword to highlight.
range NSRange An NSRange specifying the starting and ending character locations /// for the word to highlight.
return void

HighlightSyntaxRegion() public method

Based on the current Language (AppKit.TextKit.Formatter.LanguageDescriptor), highlight the syntax of the given character region.
public HighlightSyntaxRegion ( string text, NSRange position ) : void
text string The string value to be syntax highlighted.
position NSRange The starting location of the text to be highlighted.
return void

IsLanguageSeparator() public method

Determines whether the passed in character is a language separator.
public IsLanguageSeparator ( char c ) : bool
c char The character being tested.
return bool

LanguageFormatter() public method

Initializes a new instance of the AppKit.TextKit.Formatter.LanguageFormatter class.
public LanguageFormatter ( NSTextView textEditor, LanguageDescriptor language ) : System
textEditor NSTextView The NSTextView that this language formatter will syntax highlight.
language LanguageDescriptor The defining the /// language syntax highlighting rules.
return System

PreceedingCharacterIsWhitespaceOrTerminator() public method

Tests to see if the preceeding character is whitespace or terminator.
Returns true if at start of line.
public PreceedingCharacterIsWhitespaceOrTerminator ( string text, NSRange position ) : bool
text string The text to test.
position NSRange The current cursor position inside the text.
return bool

Reformat() public method

Forces all of the text in the attached NSTextView (the TextEditor property) to have its syntax rehighlighted by re-running the formatter.
public Reformat ( ) : void
return void

TrailingCharacterIsWhitespaceOrTerminator() public method

Tests to see if the trailing character is whitespace or terminator.
Returns true if at end of line.
public TrailingCharacterIsWhitespaceOrTerminator ( string text, NSRange position ) : bool
text string The text to test.
position NSRange The current cursor position inside the text.
return bool