From b7079203553d802db906bf6241cf9223b882955c Mon Sep 17 00:00:00 2001 From: Paulb23 Date: Sun, 11 Oct 2020 17:07:33 +0100 Subject: Update SyntaxHighlighter documentation --- doc/classes/CodeHighlighter.xml | 28 ++++++++++++++++++++++++++++ doc/classes/EditorSyntaxHighlighter.xml | 6 ++++++ doc/classes/ScriptEditor.xml | 6 ++++++ doc/classes/ScriptEditorBase.xml | 11 +++++++++++ doc/classes/SyntaxHighlighter.xml | 33 +++++++++++++++++++++++++++++++++ doc/classes/TextEdit.xml | 3 ++- 6 files changed, 86 insertions(+), 1 deletion(-) (limited to 'doc/classes') diff --git a/doc/classes/CodeHighlighter.xml b/doc/classes/CodeHighlighter.xml index 7a1dad547b..5311498677 100644 --- a/doc/classes/CodeHighlighter.xml +++ b/doc/classes/CodeHighlighter.xml @@ -1,8 +1,10 @@ + A syntax highlighter for code. + A syntax highlighter for code. @@ -19,6 +21,9 @@ + Adds a color region such as comments or strings. + Both the start and end keys must be symbols. Only the start key has to be unique. + Line only denotes if the region should continue until the end of the line or carry over on to the next line. If the end key is blank this is automatically set to [code]true[/code]. @@ -29,6 +34,8 @@ + Sets the color for a keyword. + The keyword cannot contain any symbols except '_'. @@ -39,24 +46,30 @@ + Sets the color for a member keyword. + The member keyword cannot contain any symbols except '_'. + It will not be highlighted if preceded by a '.'. + Removes all color regions. + Removes all keywords. + Removes all member keywords. @@ -65,6 +78,7 @@ + Returns the color for a keyword. @@ -73,6 +87,7 @@ + Returns the color for a member keyword. @@ -81,6 +96,7 @@ + Return [code]true[/code] if the start key exists, else [code]false[/code]. @@ -89,6 +105,7 @@ + Return [code]true[/code] if the keyword exists, else [code]false[/code]. @@ -97,6 +114,7 @@ + Return [code]true[/code] if the member keyword exists, else [code]false[/code]. @@ -105,6 +123,7 @@ + Removes the color region that uses that start key. @@ -113,6 +132,7 @@ + Removes the keyword. @@ -121,23 +141,31 @@ + Removes the member keyword. + Sets the color regions. All existing regions will be removed. The [Dictionary] key is the region start and end key, separated by a space. The value is the region color. + Sets color for functions. A function is a non-keyword string followed by a '('. + Sets the keyword colors. All existing keywords will be removed. The [Dictionary] key is the keyword. The value is the keyword color. + Sets the member keyword colors. All existing member keyword will be removed. The [Dictionary] key is the member keyword. The value is the member keyword color. + Sets color for member variables. A member variable is non-keyword, non-function string proceeded with a '.'. + Sets the color for numbers. + Sets the color for symbols. diff --git a/doc/classes/EditorSyntaxHighlighter.xml b/doc/classes/EditorSyntaxHighlighter.xml index 103d95e1d6..b80e81928f 100644 --- a/doc/classes/EditorSyntaxHighlighter.xml +++ b/doc/classes/EditorSyntaxHighlighter.xml @@ -1,8 +1,11 @@ + Base Syntax highlighter resource for the [ScriptEditor]. + Base syntax highlighter resource all editor syntax highlighters extend from, it is used in the [ScriptEditor]. + Add a syntax highlighter to an individual script by calling [method ScriptEditorBase.add_syntax_highlighter]. To apply to all scripts on open, call [method ScriptEditor.register_syntax_highlighter] @@ -11,18 +14,21 @@ + Virtual method which can be overridden to return the syntax highlighter name. + Virtual method which can be overridden to return the supported file extensions. + Virtual method which can be overridden to return the supported language names. diff --git a/doc/classes/ScriptEditor.xml b/doc/classes/ScriptEditor.xml index d5a32dd20c..28620bd29b 100644 --- a/doc/classes/ScriptEditor.xml +++ b/doc/classes/ScriptEditor.xml @@ -37,6 +37,7 @@ + Returns the [ScriptEditorBase] object that the user is currently editing. @@ -60,6 +61,7 @@ + Returns an array with all [ScriptEditorBase] objects which are currently open in editor. @@ -95,6 +97,8 @@ + Registers the [EditorSyntaxHighlighter] to the editor, the [EditorSyntaxHighlighter] will be available on all open scripts. + [b]Note:[/b] Does not apply to scripts that are already opened. @@ -103,6 +107,8 @@ + Unregisters the [EditorSyntaxHighlighter] from the editor. + [b]Note:[/b] The [EditorSyntaxHighlighter] will still be applied to scripts that are already opened. diff --git a/doc/classes/ScriptEditorBase.xml b/doc/classes/ScriptEditorBase.xml index 9968ae06c3..ee498de302 100644 --- a/doc/classes/ScriptEditorBase.xml +++ b/doc/classes/ScriptEditorBase.xml @@ -1,8 +1,10 @@ + Base editor for editing scripts in the [ScriptEditor]. + Base editor for editing scripts in the [ScriptEditor], this does not include documentation items. @@ -13,34 +15,40 @@ + Adds a [EditorSyntaxHighlighter] to the open script. + Emitted after script validation. For visual scripts on modification. + Emitted when the user requests a specific documentation page. + Emitted after script validation or when the edited resource has changed. Not used by visual scripts. + Emitted when the user request to find and replace text in the file system. Not used by visual scripts. + Emitted when the user requests contextual help. @@ -49,16 +57,19 @@ + Emitted when the user requests a script. + Emitted when the user contextual goto and the item is in the same script. + Emitted when the user request to search text in the file system. Not used by visual scripts. diff --git a/doc/classes/SyntaxHighlighter.xml b/doc/classes/SyntaxHighlighter.xml index 2d6e3de02a..ac682554ce 100644 --- a/doc/classes/SyntaxHighlighter.xml +++ b/doc/classes/SyntaxHighlighter.xml @@ -1,30 +1,46 @@ + Base Syntax highlighter resource for [TextEdit]. + Base syntax highlighter resource all syntax highlighters extend from, provides syntax highlighting data to [TextEdit]. + The associated [TextEdit] node will call into the [SyntaxHighlighter] on a as needed basis. + [b]Note:[/b] Each Syntax highlighter instance should not be shared across multiple [TextEdit] nodes. + + + + + Virtual method which can be overridden to clear any local caches. + + + Virtual method which can be overridden to return syntax highlighting data. + See [method get_line_syntax_highlighting] for more details. + Virtual method which can be overridden to update any local caches. + Clears all cached syntax highlighting data. + Then calls overridable method [method _clear_highlighting_cache]. @@ -33,18 +49,35 @@ + Returns syntax highlighting data for a single line. If the line is not cached, calls [method _get_line_syntax_highlighting] to calculate the data. + The return [Dictionary] is column number to [Dictionary]. The column number notes the start of a region, the region will end if another region is found, or at the end of the line. The nested [Dictionary] contains the data for that region, currently only the key "color" is supported. + [b]Example return:[/b] + [codeblock] + var color_map = { + 0: { + "color": Color(1, 0, 0) + }, + 5: { + "color": Color(0, 1, 0) + } + } + [/codeblock] + This will color columns 0-4 red, and columns 5-eol in green. + Returns the associated [TextEdit] node. + Clears then updates the [SyntaxHighlighter] caches. Override [method _update_cache] for a callback. + [b]Note:[/b] This is called automatically when the associated [TextEdit] node, updates its own cache. diff --git a/doc/classes/TextEdit.xml b/doc/classes/TextEdit.xml index a23a4936f8..a72d7cab65 100644 --- a/doc/classes/TextEdit.xml +++ b/doc/classes/TextEdit.xml @@ -652,6 +652,7 @@ If [code]true[/code], sets the [code]step[/code] of the scrollbars to [code]0.25[/code] which results in smoother scrolling. + Sets the [SyntaxHighlighter] to use. String value of the [TextEdit]. @@ -765,7 +766,7 @@ - Sets the background [Color] of this [TextEdit]. [member syntax_highlighting] has to be enabled. + Sets the background [Color] of this [TextEdit]. -- cgit v1.2.3