BBCodeEdit (for script editor1)
A Godot addon that brings BBCode completion and QOL tools to the script editor in order to help format documentation comments. (May be extended to any CodeEdit in the future.1)
Showcase
There are shortcuts to easily toggle some formattings:
Completion for formatting tags, with some special completions implemented for specific tags:
Documentation references are completed:
Some useful snippets are included:
Features / Roadmap
Checked items are the implemented ones, unchecked are the ones in development.1
- Code completion for:
- Most used BBCode tags
- All BBCode tags1 (See Godot Reference)
- Documentation comments:
- formatting tags
- referencing tag
-
@
tags:- deprecated
- experimental
- tutorial
- Snippets:
- Note:, Warning:...
- Classify tags accepted in documentation comments according to Godot Reference
- Advanced completions:
- Color:
- Named colors
- Hexadecimal color preview (**Note: ** If it starts with a digit,
0x
will be prefixed temporarily because Godot cancels int completion) - Color picker
- URL of files? (I don't know if file URLs work)
- Documentation comments' references: (NB: Inner classes won't be properly proposed in completions)
- Classes
- Parameters
- Members (aka. Properties)
- Methods (aka. Functions)
- Constants
- Signals
- Enums
- Other references, like annotations or operators, are not implemented because they are rarely used.
- Color:
-
BBCode preview (through SyntaxHighlighter?)
Edit: Won't work because GDSCriptSyntaxHighlighter can't be extended
BBCode spellcheck/semi-preview (through_draw()
?)
Edit 2: Won't implement, because there is easier: - Add a shortcut to open:
- Current file documentation (May have a problem if pressed before the editor checks unsaved status of the file)
- Preview of the selected text (or autodetect start and end if no selection)
- Add shortcuts for:
You can rebind them inProject → Project settings → Input Map
. If you just enabled the addon, they may appear here only after a restart of the editor. You will have to restart the editor for any change to take effect.- bold (
alt + B
) - italic (
alt + I
) -
striketrough(alt + C
, but if you had unboundalt + S
fromopen shader editor
, it will bealt + S
) - underline (
alt + U
) - Wrap in any tag?
- bold (
- Add an external CodeEdit in the editor to write bbcode, because completion inside strings is a nightmare due to builtin behaviors.1
Installation
You can download the addon:
- On GitHub:
Code
→Download ZIP
. - Through the editor:
AssetLib
→ Search for "BBCodeEdit"
By default, this readme is included, along with it's illustrations. If you don't want them,
do not download addons/bbcode_edit.editor/README.md
nor addons/bbcode_edit.editor/.assets_for_readme/*
You can also remove addons/bbcode_edit.editor/completions_cd/builtin_classes_[godot versions that you don't use].txt
To edit shortcuts:
- If they don't show up in the input map GUI: first restart the editor
- modify them in the input map GUI
- restart the editor to update the input map.
You can also exclude *.editor/*
or bbcode_edit.editor/
from your export presets,
because this addon is (for now1) script-editor-only.
Godot version
Minimal version: Godot 4.3
abondonned 4.2 port branch (The addon use a method that did not exist in the TextEditor class. I dont really want to bother finding a workaround unless someone want to use the addon in this older version of Godot)
Development Status
LTS, no major updates. But the addon is really handy as-is.
Footnotes
-
Note: All non-script-editor-related features are on hold for now because I don't have the time nor the need to implement them. This would also require refactoring
bbcode_edit.gd
into two separate classes. One with all RichTextLabel's tags and one with documentation comments' tags. If you really need BBCode completion in a CodeEdit (eg. for an inspector plugin, or for any code edit within an exported project), I may give it a try, or you could contribute this refactor (this repo is under the MIT Licence). ↩ ↩2 ↩3 ↩4 ↩5 ↩6