diff options
Diffstat (limited to 'modules')
6 files changed, 109 insertions, 5 deletions
diff --git a/modules/gdscript/editor/script_templates/RichTextEffect/default.gd b/modules/gdscript/editor/script_templates/RichTextEffect/default.gd new file mode 100644 index 0000000000..c79eeb91ec --- /dev/null +++ b/modules/gdscript/editor/script_templates/RichTextEffect/default.gd @@ -0,0 +1,17 @@ +# meta-description: Base template for rich text effects + +@tool +class_name _CLASS_ +extends _BASE_ + + +# To use this effect: +# - Enable BBCode on a RichTextLabel. +# - Register this effect on the label. +# - Use [_CLASS_ param=2.0]hello[/_CLASS_] in text. +var bbcode := "_CLASS_" + + +func _process_custom_fx(char_fx: CharFXTransform) -> bool: + var param: float = char_fx.env.get("param", 1.0) + return true diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index 6c03d56f4a..ccdc42f71c 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -73,9 +73,11 @@ Ref<Script> GDScriptLanguage::make_template(const String &p_template, const Stri .replace(": String", "") .replace(": Array[String]", "") .replace(": float", "") + .replace(": CharFXTransform", "") .replace(":=", "=") .replace(" -> String", "") .replace(" -> int", "") + .replace(" -> bool", "") .replace(" -> void", ""); } diff --git a/modules/gdscript/language_server/gdscript_extend_parser.cpp b/modules/gdscript/language_server/gdscript_extend_parser.cpp index 2ed444c7ad..07f9465516 100644 --- a/modules/gdscript/language_server/gdscript_extend_parser.cpp +++ b/modules/gdscript/language_server/gdscript_extend_parser.cpp @@ -337,7 +337,7 @@ void ExtendGDScriptParser::parse_function_symbol(const GDScriptParser::FunctionN symbol.kind = lsp::SymbolKind::Variable; symbol.name = parameter->identifier->name; symbol.range.start.line = LINE_NUMBER_TO_INDEX(parameter->start_line); - symbol.range.start.character = LINE_NUMBER_TO_INDEX(parameter->start_line); + symbol.range.start.character = LINE_NUMBER_TO_INDEX(parameter->start_column); symbol.range.end.line = LINE_NUMBER_TO_INDEX(parameter->end_line); symbol.range.end.character = LINE_NUMBER_TO_INDEX(parameter->end_column); symbol.uri = uri; diff --git a/modules/mono/editor/GodotTools/GodotTools/ExternalEditorId.cs b/modules/mono/editor/GodotTools/GodotTools/ExternalEditorId.cs index 90d6eb960e..049cc58512 100644 --- a/modules/mono/editor/GodotTools/GodotTools/ExternalEditorId.cs +++ b/modules/mono/editor/GodotTools/GodotTools/ExternalEditorId.cs @@ -7,6 +7,7 @@ namespace GodotTools VisualStudioForMac, // Mac-only MonoDevelop, VsCode, - Rider + Rider, + CustomEditor } } diff --git a/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs b/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs index 9eefa3c386..26239a7ce5 100644 --- a/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs +++ b/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs @@ -25,6 +25,8 @@ namespace GodotTools public static class Settings { public const string ExternalEditor = "dotnet/editor/external_editor"; + public const string CustomExecPath = "dotnet/editor/custom_exec_path"; + public const string CustomExecPathArgs = "dotnet/editor/custom_exec_path_args"; public const string VerbosityLevel = "dotnet/build/verbosity_level"; public const string NoConsoleLogging = "dotnet/build/no_console_logging"; public const string CreateBinaryLog = "dotnet/build/create_binary_log"; @@ -185,6 +187,66 @@ namespace GodotTools case ExternalEditorId.None: // Not an error. Tells the caller to fallback to the global external editor settings or the built-in editor. return Error.Unavailable; + case ExternalEditorId.CustomEditor: + { + string file = ProjectSettings.GlobalizePath(script.ResourcePath); + var execCommand = _editorSettings.GetSetting(Settings.CustomExecPath).As<string>(); + var execArgs = _editorSettings.GetSetting(Settings.CustomExecPathArgs).As<string>(); + var args = new List<string>(); + var from = 0; + var numChars = 0; + var insideQuotes = false; + var hasFileFlag = false; + + execArgs = execArgs.ReplaceN("{line}", line.ToString()); + execArgs = execArgs.ReplaceN("{col}", col.ToString()); + execArgs = execArgs.StripEdges(true, true); + execArgs = execArgs.Replace("\\\\", "\\"); + + for (int i = 0; i < execArgs.Length; ++i) + { + if ((execArgs[i] == '"' && (i == 0 || execArgs[i - 1] != '\\')) && i != execArgs.Length - 1) + { + if (!insideQuotes) + { + from++; + } + insideQuotes = !insideQuotes; + } + else if ((execArgs[i] == ' ' && !insideQuotes) || i == execArgs.Length - 1) + { + if (i == execArgs.Length - 1 && !insideQuotes) + { + numChars++; + } + + var arg = execArgs.Substr(from, numChars); + if (arg.Contains("{file}")) + { + hasFileFlag = true; + } + + arg = arg.ReplaceN("{file}", file); + args.Add(arg); + + from = i + 1; + numChars = 0; + } + else + { + numChars++; + } + } + + if (!hasFileFlag) + { + args.Add(file); + } + + OS.RunProcess(execCommand, args); + + break; + } case ExternalEditorId.VisualStudio: { string scriptPath = ProjectSettings.GlobalizePath(script.ResourcePath); @@ -463,6 +525,8 @@ namespace GodotTools // External editor settings EditorDef(Settings.ExternalEditor, Variant.From(ExternalEditorId.None)); + EditorDef(Settings.CustomExecPath, ""); + EditorDef(Settings.CustomExecPathArgs, ""); EditorDef(Settings.VerbosityLevel, Variant.From(VerbosityLevelId.Normal)); EditorDef(Settings.NoConsoleLogging, false); EditorDef(Settings.CreateBinaryLog, false); @@ -474,20 +538,23 @@ namespace GodotTools settingsHintStr += $",Visual Studio:{(int)ExternalEditorId.VisualStudio}" + $",MonoDevelop:{(int)ExternalEditorId.MonoDevelop}" + $",Visual Studio Code:{(int)ExternalEditorId.VsCode}" + - $",JetBrains Rider:{(int)ExternalEditorId.Rider}"; + $",JetBrains Rider:{(int)ExternalEditorId.Rider}" + + $",Custom:{(int)ExternalEditorId.CustomEditor}"; } else if (OS.IsMacOS) { settingsHintStr += $",Visual Studio:{(int)ExternalEditorId.VisualStudioForMac}" + $",MonoDevelop:{(int)ExternalEditorId.MonoDevelop}" + $",Visual Studio Code:{(int)ExternalEditorId.VsCode}" + - $",JetBrains Rider:{(int)ExternalEditorId.Rider}"; + $",JetBrains Rider:{(int)ExternalEditorId.Rider}" + + $",Custom:{(int)ExternalEditorId.CustomEditor}"; } else if (OS.IsUnixLike) { settingsHintStr += $",MonoDevelop:{(int)ExternalEditorId.MonoDevelop}" + $",Visual Studio Code:{(int)ExternalEditorId.VsCode}" + - $",JetBrains Rider:{(int)ExternalEditorId.Rider}"; + $",JetBrains Rider:{(int)ExternalEditorId.Rider}" + + $",Custom:{(int)ExternalEditorId.CustomEditor}"; } _editorSettings.AddPropertyInfo(new Godot.Collections.Dictionary @@ -498,6 +565,20 @@ namespace GodotTools ["hint_string"] = settingsHintStr }); + _editorSettings.AddPropertyInfo(new Godot.Collections.Dictionary + { + ["type"] = (int)Variant.Type.String, + ["name"] = Settings.CustomExecPath, + ["hint"] = (int)PropertyHint.GlobalFile, + }); + + _editorSettings.AddPropertyInfo(new Godot.Collections.Dictionary + { + ["type"] = (int)Variant.Type.String, + ["name"] = Settings.CustomExecPathArgs, + }); + _editorSettings.SetInitialValue(Settings.CustomExecPathArgs, "{file}", false); + var verbosityLevels = Enum.GetValues<VerbosityLevelId>().Select(level => $"{Enum.GetName(level)}:{(int)level}"); _editorSettings.AddPropertyInfo(new Godot.Collections.Dictionary { diff --git a/modules/mono/editor/GodotTools/GodotTools/Ides/GodotIdeManager.cs b/modules/mono/editor/GodotTools/GodotTools/Ides/GodotIdeManager.cs index 83621ce5af..5d1a2277f9 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Ides/GodotIdeManager.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Ides/GodotIdeManager.cs @@ -70,6 +70,8 @@ namespace GodotTools.Ides return "VisualStudioForMac"; case ExternalEditorId.MonoDevelop: return "MonoDevelop"; + case ExternalEditorId.CustomEditor: + return "CustomEditor"; default: throw new NotImplementedException(); } @@ -105,6 +107,7 @@ namespace GodotTools.Ides case ExternalEditorId.VisualStudio: case ExternalEditorId.VsCode: case ExternalEditorId.Rider: + case ExternalEditorId.CustomEditor: throw new NotSupportedException(); case ExternalEditorId.VisualStudioForMac: goto case ExternalEditorId.MonoDevelop; |
