CodeHighlighter
A syntax highlighter intended for code.
CodeHighlighter.swift:11class CodeHighlighter
By adjusting various properties of this resource, you can change the colors of strings, comments, numbers, and other text patterns inside a TextEdit
control.
Superclasses
class SyntaxHighlighter
Base class for syntax highlighters. Provides syntax highlighting data to a
TextEdit
.
Citizens in SwiftGodot
Conformances
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol Identifiable<ID>
A class of types whose instances hold the value of an entity with stable identity.
protocol VariantRepresentable
Types that conform to VariantRepresentable can be stored directly in
Variant
with no conversion. These include all of the Variant types from Godot (for exampleGString
,Rect
,Plane
), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.protocol VariantStorable
Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
Type members
Instance members
var colorRegions: GDictionary
Sets the color regions. All existing regions will be removed. The
GDictionary
key is the region start and end key, separated by a space. The value is the region color.var functionColor: Color
Sets color for functions. A function is a non-keyword string followed by a ‘(’.
var keywordColors: GDictionary
Sets the keyword colors. All existing keywords will be removed. The
GDictionary
key is the keyword. The value is the keyword color.var memberKeywordColors: GDictionary
Sets the member keyword colors. All existing member keyword will be removed. The
GDictionary
key is the member keyword. The value is the member keyword color.var memberVariableColor: Color
Sets color for member variables. A member variable is non-keyword, non-function string proceeded with a ‘.’.
var numberColor: Color
Sets the color for numbers.
var symbolColor: Color
Sets the color for symbols.
func addColorRegion(startKey: String, endKey: String, color: Color, lineOnly: Bool
) Adds a color region such as comments or strings.
func addKeywordColor(keyword: String, color: Color
) Sets the color for a keyword.
func addMemberKeywordColor(memberKeyword: String, color: Color
) Sets the color for a member keyword.
func clearColorRegions(
) Removes all color regions.
func clearKeywordColors(
) Removes all keywords.
func clearMemberKeywordColors(
) Removes all member keywords.
func getKeywordColor(keyword: String
) -> Color Returns the color for a keyword.
func getMemberKeywordColor(memberKeyword: String
) -> Color Returns the color for a member keyword.
func hasColorRegion(startKey: String
) -> Bool Returns
true
if the start key exists, elsefalse
.func hasKeywordColor(keyword: String
) -> Bool Returns
true
if the keyword exists, elsefalse
.func hasMemberKeywordColor(memberKeyword: String
) -> Bool Returns
true
if the member keyword exists, elsefalse
.func removeColorRegion(startKey: String
) Removes the color region that uses that start key.
func removeKeywordColor(keyword: String
) Removes the keyword.
func removeMemberKeywordColor(memberKeyword: String
) Removes the member keyword.