From 90019676b076abdfc076ed6f38005d6cce89923b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Sat, 23 Jul 2022 23:41:51 +0200 Subject: Code quality: Fix header guards consistency Adds `header_guards.sh` bash script, used in CI to validate future changes. Can be run locally to fix invalid header guards. --- modules/camera/camera_macos.h | 2 +- modules/camera/camera_win.h | 6 +- modules/enet/enet_multiplayer_peer.h | 6 +- modules/freetype/uwpdef.h | 5 + modules/gdscript/gdscript_byte_codegen.h | 6 +- modules/gdscript/gdscript_codegen.h | 6 +- modules/gdscript/gdscript_lambda_callable.h | 6 +- modules/gdscript/gdscript_rpc_callable.h | 6 +- modules/gdscript/gdscript_tokenizer.h | 2 +- modules/gdscript/gdscript_warning.h | 6 +- .../language_server/gdscript_extend_parser.h | 4 +- .../language_server/gdscript_language_protocol.h | 2 +- .../language_server/gdscript_text_document.h | 4 +- .../gdscript/language_server/gdscript_workspace.h | 4 +- modules/gdscript/language_server/godot_lsp.h | 1978 ++++++++++++++++++++ modules/gdscript/language_server/lsp.hpp | 1978 -------------------- modules/gdscript/tests/gdscript_test_runner.h | 6 +- modules/gltf/extensions/gltf_spec_gloss.h | 1 + ...gltf_document_extension_convert_importer_mesh.h | 7 +- modules/gltf/gltf_state.h | 1 + modules/gltf/structures/gltf_accessor.h | 1 + modules/gltf/structures/gltf_animation.h | 1 + modules/gltf/structures/gltf_buffer_view.h | 1 + modules/gltf/structures/gltf_camera.h | 1 + modules/gltf/structures/gltf_node.h | 1 + modules/gltf/structures/gltf_skeleton.h | 1 + modules/gltf/structures/gltf_skin.h | 1 + modules/hdr/image_loader_hdr.h | 2 +- modules/jpg/image_loader_jpegd.h | 6 +- modules/jsonrpc/jsonrpc.h | 6 +- modules/lightmapper_rd/lightmapper_rd.h | 2 +- modules/lightmapper_rd/register_types.h | 2 +- modules/mbedtls/dtls_server_mbedtls.h | 6 +- modules/mbedtls/ssl_context_mbedtls.h | 6 +- modules/mbedtls/stream_peer_mbedtls.h | 6 +- modules/meshoptimizer/register_types.h | 2 +- modules/mono/editor/editor_internal_calls.h | 6 +- modules/mono/glue/glue_header.h | 5 + modules/mono/mono_gc_handle.h | 6 +- modules/mono/mono_gd/gd_mono_field.h | 6 +- modules/mono/mono_gd/gd_mono_marshal.h | 6 +- modules/mono/mono_gd/gd_mono_utils.h | 6 +- modules/mono/utils/macos_utils.h | 6 +- modules/mono/utils/macros.h | 6 +- modules/mono/utils/path_utils.h | 6 +- modules/mono/utils/string_utils.h | 6 +- modules/openxr/action_map/openxr_action.h | 2 +- modules/openxr/action_map/openxr_action_map.h | 6 +- modules/openxr/action_map/openxr_action_set.h | 2 +- modules/openxr/action_map/openxr_defs.h | 2 +- .../openxr/action_map/openxr_interaction_profile.h | 2 +- modules/openxr/editor/openxr_action_editor.h | 2 +- modules/openxr/editor/openxr_action_map_editor.h | 2 +- modules/openxr/editor/openxr_action_set_editor.h | 2 +- modules/openxr/editor/openxr_editor_plugin.h | 2 +- .../editor/openxr_interaction_profile_editor.h | 2 +- .../openxr/editor/openxr_select_action_dialog.h | 2 +- .../openxr_select_interaction_profile_dialog.h | 2 +- .../openxr/extensions/openxr_android_extension.h | 2 +- .../openxr/extensions/openxr_extension_wrapper.h | 2 +- .../extensions/openxr_htc_vive_tracker_extension.h | 2 +- .../openxr/extensions/openxr_vulkan_extension.h | 2 +- modules/openxr/openxr_api.h | 6 +- modules/openxr/openxr_interface.h | 2 +- modules/openxr/openxr_util.h | 2 +- modules/raycast/lightmap_raycaster.h | 2 +- modules/raycast/raycast_occlusion_cull.h | 6 +- modules/raycast/static_raycaster.h | 2 +- modules/text_server_adv/script_iterator.h | 2 +- modules/text_server_fb/text_server_fb.h | 6 +- modules/theora/video_stream_theora.h | 2 +- modules/tinyexr/image_loader_tinyexr.h | 2 +- modules/upnp/upnp.h | 6 +- modules/upnp/upnp_device.h | 6 +- .../visual_script/editor/visual_script_editor.h | 6 +- .../editor/visual_script_property_selector.h | 6 +- modules/visual_script/visual_script_expression.h | 6 +- modules/vorbis/audio_stream_ogg_vorbis.h | 6 +- modules/webp/image_loader_webp.h | 2 +- modules/webrtc/webrtc_data_channel.h | 1 + modules/webrtc/webrtc_multiplayer_peer.h | 6 +- modules/webrtc/webrtc_peer_connection.h | 1 + modules/websocket/emws_client.h | 6 +- modules/websocket/emws_peer.h | 6 +- modules/websocket/emws_server.h | 6 +- modules/websocket/websocket_peer.h | 7 +- modules/websocket/websocket_server.h | 6 +- modules/websocket/wsl_client.h | 6 +- modules/websocket/wsl_peer.h | 6 +- modules/websocket/wsl_server.h | 6 +- modules/webxr/godot_webxr.h | 2 +- 91 files changed, 2164 insertions(+), 2141 deletions(-) create mode 100644 modules/gdscript/language_server/godot_lsp.h delete mode 100644 modules/gdscript/language_server/lsp.hpp (limited to 'modules') diff --git a/modules/camera/camera_macos.h b/modules/camera/camera_macos.h index badf78f0e8..903eda51bf 100644 --- a/modules/camera/camera_macos.h +++ b/modules/camera/camera_macos.h @@ -43,4 +43,4 @@ public: void update_feeds(); }; -#endif /* CAMERA_MACOS_H */ +#endif // CAMERA_MACOS_H diff --git a/modules/camera/camera_win.h b/modules/camera/camera_win.h index 9563326acb..ebfc117190 100644 --- a/modules/camera/camera_win.h +++ b/modules/camera/camera_win.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef CAMERAWIN_H -#define CAMERAWIN_H +#ifndef CAMERA_WIN_H +#define CAMERA_WIN_H #include "servers/camera/camera_feed.h" #include "servers/camera_server.h" @@ -43,4 +43,4 @@ public: ~CameraWindows() {} }; -#endif /* CAMERAWIN_H */ +#endif // CAMERA_WIN_H diff --git a/modules/enet/enet_multiplayer_peer.h b/modules/enet/enet_multiplayer_peer.h index 18eca18e51..131aa04df1 100644 --- a/modules/enet/enet_multiplayer_peer.h +++ b/modules/enet/enet_multiplayer_peer.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef NETWORKED_MULTIPLAYER_ENET_H -#define NETWORKED_MULTIPLAYER_ENET_H +#ifndef ENET_MULTIPLAYER_PEER_H +#define ENET_MULTIPLAYER_PEER_H #include "core/crypto/crypto.h" #include "core/multiplayer/multiplayer_peer.h" @@ -135,4 +135,4 @@ public: ~ENetMultiplayerPeer(); }; -#endif // NETWORKED_MULTIPLAYER_ENET_H +#endif // ENET_MULTIPLAYER_PEER_H diff --git a/modules/freetype/uwpdef.h b/modules/freetype/uwpdef.h index 05aaae61b5..f85f293171 100644 --- a/modules/freetype/uwpdef.h +++ b/modules/freetype/uwpdef.h @@ -28,6 +28,11 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ +#ifndef UWPDEF_H +#define UWPDEF_H + // "generic" is a reserved keyword in C++/CX code // this avoids the errors in the variable name from Freetype code #define generic freetype_generic + +#endif // UWPDEF_H diff --git a/modules/gdscript/gdscript_byte_codegen.h b/modules/gdscript/gdscript_byte_codegen.h index f4b402fc96..ffc3178c83 100644 --- a/modules/gdscript/gdscript_byte_codegen.h +++ b/modules/gdscript/gdscript_byte_codegen.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef GDSCRIPT_BYTE_CODEGEN -#define GDSCRIPT_BYTE_CODEGEN +#ifndef GDSCRIPT_BYTE_CODEGEN_H +#define GDSCRIPT_BYTE_CODEGEN_H #include "gdscript_codegen.h" @@ -502,4 +502,4 @@ public: virtual ~GDScriptByteCodeGenerator(); }; -#endif // GDSCRIPT_BYTE_CODEGEN +#endif // GDSCRIPT_BYTE_CODEGEN_H diff --git a/modules/gdscript/gdscript_codegen.h b/modules/gdscript/gdscript_codegen.h index 81fa265aca..7b5f133ec5 100644 --- a/modules/gdscript/gdscript_codegen.h +++ b/modules/gdscript/gdscript_codegen.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef GDSCRIPT_CODEGEN -#define GDSCRIPT_CODEGEN +#ifndef GDSCRIPT_CODEGEN_H +#define GDSCRIPT_CODEGEN_H #include "core/multiplayer/multiplayer.h" #include "core/string/string_name.h" @@ -163,4 +163,4 @@ public: virtual ~GDScriptCodeGenerator() {} }; -#endif // GDSCRIPT_CODEGEN +#endif // GDSCRIPT_CODEGEN_H diff --git a/modules/gdscript/gdscript_lambda_callable.h b/modules/gdscript/gdscript_lambda_callable.h index 248176e32c..1954089983 100644 --- a/modules/gdscript/gdscript_lambda_callable.h +++ b/modules/gdscript/gdscript_lambda_callable.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef GDSCRIPT_LAMBDA_CALLABLE -#define GDSCRIPT_LAMBDA_CALLABLE +#ifndef GDSCRIPT_LAMBDA_CALLABLE_H +#define GDSCRIPT_LAMBDA_CALLABLE_H #include "core/object/ref_counted.h" #include "core/templates/vector.h" @@ -87,4 +87,4 @@ public: virtual ~GDScriptLambdaSelfCallable() = default; }; -#endif // GDSCRIPT_LAMBDA_CALLABLE +#endif // GDSCRIPT_LAMBDA_CALLABLE_H diff --git a/modules/gdscript/gdscript_rpc_callable.h b/modules/gdscript/gdscript_rpc_callable.h index 2c8734a74b..c8a91d6259 100644 --- a/modules/gdscript/gdscript_rpc_callable.h +++ b/modules/gdscript/gdscript_rpc_callable.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef GDSCRIPT_RPC_CALLABLE -#define GDSCRIPT_RPC_CALLABLE +#ifndef GDSCRIPT_RPC_CALLABLE_H +#define GDSCRIPT_RPC_CALLABLE_H #include "core/variant/callable.h" #include "core/variant/variant.h" @@ -58,4 +58,4 @@ public: virtual ~GDScriptRPCCallable() = default; }; -#endif // GDSCRIPT_RPC_CALLABLE +#endif // GDSCRIPT_RPC_CALLABLE_H diff --git a/modules/gdscript/gdscript_tokenizer.h b/modules/gdscript/gdscript_tokenizer.h index 7fb715f2c8..68b2c6eb1c 100644 --- a/modules/gdscript/gdscript_tokenizer.h +++ b/modules/gdscript/gdscript_tokenizer.h @@ -273,4 +273,4 @@ public: GDScriptTokenizer(); }; -#endif +#endif // GDSCRIPT_TOKENIZER_H diff --git a/modules/gdscript/gdscript_warning.h b/modules/gdscript/gdscript_warning.h index f47f31aedf..a639e7b44e 100644 --- a/modules/gdscript/gdscript_warning.h +++ b/modules/gdscript/gdscript_warning.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef GDSCRIPT_WARNINGS -#define GDSCRIPT_WARNINGS +#ifndef GDSCRIPT_WARNING_H +#define GDSCRIPT_WARNING_H #ifdef DEBUG_ENABLED @@ -97,4 +97,4 @@ public: #endif // DEBUG_ENABLED -#endif // GDSCRIPT_WARNINGS +#endif // GDSCRIPT_WARNING_H diff --git a/modules/gdscript/language_server/gdscript_extend_parser.h b/modules/gdscript/language_server/gdscript_extend_parser.h index 99b0bf45d0..08bba4a2d4 100644 --- a/modules/gdscript/language_server/gdscript_extend_parser.h +++ b/modules/gdscript/language_server/gdscript_extend_parser.h @@ -33,7 +33,7 @@ #include "../gdscript_parser.h" #include "core/variant/variant.h" -#include "lsp.hpp" +#include "godot_lsp.h" #ifndef LINE_NUMBER_TO_INDEX #define LINE_NUMBER_TO_INDEX(p_line) ((p_line)-1) @@ -99,4 +99,4 @@ public: Error parse(const String &p_code, const String &p_path); }; -#endif +#endif // GDSCRIPT_EXTEND_PARSER_H diff --git a/modules/gdscript/language_server/gdscript_language_protocol.h b/modules/gdscript/language_server/gdscript_language_protocol.h index 0fed8597f9..3c9cfe512f 100644 --- a/modules/gdscript/language_server/gdscript_language_protocol.h +++ b/modules/gdscript/language_server/gdscript_language_protocol.h @@ -36,7 +36,7 @@ #include "core/io/tcp_server.h" #include "gdscript_text_document.h" #include "gdscript_workspace.h" -#include "lsp.hpp" +#include "godot_lsp.h" #include "modules/modules_enabled.gen.h" // For jsonrpc. #ifdef MODULE_JSONRPC_ENABLED diff --git a/modules/gdscript/language_server/gdscript_text_document.h b/modules/gdscript/language_server/gdscript_text_document.h index 9732765f34..87bc08a34e 100644 --- a/modules/gdscript/language_server/gdscript_text_document.h +++ b/modules/gdscript/language_server/gdscript_text_document.h @@ -33,7 +33,7 @@ #include "core/io/file_access.h" #include "core/object/ref_counted.h" -#include "lsp.hpp" +#include "godot_lsp.h" class GDScriptTextDocument : public RefCounted { GDCLASS(GDScriptTextDocument, RefCounted) @@ -77,4 +77,4 @@ public: GDScriptTextDocument(); }; -#endif +#endif // GDSCRIPT_TEXT_DOCUMENT_H diff --git a/modules/gdscript/language_server/gdscript_workspace.h b/modules/gdscript/language_server/gdscript_workspace.h index 7bff5db81f..88f3aaf957 100644 --- a/modules/gdscript/language_server/gdscript_workspace.h +++ b/modules/gdscript/language_server/gdscript_workspace.h @@ -35,7 +35,7 @@ #include "core/variant/variant.h" #include "editor/editor_file_system.h" #include "gdscript_extend_parser.h" -#include "lsp.hpp" +#include "godot_lsp.h" class GDScriptWorkspace : public RefCounted { GDCLASS(GDScriptWorkspace, RefCounted); @@ -100,4 +100,4 @@ public: ~GDScriptWorkspace(); }; -#endif +#endif // GDSCRIPT_WORKSPACE_H diff --git a/modules/gdscript/language_server/godot_lsp.h b/modules/gdscript/language_server/godot_lsp.h new file mode 100644 index 0000000000..fbd40796c4 --- /dev/null +++ b/modules/gdscript/language_server/godot_lsp.h @@ -0,0 +1,1978 @@ +/*************************************************************************/ +/* godot_lsp.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#ifndef GODOT_LSP_H +#define GODOT_LSP_H + +#include "core/doc_data.h" +#include "core/object/class_db.h" +#include "core/templates/list.h" + +namespace lsp { + +typedef String DocumentUri; + +/** Format BBCode documentation from DocData to markdown */ +static String marked_documentation(const String &p_bbcode); + +/** + * Text documents are identified using a URI. On the protocol level, URIs are passed as strings. + */ +struct TextDocumentIdentifier { + /** + * The text document's URI. + */ + DocumentUri uri; + + _FORCE_INLINE_ void load(const Dictionary &p_params) { + uri = p_params["uri"]; + } + + _FORCE_INLINE_ Dictionary to_json() const { + Dictionary dict; + dict["uri"] = uri; + return dict; + } +}; + +/** + * Position in a text document expressed as zero-based line and zero-based character offset. + * A position is between two characters like an ‘insert’ cursor in a editor. + * Special values like for example -1 to denote the end of a line are not supported. + */ +struct Position { + /** + * Line position in a document (zero-based). + */ + int line = 0; + + /** + * Character offset on a line in a document (zero-based). Assuming that the line is + * represented as a string, the `character` value represents the gap between the + * `character` and `character + 1`. + * + * If the character value is greater than the line length it defaults back to the + * line length. + */ + int character = 0; + + _FORCE_INLINE_ void load(const Dictionary &p_params) { + line = p_params["line"]; + character = p_params["character"]; + } + + _FORCE_INLINE_ Dictionary to_json() const { + Dictionary dict; + dict["line"] = line; + dict["character"] = character; + return dict; + } +}; + +/** + * A range in a text document expressed as (zero-based) start and end positions. + * A range is comparable to a selection in an editor. Therefore the end position is exclusive. + * If you want to specify a range that contains a line including the line ending character(s) then use an end position denoting the start of the next line. + */ +struct Range { + /** + * The range's start position. + */ + Position start; + + /** + * The range's end position. + */ + Position end; + + _FORCE_INLINE_ void load(const Dictionary &p_params) { + start.load(p_params["start"]); + end.load(p_params["end"]); + } + + _FORCE_INLINE_ Dictionary to_json() const { + Dictionary dict; + dict["start"] = start.to_json(); + dict["end"] = end.to_json(); + return dict; + } +}; + +/** + * Represents a location inside a resource, such as a line inside a text file. + */ +struct Location { + DocumentUri uri; + Range range; + + _FORCE_INLINE_ void load(const Dictionary &p_params) { + uri = p_params["uri"]; + range.load(p_params["range"]); + } + + _FORCE_INLINE_ Dictionary to_json() const { + Dictionary dict; + dict["uri"] = uri; + dict["range"] = range.to_json(); + return dict; + } +}; + +/** + * Represents a link between a source and a target location. + */ +struct LocationLink { + /** + * Span of the origin of this link. + * + * Used as the underlined span for mouse interaction. Defaults to the word range at + * the mouse position. + */ + Range *originSelectionRange = nullptr; + + /** + * The target resource identifier of this link. + */ + String targetUri; + + /** + * The full target range of this link. If the target for example is a symbol then target range is the + * range enclosing this symbol not including leading/trailing whitespace but everything else + * like comments. This information is typically used to highlight the range in the editor. + */ + Range targetRange; + + /** + * The range that should be selected and revealed when this link is being followed, e.g the name of a function. + * Must be contained by the the `targetRange`. See also `DocumentSymbol#range` + */ + Range targetSelectionRange; +}; + +/** + * A parameter literal used in requests to pass a text document and a position inside that document. + */ +struct TextDocumentPositionParams { + /** + * The text document. + */ + TextDocumentIdentifier textDocument; + + /** + * The position inside the text document. + */ + Position position; + + _FORCE_INLINE_ void load(const Dictionary &p_params) { + textDocument.load(p_params["textDocument"]); + position.load(p_params["position"]); + } + + _FORCE_INLINE_ Dictionary to_json() const { + Dictionary dict; + dict["textDocument"] = textDocument.to_json(); + dict["position"] = position.to_json(); + return dict; + } +}; + +struct DocumentLinkParams { + /** + * The document to provide document links for. + */ + TextDocumentIdentifier textDocument; + + _FORCE_INLINE_ void load(const Dictionary &p_params) { + textDocument.load(p_params["textDocument"]); + } +}; + +/** + * A document link is a range in a text document that links to an internal or external resource, like another + * text document or a web site. + */ +struct DocumentLink { + /** + * The range this link applies to. + */ + Range range; + + /** + * The uri this link points to. If missing a resolve request is sent later. + */ + DocumentUri target; + + Dictionary to_json() const { + Dictionary dict; + dict["range"] = range.to_json(); + dict["target"] = target; + return dict; + } +}; + +/** + * A textual edit applicable to a text document. + */ +struct TextEdit { + /** + * The range of the text document to be manipulated. To insert + * text into a document create a range where start === end. + */ + Range range; + + /** + * The string to be inserted. For delete operations use an + * empty string. + */ + String newText; +}; + +/** + * The edits to be applied. + */ +struct WorkspaceEdit { + /** + * Holds changes to existing resources. + */ + HashMap> changes; + + _FORCE_INLINE_ void add_edit(const String &uri, const TextEdit &edit) { + if (changes.has(uri)) { + changes[uri].push_back(edit); + } else { + Vector edits; + edits.push_back(edit); + changes[uri] = edits; + } + } + + _FORCE_INLINE_ Dictionary to_json() const { + Dictionary dict; + + Dictionary out_changes; + for (const KeyValue> &E : changes) { + Array edits; + for (int i = 0; i < E.value.size(); ++i) { + Dictionary text_edit; + text_edit["range"] = E.value[i].range.to_json(); + text_edit["newText"] = E.value[i].newText; + edits.push_back(text_edit); + } + out_changes[E.key] = edits; + } + dict["changes"] = out_changes; + + return dict; + } + + _FORCE_INLINE_ void add_change(const String &uri, const int &line, const int &start_character, const int &end_character, const String &new_text) { + if (HashMap>::Iterator E = changes.find(uri)) { + Vector edit_list = E->value; + for (int i = 0; i < edit_list.size(); ++i) { + TextEdit edit = edit_list[i]; + if (edit.range.start.character == start_character) { + return; + } + } + } + + TextEdit new_edit; + new_edit.newText = new_text; + new_edit.range.start.line = line; + new_edit.range.start.character = start_character; + new_edit.range.end.line = line; + new_edit.range.end.character = end_character; + + if (HashMap>::Iterator E = changes.find(uri)) { + E->value.push_back(new_edit); + } else { + Vector edit_list; + edit_list.push_back(new_edit); + changes.insert(uri, edit_list); + } + } +}; + +/** + * Represents a reference to a command. + * Provides a title which will be used to represent a command in the UI. + * Commands are identified by a string identifier. + * The recommended way to handle commands is to implement their execution on the server side if the client and server provides the corresponding capabilities. + * Alternatively the tool extension code could handle the command. The protocol currently doesn’t specify a set of well-known commands. + */ +struct Command { + /** + * Title of the command, like `save`. + */ + String title; + /** + * The identifier of the actual command handler. + */ + String command; + /** + * Arguments that the command handler should be + * invoked with. + */ + Array arguments; + + Dictionary to_json() const { + Dictionary dict; + dict["title"] = title; + dict["command"] = command; + if (arguments.size()) { + dict["arguments"] = arguments; + } + return dict; + } +}; + +// Use namespace instead of enumeration to follow the LSP specifications +// lsp::EnumName::EnumValue is OK but lsp::EnumValue is not + +namespace TextDocumentSyncKind { +/** + * Documents should not be synced at all. + */ +static const int None = 0; + +/** + * Documents are synced by always sending the full content + * of the document. + */ +static const int Full = 1; + +/** + * Documents are synced by sending the full content on open. + * After that only incremental updates to the document are + * send. + */ +static const int Incremental = 2; +}; // namespace TextDocumentSyncKind + +/** + * Completion options. + */ +struct CompletionOptions { + /** + * The server provides support to resolve additional + * information for a completion item. + */ + bool resolveProvider = true; + + /** + * The characters that trigger completion automatically. + */ + Vector triggerCharacters; + + CompletionOptions() { + triggerCharacters.push_back("."); + triggerCharacters.push_back("$"); + triggerCharacters.push_back("'"); + triggerCharacters.push_back("\""); + } + + Dictionary to_json() const { + Dictionary dict; + dict["resolveProvider"] = resolveProvider; + dict["triggerCharacters"] = triggerCharacters; + return dict; + } +}; + +/** + * Signature help options. + */ +struct SignatureHelpOptions { + /** + * The characters that trigger signature help + * automatically. + */ + Vector triggerCharacters; + + Dictionary to_json() { + Dictionary dict; + dict["triggerCharacters"] = triggerCharacters; + return dict; + } +}; + +/** + * Code Lens options. + */ +struct CodeLensOptions { + /** + * Code lens has a resolve provider as well. + */ + bool resolveProvider = false; + + Dictionary to_json() { + Dictionary dict; + dict["resolveProvider"] = resolveProvider; + return dict; + } +}; + +/** + * Rename options + */ +struct RenameOptions { + /** + * Renames should be checked and tested before being executed. + */ + bool prepareProvider = false; + + Dictionary to_json() { + Dictionary dict; + dict["prepareProvider"] = prepareProvider; + return dict; + } +}; + +/** + * Document link options. + */ +struct DocumentLinkOptions { + /** + * Document links have a resolve provider as well. + */ + bool resolveProvider = false; + + Dictionary to_json() { + Dictionary dict; + dict["resolveProvider"] = resolveProvider; + return dict; + } +}; + +/** + * Execute command options. + */ +struct ExecuteCommandOptions { + /** + * The commands to be executed on the server + */ + Vector commands; + + Dictionary to_json() { + Dictionary dict; + dict["commands"] = commands; + return dict; + } +}; + +/** + * Save options. + */ +struct SaveOptions { + /** + * The client is supposed to include the content on save. + */ + bool includeText = true; + + Dictionary to_json() { + Dictionary dict; + dict["includeText"] = includeText; + return dict; + } +}; + +/** + * Color provider options. + */ +struct ColorProviderOptions { + Dictionary to_json() { + Dictionary dict; + return dict; + } +}; + +/** + * Folding range provider options. + */ +struct FoldingRangeProviderOptions { + Dictionary to_json() { + Dictionary dict; + return dict; + } +}; + +struct TextDocumentSyncOptions { + /** + * Open and close notifications are sent to the server. If omitted open close notification should not + * be sent. + */ + bool openClose = true; + + /** + * Change notifications are sent to the server. See TextDocumentSyncKind.None, TextDocumentSyncKind.Full + * and TextDocumentSyncKind.Incremental. If omitted it defaults to TextDocumentSyncKind.None. + */ + int change = TextDocumentSyncKind::Full; + + /** + * If present will save notifications are sent to the server. If omitted the notification should not be + * sent. + */ + bool willSave = false; + + /** + * If present will save wait until requests are sent to the server. If omitted the request should not be + * sent. + */ + bool willSaveWaitUntil = false; + + /** + * If present save notifications are sent to the server. If omitted the notification should not be + * sent. + */ + SaveOptions save; + + Dictionary to_json() { + Dictionary dict; + dict["willSaveWaitUntil"] = willSaveWaitUntil; + dict["willSave"] = willSave; + dict["openClose"] = openClose; + dict["change"] = change; + dict["save"] = save.to_json(); + return dict; + } +}; + +/** + * Static registration options to be returned in the initialize request. + */ +struct StaticRegistrationOptions { + /** + * The id used to register the request. The id can be used to deregister + * the request again. See also Registration#id. + */ + String id; +}; + +/** + * Format document on type options. + */ +struct DocumentOnTypeFormattingOptions { + /** + * A character on which formatting should be triggered, like `}`. + */ + String firstTriggerCharacter; + + /** + * More trigger characters. + */ + Vector moreTriggerCharacter; + + Dictionary to_json() { + Dictionary dict; + dict["firstTriggerCharacter"] = firstTriggerCharacter; + dict["moreTriggerCharacter"] = moreTriggerCharacter; + return dict; + } +}; + +struct TextDocumentItem { + /** + * The text document's URI. + */ + DocumentUri uri; + + /** + * The text document's language identifier. + */ + String languageId; + + /** + * The version number of this document (it will increase after each + * change, including undo/redo). + */ + int version = 0; + + /** + * The content of the opened text document. + */ + String text; + + void load(const Dictionary &p_dict) { + uri = p_dict["uri"]; + languageId = p_dict["languageId"]; + version = p_dict["version"]; + text = p_dict["text"]; + } + + Dictionary to_json() const { + Dictionary dict; + dict["uri"] = uri; + dict["languageId"] = languageId; + dict["version"] = version; + dict["text"] = text; + return dict; + } +}; + +/** + * An event describing a change to a text document. If range and rangeLength are omitted + * the new text is considered to be the full content of the document. + */ +struct TextDocumentContentChangeEvent { + /** + * The range of the document that changed. + */ + Range range; + + /** + * The length of the range that got replaced. + */ + int rangeLength = 0; + + /** + * The new text of the range/document. + */ + String text; + + void load(const Dictionary &p_params) { + text = p_params["text"]; + rangeLength = p_params["rangeLength"]; + range.load(p_params["range"]); + } +}; + +// Use namespace instead of enumeration to follow the LSP specifications +namespace DiagnosticSeverity { +/** + * Reports an error. + */ +static const int Error = 1; +/** + * Reports a warning. + */ +static const int Warning = 2; +/** + * Reports an information. + */ +static const int Information = 3; +/** + * Reports a hint. + */ +static const int Hint = 4; +}; // namespace DiagnosticSeverity + +/** + * Represents a related message and source code location for a diagnostic. This should be + * used to point to code locations that cause or related to a diagnostics, e.g when duplicating + * a symbol in a scope. + */ +struct DiagnosticRelatedInformation { + /** + * The location of this related diagnostic information. + */ + Location location; + + /** + * The message of this related diagnostic information. + */ + String message; + + Dictionary to_json() const { + Dictionary dict; + dict["location"] = location.to_json(), + dict["message"] = message; + return dict; + } +}; + +/** + * Represents a diagnostic, such as a compiler error or warning. + * Diagnostic objects are only valid in the scope of a resource. + */ +struct Diagnostic { + /** + * The range at which the message applies. + */ + Range range; + + /** + * The diagnostic's severity. Can be omitted. If omitted it is up to the + * client to interpret diagnostics as error, warning, info or hint. + */ + int severity = 0; + + /** + * The diagnostic's code, which might appear in the user interface. + */ + int code = 0; + + /** + * A human-readable string describing the source of this + * diagnostic, e.g. 'typescript' or 'super lint'. + */ + String source; + + /** + * The diagnostic's message. + */ + String message; + + /** + * An array of related diagnostic information, e.g. when symbol-names within + * a scope collide all definitions can be marked via this property. + */ + Vector relatedInformation; + + Dictionary to_json() const { + Dictionary dict; + dict["range"] = range.to_json(); + dict["code"] = code; + dict["severity"] = severity; + dict["message"] = message; + dict["source"] = source; + if (!relatedInformation.is_empty()) { + Array arr; + arr.resize(relatedInformation.size()); + for (int i = 0; i < relatedInformation.size(); i++) { + arr[i] = relatedInformation[i].to_json(); + } + dict["relatedInformation"] = arr; + } + return dict; + } +}; + +// Use namespace instead of enumeration to follow the LSP specifications +/** + * Describes the content type that a client supports in various + * result literals like `Hover`, `ParameterInfo` or `CompletionItem`. + * + * Please note that `MarkupKinds` must not start with a `$`. This kinds + * are reserved for internal usage. + */ +namespace MarkupKind { +static const String PlainText = "plaintext"; +static const String Markdown = "markdown"; +}; // namespace MarkupKind + +/** + * A `MarkupContent` literal represents a string value which content is interpreted base on its + * kind flag. Currently the protocol supports `plaintext` and `markdown` as markup kinds. + * + * If the kind is `markdown` then the value can contain fenced code blocks like in GitHub issues. + * See https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting + * + * Here is an example how such a string can be constructed using JavaScript / TypeScript: + * ```typescript + * let markdown: MarkdownContent = { + * kind: MarkupKind.Markdown, + * value: [ + * '# Header', + * 'Some text', + * '```typescript', + * 'someCode();', + * '```' + * ].join('\n') + * }; + * ``` + * + * *Please Note* that clients might sanitize the return markdown. A client could decide to + * remove HTML from the markdown to avoid script execution. + */ +struct MarkupContent { + /** + * The type of the Markup + */ + String kind; + + /** + * The content itself + */ + String value; + + MarkupContent() { + kind = MarkupKind::Markdown; + } + + MarkupContent(const String &p_value) { + value = p_value; + kind = MarkupKind::Markdown; + } + + Dictionary to_json() const { + Dictionary dict; + dict["kind"] = kind; + dict["value"] = value; + return dict; + } +}; + +// Use namespace instead of enumeration to follow the LSP specifications +// lsp::EnumName::EnumValue is OK but lsp::EnumValue is not +// And here C++ compilers are unhappy with our enumeration name like Color, File, RefCounted etc. +/** + * The kind of a completion entry. + */ +namespace CompletionItemKind { +static const int Text = 1; +static const int Method = 2; +static const int Function = 3; +static const int Constructor = 4; +static const int Field = 5; +static const int Variable = 6; +static const int Class = 7; +static const int Interface = 8; +static const int Module = 9; +static const int Property = 10; +static const int Unit = 11; +static const int Value = 12; +static const int Enum = 13; +static const int Keyword = 14; +static const int Snippet = 15; +static const int Color = 16; +static const int File = 17; +static const int RefCounted = 18; +static const int Folder = 19; +static const int EnumMember = 20; +static const int Constant = 21; +static const int Struct = 22; +static const int Event = 23; +static const int Operator = 24; +static const int TypeParameter = 25; +}; // namespace CompletionItemKind + +// Use namespace instead of enumeration to follow the LSP specifications +/** + * Defines whether the insert text in a completion item should be interpreted as + * plain text or a snippet. + */ +namespace InsertTextFormat { +/** + * The primary text to be inserted is treated as a plain string. + */ +static const int PlainText = 1; + +/** + * The primary text to be inserted is treated as a snippet. + * + * A snippet can define tab stops and placeholders with `$1`, `$2` + * and `${3:foo}`. `$0` defines the final tab stop, it defaults to + * the end of the snippet. Placeholders with equal identifiers are linked, + * that is typing in one will update others too. + */ +static const int Snippet = 2; +}; // namespace InsertTextFormat + +struct CompletionItem { + /** + * The label of this completion item. By default + * also the text that is inserted when selecting + * this completion. + */ + String label; + + /** + * The kind of this completion item. Based of the kind + * an icon is chosen by the editor. The standardized set + * of available values is defined in `CompletionItemKind`. + */ + int kind = 0; + + /** + * A human-readable string with additional information + * about this item, like type or symbol information. + */ + String detail; + + /** + * A human-readable string that represents a doc-comment. + */ + MarkupContent documentation; + + /** + * Indicates if this item is deprecated. + */ + bool deprecated = false; + + /** + * Select this item when showing. + * + * *Note* that only one completion item can be selected and that the + * tool / client decides which item that is. The rule is that the *first* + * item of those that match best is selected. + */ + bool preselect = false; + + /** + * A string that should be used when comparing this item + * with other items. When `falsy` the label is used. + */ + String sortText; + + /** + * A string that should be used when filtering a set of + * completion items. When `falsy` the label is used. + */ + String filterText; + + /** + * A string that should be inserted into a document when selecting + * this completion. When `falsy` the label is used. + * + * The `insertText` is subject to interpretation by the client side. + * Some tools might not take the string literally. For example + * VS Code when code complete is requested in this example `con` + * and a completion item with an `insertText` of `console` is provided it + * will only insert `sole`. Therefore it is recommended to use `textEdit` instead + * since it avoids additional client side interpretation. + * + * @deprecated Use textEdit instead. + */ + String insertText; + + /** + * The format of the insert text. The format applies to both the `insertText` property + * and the `newText` property of a provided `textEdit`. + */ + int insertTextFormat = 0; + + /** + * An edit which is applied to a document when selecting this completion. When an edit is provided the value of + * `insertText` is ignored. + * + * *Note:* The range of the edit must be a single line range and it must contain the position at which completion + * has been requested. + */ + TextEdit textEdit; + + /** + * An optional array of additional text edits that are applied when + * selecting this completion. Edits must not overlap (including the same insert position) + * with the main edit nor with themselves. + * + * Additional text edits should be used to change text unrelated to the current cursor position + * (for example adding an import statement at the top of the file if the completion item will + * insert an unqualified type). + */ + Vector additionalTextEdits; + + /** + * An optional set of characters that when pressed while this completion is active will accept it first and + * then type that character. *Note* that all commit characters should have `length=1` and that superfluous + * characters will be ignored. + */ + Vector commitCharacters; + + /** + * An optional command that is executed *after* inserting this completion. *Note* that + * additional modifications to the current document should be described with the + * additionalTextEdits-property. + */ + Command command; + + /** + * A data entry field that is preserved on a completion item between + * a completion and a completion resolve request. + */ + Variant data; + + _FORCE_INLINE_ Dictionary to_json(bool resolved = false) const { + Dictionary dict; + dict["label"] = label; + dict["kind"] = kind; + dict["data"] = data; + dict["insertText"] = insertText; + if (resolved) { + dict["detail"] = detail; + dict["documentation"] = documentation.to_json(); + dict["deprecated"] = deprecated; + dict["preselect"] = preselect; + dict["sortText"] = sortText; + dict["filterText"] = filterText; + if (commitCharacters.size()) { + dict["commitCharacters"] = commitCharacters; + } + dict["command"] = command.to_json(); + } + return dict; + } + + void load(const Dictionary &p_dict) { + if (p_dict.has("label")) { + label = p_dict["label"]; + } + if (p_dict.has("kind")) { + kind = p_dict["kind"]; + } + if (p_dict.has("detail")) { + detail = p_dict["detail"]; + } + if (p_dict.has("documentation")) { + Variant doc = p_dict["documentation"]; + if (doc.get_type() == Variant::STRING) { + documentation.value = doc; + } else if (doc.get_type() == Variant::DICTIONARY) { + Dictionary v = doc; + documentation.value = v["value"]; + } + } + if (p_dict.has("deprecated")) { + deprecated = p_dict["deprecated"]; + } + if (p_dict.has("preselect")) { + preselect = p_dict["preselect"]; + } + if (p_dict.has("sortText")) { + sortText = p_dict["sortText"]; + } + if (p_dict.has("filterText")) { + filterText = p_dict["filterText"]; + } + if (p_dict.has("insertText")) { + insertText = p_dict["insertText"]; + } + if (p_dict.has("data")) { + data = p_dict["data"]; + } + } +}; + +/** + * Represents a collection of [completion items](#CompletionItem) to be presented + * in the editor. + */ +struct CompletionList { + /** + * This list it not complete. Further typing should result in recomputing + * this list. + */ + bool isIncomplete = false; + + /** + * The completion items. + */ + Vector items; +}; + +// Use namespace instead of enumeration to follow the LSP specifications +// lsp::EnumName::EnumValue is OK but lsp::EnumValue is not +// And here C++ compilers are unhappy with our enumeration name like String, Array, Object etc +/** + * A symbol kind. + */ +namespace SymbolKind { +static const int File = 1; +static const int Module = 2; +static const int Namespace = 3; +static const int Package = 4; +static const int Class = 5; +static const int Method = 6; +static const int Property = 7; +static const int Field = 8; +static const int Constructor = 9; +static const int Enum = 10; +static const int Interface = 11; +static const int Function = 12; +static const int Variable = 13; +static const int Constant = 14; +static const int String = 15; +static const int Number = 16; +static const int Boolean = 17; +static const int Array = 18; +static const int Object = 19; +static const int Key = 20; +static const int Null = 21; +static const int EnumMember = 22; +static const int Struct = 23; +static const int Event = 24; +static const int Operator = 25; +static const int TypeParameter = 26; +}; // namespace SymbolKind + +/** + * Represents information about programming constructs like variables, classes, + * interfaces etc. + */ +struct SymbolInformation { + /** + * The name of this symbol. + */ + String name; + + /** + * The kind of this symbol. + */ + int kind = SymbolKind::File; + + /** + * Indicates if this symbol is deprecated. + */ + bool deprecated = false; + + /** + * The location of this symbol. The location's range is used by a tool + * to reveal the location in the editor. If the symbol is selected in the + * tool the range's start information is used to position the cursor. So + * the range usually spans more then the actual symbol's name and does + * normally include things like visibility modifiers. + * + * The range doesn't have to denote a node range in the sense of a abstract + * syntax tree. It can therefore not be used to re-construct a hierarchy of + * the symbols. + */ + Location location; + + /** + * The name of the symbol containing this symbol. This information is for + * user interface purposes (e.g. to render a qualifier in the user interface + * if necessary). It can't be used to re-infer a hierarchy for the document + * symbols. + */ + String containerName; + + _FORCE_INLINE_ Dictionary to_json() const { + Dictionary dict; + dict["name"] = name; + dict["kind"] = kind; + dict["deprecated"] = deprecated; + dict["location"] = location.to_json(); + dict["containerName"] = containerName; + return dict; + } +}; + +struct DocumentedSymbolInformation : public SymbolInformation { + /** + * A human-readable string with additional information + */ + String detail; + + /** + * A human-readable string that represents a doc-comment. + */ + String documentation; +}; + +/** + * Represents programming constructs like variables, classes, interfaces etc. that appear in a document. Document symbols can be + * hierarchical and they have two ranges: one that encloses its definition and one that points to its most interesting range, + * e.g. the range of an identifier. + */ +struct DocumentSymbol { + /** + * The name of this symbol. Will be displayed in the user interface and therefore must not be + * an empty string or a string only consisting of white spaces. + */ + String name; + + /** + * More detail for this symbol, e.g the signature of a function. + */ + String detail; + + /** + * Documentation for this symbol + */ + String documentation; + + /** + * Class name for the native symbols + */ + String native_class; + + /** + * The kind of this symbol. + */ + int kind = SymbolKind::File; + + /** + * Indicates if this symbol is deprecated. + */ + bool deprecated = false; + + /** + * The range enclosing this symbol not including leading/trailing whitespace but everything else + * like comments. This information is typically used to determine if the clients cursor is + * inside the symbol to reveal in the symbol in the UI. + */ + Range range; + + /** + * The range that should be selected and revealed when this symbol is being picked, e.g the name of a function. + * Must be contained by the `range`. + */ + Range selectionRange; + + DocumentUri uri; + String script_path; + + /** + * Children of this symbol, e.g. properties of a class. + */ + Vector children; + + Dictionary to_json(bool with_doc = false) const { + Dictionary dict; + dict["name"] = name; + dict["detail"] = detail; + dict["kind"] = kind; + dict["deprecated"] = deprecated; + dict["range"] = range.to_json(); + dict["selectionRange"] = selectionRange.to_json(); + if (with_doc) { + dict["documentation"] = documentation; + dict["native_class"] = native_class; + } + Array arr; + arr.resize(children.size()); + for (int i = 0; i < children.size(); i++) { + arr[i] = children[i].to_json(with_doc); + } + dict["children"] = arr; + return dict; + } + + void symbol_tree_as_list(const String &p_uri, Vector &r_list, const String &p_container = "", bool p_join_name = false) const { + DocumentedSymbolInformation si; + if (p_join_name && !p_container.is_empty()) { + si.name = p_container + ">" + name; + } else { + si.name = name; + } + si.kind = kind; + si.containerName = p_container; + si.deprecated = deprecated; + si.location.uri = p_uri; + si.location.range = range; + si.detail = detail; + si.documentation = documentation; + r_list.push_back(si); + for (int i = 0; i < children.size(); i++) { + children[i].symbol_tree_as_list(p_uri, r_list, si.name, p_join_name); + } + } + + _FORCE_INLINE_ MarkupContent render() const { + MarkupContent markdown; + if (detail.length()) { + markdown.value = "\t" + detail + "\n\n"; + } + if (documentation.length()) { + markdown.value += marked_documentation(documentation) + "\n\n"; + } + if (script_path.length()) { + markdown.value += "Defined in [" + script_path + "](" + uri + ")"; + } + return markdown; + } + + _FORCE_INLINE_ CompletionItem make_completion_item(bool resolved = false) const { + lsp::CompletionItem item; + item.label = name; + + if (resolved) { + item.documentation = render(); + } + + switch (kind) { + case lsp::SymbolKind::Enum: + item.kind = lsp::CompletionItemKind::Enum; + break; + case lsp::SymbolKind::Class: + item.kind = lsp::CompletionItemKind::Class; + break; + case lsp::SymbolKind::Property: + item.kind = lsp::CompletionItemKind::Property; + break; + case lsp::SymbolKind::Method: + case lsp::SymbolKind::Function: + item.kind = lsp::CompletionItemKind::Method; + break; + case lsp::SymbolKind::Event: + item.kind = lsp::CompletionItemKind::Event; + break; + case lsp::SymbolKind::Constant: + item.kind = lsp::CompletionItemKind::Constant; + break; + case lsp::SymbolKind::Variable: + item.kind = lsp::CompletionItemKind::Variable; + break; + case lsp::SymbolKind::File: + item.kind = lsp::CompletionItemKind::File; + break; + default: + item.kind = lsp::CompletionItemKind::Text; + break; + } + + return item; + } +}; + +struct ApplyWorkspaceEditParams { + WorkspaceEdit edit; + + Dictionary to_json() { + Dictionary dict; + + dict["edit"] = edit.to_json(); + + return dict; + } +}; + +struct NativeSymbolInspectParams { + String native_class; + String symbol_name; + + void load(const Dictionary &p_params) { + native_class = p_params["native_class"]; + symbol_name = p_params["symbol_name"]; + } +}; + +/** + * Enum of known range kinds + */ +namespace FoldingRangeKind { +/** + * Folding range for a comment + */ +static const String Comment = "comment"; +/** + * Folding range for a imports or includes + */ +static const String Imports = "imports"; +/** + * Folding range for a region (e.g. `#region`) + */ +static const String Region = "region"; +} // namespace FoldingRangeKind + +/** + * Represents a folding range. + */ +struct FoldingRange { + /** + * The zero-based line number from where the folded range starts. + */ + int startLine = 0; + + /** + * The zero-based character offset from where the folded range starts. If not defined, defaults to the length of the start line. + */ + int startCharacter = 0; + + /** + * The zero-based line number where the folded range ends. + */ + int endLine = 0; + + /** + * The zero-based character offset before the folded range ends. If not defined, defaults to the length of the end line. + */ + int endCharacter = 0; + + /** + * Describes the kind of the folding range such as `comment' or 'region'. The kind + * is used to categorize folding ranges and used by commands like 'Fold all comments'. See + * [FoldingRangeKind](#FoldingRangeKind) for an enumeration of standardized kinds. + */ + String kind = FoldingRangeKind::Region; + + _FORCE_INLINE_ Dictionary to_json() const { + Dictionary dict; + dict["startLine"] = startLine; + dict["startCharacter"] = startCharacter; + dict["endLine"] = endLine; + dict["endCharacter"] = endCharacter; + return dict; + } +}; + +// Use namespace instead of enumeration to follow the LSP specifications +/** + * How a completion was triggered + */ +namespace CompletionTriggerKind { +/** + * Completion was triggered by typing an identifier (24x7 code + * complete), manual invocation (e.g Ctrl+Space) or via API. + */ +static const int Invoked = 1; + +/** + * Completion was triggered by a trigger character specified by + * the `triggerCharacters` properties of the `CompletionRegistrationOptions`. + */ +static const int TriggerCharacter = 2; + +/** + * Completion was re-triggered as the current completion list is incomplete. + */ +static const int TriggerForIncompleteCompletions = 3; +} // namespace CompletionTriggerKind + +/** + * Contains additional information about the context in which a completion request is triggered. + */ +struct CompletionContext { + /** + * How the completion was triggered. + */ + int triggerKind = CompletionTriggerKind::TriggerCharacter; + + /** + * The trigger character (a single character) that has trigger code complete. + * Is undefined if `triggerKind !== CompletionTriggerKind.TriggerCharacter` + */ + String triggerCharacter; + + void load(const Dictionary &p_params) { + triggerKind = int(p_params["triggerKind"]); + triggerCharacter = p_params["triggerCharacter"]; + } +}; + +struct CompletionParams : public TextDocumentPositionParams { + /** + * The completion context. This is only available if the client specifies + * to send this using `ClientCapabilities.textDocument.completion.contextSupport === true` + */ + CompletionContext context; + + void load(const Dictionary &p_params) { + TextDocumentPositionParams::load(p_params); + context.load(p_params["context"]); + } +}; + +/** + * The result of a hover request. + */ +struct Hover { + /** + * The hover's content + */ + MarkupContent contents; + + /** + * An optional range is a range inside a text document + * that is used to visualize a hover, e.g. by changing the background color. + */ + Range range; + + _FORCE_INLINE_ Dictionary to_json() const { + Dictionary dict; + dict["range"] = range.to_json(); + dict["contents"] = contents.to_json(); + return dict; + } +}; + +/** + * Represents a parameter of a callable-signature. A parameter can + * have a label and a doc-comment. + */ +struct ParameterInformation { + /** + * The label of this parameter information. + * + * Either a string or an inclusive start and exclusive end offsets within its containing + * signature label. (see SignatureInformation.label). The offsets are based on a UTF-16 + * string representation as `Position` and `Range` does. + * + * *Note*: a label of type string should be a substring of its containing signature label. + * Its intended use case is to highlight the parameter label part in the `SignatureInformation.label`. + */ + String label; + + /** + * The human-readable doc-comment of this parameter. Will be shown + * in the UI but can be omitted. + */ + MarkupContent documentation; + + Dictionary to_json() const { + Dictionary dict; + dict["label"] = label; + dict["documentation"] = documentation.to_json(); + return dict; + } +}; + +/** + * Represents the signature of something callable. A signature + * can have a label, like a function-name, a doc-comment, and + * a set of parameters. + */ +struct SignatureInformation { + /** + * The label of this signature. Will be shown in + * the UI. + */ + String label; + + /** + * The human-readable doc-comment of this signature. Will be shown + * in the UI but can be omitted. + */ + MarkupContent documentation; + + /** + * The parameters of this signature. + */ + Vector parameters; + + Dictionary to_json() const { + Dictionary dict; + dict["label"] = label; + dict["documentation"] = documentation.to_json(); + Array args; + for (int i = 0; i < parameters.size(); i++) { + args.push_back(parameters[i].to_json()); + } + dict["parameters"] = args; + return dict; + } +}; + +/** + * Signature help represents the signature of something + * callable. There can be multiple signature but only one + * active and only one active parameter. + */ +struct SignatureHelp { + /** + * One or more signatures. + */ + Vector signatures; + + /** + * The active signature. If omitted or the value lies outside the + * range of `signatures` the value defaults to zero or is ignored if + * `signatures.length === 0`. Whenever possible implementors should + * make an active decision about the active signature and shouldn't + * rely on a default value. + * In future version of the protocol this property might become + * mandatory to better express this. + */ + int activeSignature = 0; + + /** + * The active parameter of the active signature. If omitted or the value + * lies outside the range of `signatures[activeSignature].parameters` + * defaults to 0 if the active signature has parameters. If + * the active signature has no parameters it is ignored. + * In future version of the protocol this property might become + * mandatory to better express the active parameter if the + * active signature does have any. + */ + int activeParameter = 0; + + Dictionary to_json() const { + Dictionary dict; + Array sigs; + for (int i = 0; i < signatures.size(); i++) { + sigs.push_back(signatures[i].to_json()); + } + dict["signatures"] = sigs; + dict["activeSignature"] = activeSignature; + dict["activeParameter"] = activeParameter; + return dict; + } +}; + +/** + * A pattern to describe in which file operation requests or notifications + * the server is interested in. + */ +struct FileOperationPattern { + /** + * The glob pattern to match. + */ + String glob = "**/*.gd"; + + /** + * Whether to match `file`s or `folder`s with this pattern. + * + * Matches both if undefined. + */ + String matches = "file"; + + Dictionary to_json() const { + Dictionary dict; + + dict["glob"] = glob; + dict["matches"] = matches; + + return dict; + } +}; + +/** + * A filter to describe in which file operation requests or notifications + * the server is interested in. + */ +struct FileOperationFilter { + /** + * The actual file operation pattern. + */ + FileOperationPattern pattern; + + Dictionary to_json() const { + Dictionary dict; + + dict["pattern"] = pattern.to_json(); + + return dict; + } +}; + +/** + * The options to register for file operations. + */ +struct FileOperationRegistrationOptions { + /** + * The actual filters. + */ + Vector filters; + + FileOperationRegistrationOptions() { + filters.push_back(FileOperationFilter()); + } + + Dictionary to_json() const { + Dictionary dict; + + Array filts; + for (int i = 0; i < filters.size(); i++) { + filts.push_back(filters[i].to_json()); + } + dict["filters"] = filts; + + return dict; + } +}; + +/** + * The server is interested in file notifications/requests. + */ +struct FileOperations { + /** + * The server is interested in receiving didDeleteFiles file notifications. + */ + FileOperationRegistrationOptions didDelete; + + Dictionary to_json() const { + Dictionary dict; + + dict["didDelete"] = didDelete.to_json(); + + return dict; + } +}; + +/** + * Workspace specific server capabilities + */ +struct Workspace { + /** + * The server is interested in file notifications/requests. + */ + FileOperations fileOperations; + + Dictionary to_json() const { + Dictionary dict; + + dict["fileOperations"] = fileOperations.to_json(); + + return dict; + } +}; + +struct ServerCapabilities { + /** + * Defines how text documents are synced. Is either a detailed structure defining each notification or + * for backwards compatibility the TextDocumentSyncKind number. If omitted it defaults to `TextDocumentSyncKind.None`. + */ + TextDocumentSyncOptions textDocumentSync; + + /** + * The server provides hover support. + */ + bool hoverProvider = true; + + /** + * The server provides completion support. + */ + CompletionOptions completionProvider; + + /** + * The server provides signature help support. + */ + SignatureHelpOptions signatureHelpProvider; + + /** + * The server provides goto definition support. + */ + bool definitionProvider = true; + + /** + * The server provides Goto Type Definition support. + * + * Since 3.6.0 + */ + bool typeDefinitionProvider = false; + + /** + * The server provides Goto Implementation support. + * + * Since 3.6.0 + */ + bool implementationProvider = false; + + /** + * The server provides find references support. + */ + bool referencesProvider = false; + + /** + * The server provides document highlight support. + */ + bool documentHighlightProvider = false; + + /** + * The server provides document symbol support. + */ + bool documentSymbolProvider = true; + + /** + * The server provides workspace symbol support. + */ + bool workspaceSymbolProvider = true; + + /** + * The server supports workspace folder. + */ + Workspace workspace; + + /** + * The server provides code actions. The `CodeActionOptions` return type is only + * valid if the client signals code action literal support via the property + * `textDocument.codeAction.codeActionLiteralSupport`. + */ + bool codeActionProvider = false; + + /** + * The server provides code lens. + */ + CodeLensOptions codeLensProvider; + + /** + * The server provides document formatting. + */ + bool documentFormattingProvider = false; + + /** + * The server provides document range formatting. + */ + bool documentRangeFormattingProvider = false; + + /** + * The server provides document formatting on typing. + */ + DocumentOnTypeFormattingOptions documentOnTypeFormattingProvider; + + /** + * The server provides rename support. RenameOptions may only be + * specified if the client states that it supports + * `prepareSupport` in its initial `initialize` request. + */ + RenameOptions renameProvider; + + /** + * The server provides document link support. + */ + DocumentLinkOptions documentLinkProvider; + + /** + * The server provides color provider support. + * + * Since 3.6.0 + */ + ColorProviderOptions colorProvider; + + /** + * The server provides folding provider support. + * + * Since 3.10.0 + */ + FoldingRangeProviderOptions foldingRangeProvider; + + /** + * The server provides go to declaration support. + * + * Since 3.14.0 + */ + bool declarationProvider = true; + + /** + * The server provides execute command support. + */ + ExecuteCommandOptions executeCommandProvider; + + _FORCE_INLINE_ Dictionary to_json() { + Dictionary dict; + dict["textDocumentSync"] = textDocumentSync.to_json(); + dict["completionProvider"] = completionProvider.to_json(); + signatureHelpProvider.triggerCharacters.push_back(","); + signatureHelpProvider.triggerCharacters.push_back("("); + dict["signatureHelpProvider"] = signatureHelpProvider.to_json(); + //dict["codeLensProvider"] = codeLensProvider.to_json(); + dict["documentOnTypeFormattingProvider"] = documentOnTypeFormattingProvider.to_json(); + dict["renameProvider"] = renameProvider.to_json(); + dict["documentLinkProvider"] = documentLinkProvider.to_json(); + dict["colorProvider"] = false; // colorProvider.to_json(); + dict["foldingRangeProvider"] = false; //foldingRangeProvider.to_json(); + dict["executeCommandProvider"] = executeCommandProvider.to_json(); + dict["hoverProvider"] = hoverProvider; + dict["definitionProvider"] = definitionProvider; + dict["typeDefinitionProvider"] = typeDefinitionProvider; + dict["implementationProvider"] = implementationProvider; + dict["referencesProvider"] = referencesProvider; + dict["documentHighlightProvider"] = documentHighlightProvider; + dict["documentSymbolProvider"] = documentSymbolProvider; + dict["workspaceSymbolProvider"] = workspaceSymbolProvider; + dict["workspace"] = workspace.to_json(); + dict["codeActionProvider"] = codeActionProvider; + dict["documentFormattingProvider"] = documentFormattingProvider; + dict["documentRangeFormattingProvider"] = documentRangeFormattingProvider; + dict["declarationProvider"] = declarationProvider; + return dict; + } +}; + +struct InitializeResult { + /** + * The capabilities the language server provides. + */ + ServerCapabilities capabilities; + + _FORCE_INLINE_ Dictionary to_json() { + Dictionary dict; + dict["capabilities"] = capabilities.to_json(); + return dict; + } +}; + +struct GodotNativeClassInfo { + String name; + const DocData::ClassDoc *class_doc = nullptr; + const ClassDB::ClassInfo *class_info = nullptr; + + Dictionary to_json() { + Dictionary dict; + dict["name"] = name; + dict["inherits"] = class_doc->inherits; + return dict; + } +}; + +/** Features not included in the standard lsp specifications */ +struct GodotCapabilities { + /** + * Native class list + */ + List native_classes; + + Dictionary to_json() { + Dictionary dict; + Array classes; + for (List::Element *E = native_classes.front(); E; E = E->next()) { + classes.push_back(E->get().to_json()); + } + dict["native_classes"] = classes; + return dict; + } +}; + +/** Format BBCode documentation from DocData to markdown */ +static String marked_documentation(const String &p_bbcode) { + String markdown = p_bbcode.strip_edges(); + + Vector lines = markdown.split("\n"); + bool in_code_block = false; + int code_block_indent = -1; + + markdown = ""; + for (int i = 0; i < lines.size(); i++) { + String line = lines[i]; + int block_start = line.find("[codeblock]"); + if (block_start != -1) { + code_block_indent = block_start; + in_code_block = true; + line = "\n"; + } else if (in_code_block) { + line = "\t" + line.substr(code_block_indent, line.length()); + } + + if (in_code_block && line.contains("[/codeblock]")) { + line = "\n"; + in_code_block = false; + } + + if (!in_code_block) { + line = line.strip_edges(); + line = line.replace("[code]", "`"); + line = line.replace("[/code]", "`"); + line = line.replace("[i]", "*"); + line = line.replace("[/i]", "*"); + line = line.replace("[b]", "**"); + line = line.replace("[/b]", "**"); + line = line.replace("[u]", "__"); + line = line.replace("[/u]", "__"); + line = line.replace("[method ", "`"); + line = line.replace("[member ", "`"); + line = line.replace("[signal ", "`"); + line = line.replace("[enum ", "`"); + line = line.replace("[constant ", "`"); + line = line.replace("[", "`"); + line = line.replace("]", "`"); + } + + if (!in_code_block && i < lines.size() - 1) { + line += "\n\n"; + } else if (i < lines.size() - 1) { + line += "\n"; + } + markdown += line; + } + return markdown; +} +} // namespace lsp + +#endif // GODOT_LSP_H diff --git a/modules/gdscript/language_server/lsp.hpp b/modules/gdscript/language_server/lsp.hpp deleted file mode 100644 index 1c9349097f..0000000000 --- a/modules/gdscript/language_server/lsp.hpp +++ /dev/null @@ -1,1978 +0,0 @@ -/*************************************************************************/ -/* lsp.hpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef GODOT_LSP_H -#define GODOT_LSP_H - -#include "core/doc_data.h" -#include "core/object/class_db.h" -#include "core/templates/list.h" - -namespace lsp { - -typedef String DocumentUri; - -/** Format BBCode documentation from DocData to markdown */ -static String marked_documentation(const String &p_bbcode); - -/** - * Text documents are identified using a URI. On the protocol level, URIs are passed as strings. - */ -struct TextDocumentIdentifier { - /** - * The text document's URI. - */ - DocumentUri uri; - - _FORCE_INLINE_ void load(const Dictionary &p_params) { - uri = p_params["uri"]; - } - - _FORCE_INLINE_ Dictionary to_json() const { - Dictionary dict; - dict["uri"] = uri; - return dict; - } -}; - -/** - * Position in a text document expressed as zero-based line and zero-based character offset. - * A position is between two characters like an ‘insert’ cursor in a editor. - * Special values like for example -1 to denote the end of a line are not supported. - */ -struct Position { - /** - * Line position in a document (zero-based). - */ - int line = 0; - - /** - * Character offset on a line in a document (zero-based). Assuming that the line is - * represented as a string, the `character` value represents the gap between the - * `character` and `character + 1`. - * - * If the character value is greater than the line length it defaults back to the - * line length. - */ - int character = 0; - - _FORCE_INLINE_ void load(const Dictionary &p_params) { - line = p_params["line"]; - character = p_params["character"]; - } - - _FORCE_INLINE_ Dictionary to_json() const { - Dictionary dict; - dict["line"] = line; - dict["character"] = character; - return dict; - } -}; - -/** - * A range in a text document expressed as (zero-based) start and end positions. - * A range is comparable to a selection in an editor. Therefore the end position is exclusive. - * If you want to specify a range that contains a line including the line ending character(s) then use an end position denoting the start of the next line. - */ -struct Range { - /** - * The range's start position. - */ - Position start; - - /** - * The range's end position. - */ - Position end; - - _FORCE_INLINE_ void load(const Dictionary &p_params) { - start.load(p_params["start"]); - end.load(p_params["end"]); - } - - _FORCE_INLINE_ Dictionary to_json() const { - Dictionary dict; - dict["start"] = start.to_json(); - dict["end"] = end.to_json(); - return dict; - } -}; - -/** - * Represents a location inside a resource, such as a line inside a text file. - */ -struct Location { - DocumentUri uri; - Range range; - - _FORCE_INLINE_ void load(const Dictionary &p_params) { - uri = p_params["uri"]; - range.load(p_params["range"]); - } - - _FORCE_INLINE_ Dictionary to_json() const { - Dictionary dict; - dict["uri"] = uri; - dict["range"] = range.to_json(); - return dict; - } -}; - -/** - * Represents a link between a source and a target location. - */ -struct LocationLink { - /** - * Span of the origin of this link. - * - * Used as the underlined span for mouse interaction. Defaults to the word range at - * the mouse position. - */ - Range *originSelectionRange = nullptr; - - /** - * The target resource identifier of this link. - */ - String targetUri; - - /** - * The full target range of this link. If the target for example is a symbol then target range is the - * range enclosing this symbol not including leading/trailing whitespace but everything else - * like comments. This information is typically used to highlight the range in the editor. - */ - Range targetRange; - - /** - * The range that should be selected and revealed when this link is being followed, e.g the name of a function. - * Must be contained by the the `targetRange`. See also `DocumentSymbol#range` - */ - Range targetSelectionRange; -}; - -/** - * A parameter literal used in requests to pass a text document and a position inside that document. - */ -struct TextDocumentPositionParams { - /** - * The text document. - */ - TextDocumentIdentifier textDocument; - - /** - * The position inside the text document. - */ - Position position; - - _FORCE_INLINE_ void load(const Dictionary &p_params) { - textDocument.load(p_params["textDocument"]); - position.load(p_params["position"]); - } - - _FORCE_INLINE_ Dictionary to_json() const { - Dictionary dict; - dict["textDocument"] = textDocument.to_json(); - dict["position"] = position.to_json(); - return dict; - } -}; - -struct DocumentLinkParams { - /** - * The document to provide document links for. - */ - TextDocumentIdentifier textDocument; - - _FORCE_INLINE_ void load(const Dictionary &p_params) { - textDocument.load(p_params["textDocument"]); - } -}; - -/** - * A document link is a range in a text document that links to an internal or external resource, like another - * text document or a web site. - */ -struct DocumentLink { - /** - * The range this link applies to. - */ - Range range; - - /** - * The uri this link points to. If missing a resolve request is sent later. - */ - DocumentUri target; - - Dictionary to_json() const { - Dictionary dict; - dict["range"] = range.to_json(); - dict["target"] = target; - return dict; - } -}; - -/** - * A textual edit applicable to a text document. - */ -struct TextEdit { - /** - * The range of the text document to be manipulated. To insert - * text into a document create a range where start === end. - */ - Range range; - - /** - * The string to be inserted. For delete operations use an - * empty string. - */ - String newText; -}; - -/** - * The edits to be applied. - */ -struct WorkspaceEdit { - /** - * Holds changes to existing resources. - */ - HashMap> changes; - - _FORCE_INLINE_ void add_edit(const String &uri, const TextEdit &edit) { - if (changes.has(uri)) { - changes[uri].push_back(edit); - } else { - Vector edits; - edits.push_back(edit); - changes[uri] = edits; - } - } - - _FORCE_INLINE_ Dictionary to_json() const { - Dictionary dict; - - Dictionary out_changes; - for (const KeyValue> &E : changes) { - Array edits; - for (int i = 0; i < E.value.size(); ++i) { - Dictionary text_edit; - text_edit["range"] = E.value[i].range.to_json(); - text_edit["newText"] = E.value[i].newText; - edits.push_back(text_edit); - } - out_changes[E.key] = edits; - } - dict["changes"] = out_changes; - - return dict; - } - - _FORCE_INLINE_ void add_change(const String &uri, const int &line, const int &start_character, const int &end_character, const String &new_text) { - if (HashMap>::Iterator E = changes.find(uri)) { - Vector edit_list = E->value; - for (int i = 0; i < edit_list.size(); ++i) { - TextEdit edit = edit_list[i]; - if (edit.range.start.character == start_character) { - return; - } - } - } - - TextEdit new_edit; - new_edit.newText = new_text; - new_edit.range.start.line = line; - new_edit.range.start.character = start_character; - new_edit.range.end.line = line; - new_edit.range.end.character = end_character; - - if (HashMap>::Iterator E = changes.find(uri)) { - E->value.push_back(new_edit); - } else { - Vector edit_list; - edit_list.push_back(new_edit); - changes.insert(uri, edit_list); - } - } -}; - -/** - * Represents a reference to a command. - * Provides a title which will be used to represent a command in the UI. - * Commands are identified by a string identifier. - * The recommended way to handle commands is to implement their execution on the server side if the client and server provides the corresponding capabilities. - * Alternatively the tool extension code could handle the command. The protocol currently doesn’t specify a set of well-known commands. - */ -struct Command { - /** - * Title of the command, like `save`. - */ - String title; - /** - * The identifier of the actual command handler. - */ - String command; - /** - * Arguments that the command handler should be - * invoked with. - */ - Array arguments; - - Dictionary to_json() const { - Dictionary dict; - dict["title"] = title; - dict["command"] = command; - if (arguments.size()) { - dict["arguments"] = arguments; - } - return dict; - } -}; - -// Use namespace instead of enumeration to follow the LSP specifications -// lsp::EnumName::EnumValue is OK but lsp::EnumValue is not - -namespace TextDocumentSyncKind { -/** - * Documents should not be synced at all. - */ -static const int None = 0; - -/** - * Documents are synced by always sending the full content - * of the document. - */ -static const int Full = 1; - -/** - * Documents are synced by sending the full content on open. - * After that only incremental updates to the document are - * send. - */ -static const int Incremental = 2; -}; // namespace TextDocumentSyncKind - -/** - * Completion options. - */ -struct CompletionOptions { - /** - * The server provides support to resolve additional - * information for a completion item. - */ - bool resolveProvider = true; - - /** - * The characters that trigger completion automatically. - */ - Vector triggerCharacters; - - CompletionOptions() { - triggerCharacters.push_back("."); - triggerCharacters.push_back("$"); - triggerCharacters.push_back("'"); - triggerCharacters.push_back("\""); - } - - Dictionary to_json() const { - Dictionary dict; - dict["resolveProvider"] = resolveProvider; - dict["triggerCharacters"] = triggerCharacters; - return dict; - } -}; - -/** - * Signature help options. - */ -struct SignatureHelpOptions { - /** - * The characters that trigger signature help - * automatically. - */ - Vector triggerCharacters; - - Dictionary to_json() { - Dictionary dict; - dict["triggerCharacters"] = triggerCharacters; - return dict; - } -}; - -/** - * Code Lens options. - */ -struct CodeLensOptions { - /** - * Code lens has a resolve provider as well. - */ - bool resolveProvider = false; - - Dictionary to_json() { - Dictionary dict; - dict["resolveProvider"] = resolveProvider; - return dict; - } -}; - -/** - * Rename options - */ -struct RenameOptions { - /** - * Renames should be checked and tested before being executed. - */ - bool prepareProvider = false; - - Dictionary to_json() { - Dictionary dict; - dict["prepareProvider"] = prepareProvider; - return dict; - } -}; - -/** - * Document link options. - */ -struct DocumentLinkOptions { - /** - * Document links have a resolve provider as well. - */ - bool resolveProvider = false; - - Dictionary to_json() { - Dictionary dict; - dict["resolveProvider"] = resolveProvider; - return dict; - } -}; - -/** - * Execute command options. - */ -struct ExecuteCommandOptions { - /** - * The commands to be executed on the server - */ - Vector commands; - - Dictionary to_json() { - Dictionary dict; - dict["commands"] = commands; - return dict; - } -}; - -/** - * Save options. - */ -struct SaveOptions { - /** - * The client is supposed to include the content on save. - */ - bool includeText = true; - - Dictionary to_json() { - Dictionary dict; - dict["includeText"] = includeText; - return dict; - } -}; - -/** - * Color provider options. - */ -struct ColorProviderOptions { - Dictionary to_json() { - Dictionary dict; - return dict; - } -}; - -/** - * Folding range provider options. - */ -struct FoldingRangeProviderOptions { - Dictionary to_json() { - Dictionary dict; - return dict; - } -}; - -struct TextDocumentSyncOptions { - /** - * Open and close notifications are sent to the server. If omitted open close notification should not - * be sent. - */ - bool openClose = true; - - /** - * Change notifications are sent to the server. See TextDocumentSyncKind.None, TextDocumentSyncKind.Full - * and TextDocumentSyncKind.Incremental. If omitted it defaults to TextDocumentSyncKind.None. - */ - int change = TextDocumentSyncKind::Full; - - /** - * If present will save notifications are sent to the server. If omitted the notification should not be - * sent. - */ - bool willSave = false; - - /** - * If present will save wait until requests are sent to the server. If omitted the request should not be - * sent. - */ - bool willSaveWaitUntil = false; - - /** - * If present save notifications are sent to the server. If omitted the notification should not be - * sent. - */ - SaveOptions save; - - Dictionary to_json() { - Dictionary dict; - dict["willSaveWaitUntil"] = willSaveWaitUntil; - dict["willSave"] = willSave; - dict["openClose"] = openClose; - dict["change"] = change; - dict["save"] = save.to_json(); - return dict; - } -}; - -/** - * Static registration options to be returned in the initialize request. - */ -struct StaticRegistrationOptions { - /** - * The id used to register the request. The id can be used to deregister - * the request again. See also Registration#id. - */ - String id; -}; - -/** - * Format document on type options. - */ -struct DocumentOnTypeFormattingOptions { - /** - * A character on which formatting should be triggered, like `}`. - */ - String firstTriggerCharacter; - - /** - * More trigger characters. - */ - Vector moreTriggerCharacter; - - Dictionary to_json() { - Dictionary dict; - dict["firstTriggerCharacter"] = firstTriggerCharacter; - dict["moreTriggerCharacter"] = moreTriggerCharacter; - return dict; - } -}; - -struct TextDocumentItem { - /** - * The text document's URI. - */ - DocumentUri uri; - - /** - * The text document's language identifier. - */ - String languageId; - - /** - * The version number of this document (it will increase after each - * change, including undo/redo). - */ - int version = 0; - - /** - * The content of the opened text document. - */ - String text; - - void load(const Dictionary &p_dict) { - uri = p_dict["uri"]; - languageId = p_dict["languageId"]; - version = p_dict["version"]; - text = p_dict["text"]; - } - - Dictionary to_json() const { - Dictionary dict; - dict["uri"] = uri; - dict["languageId"] = languageId; - dict["version"] = version; - dict["text"] = text; - return dict; - } -}; - -/** - * An event describing a change to a text document. If range and rangeLength are omitted - * the new text is considered to be the full content of the document. - */ -struct TextDocumentContentChangeEvent { - /** - * The range of the document that changed. - */ - Range range; - - /** - * The length of the range that got replaced. - */ - int rangeLength = 0; - - /** - * The new text of the range/document. - */ - String text; - - void load(const Dictionary &p_params) { - text = p_params["text"]; - rangeLength = p_params["rangeLength"]; - range.load(p_params["range"]); - } -}; - -// Use namespace instead of enumeration to follow the LSP specifications -namespace DiagnosticSeverity { -/** - * Reports an error. - */ -static const int Error = 1; -/** - * Reports a warning. - */ -static const int Warning = 2; -/** - * Reports an information. - */ -static const int Information = 3; -/** - * Reports a hint. - */ -static const int Hint = 4; -}; // namespace DiagnosticSeverity - -/** - * Represents a related message and source code location for a diagnostic. This should be - * used to point to code locations that cause or related to a diagnostics, e.g when duplicating - * a symbol in a scope. - */ -struct DiagnosticRelatedInformation { - /** - * The location of this related diagnostic information. - */ - Location location; - - /** - * The message of this related diagnostic information. - */ - String message; - - Dictionary to_json() const { - Dictionary dict; - dict["location"] = location.to_json(), - dict["message"] = message; - return dict; - } -}; - -/** - * Represents a diagnostic, such as a compiler error or warning. - * Diagnostic objects are only valid in the scope of a resource. - */ -struct Diagnostic { - /** - * The range at which the message applies. - */ - Range range; - - /** - * The diagnostic's severity. Can be omitted. If omitted it is up to the - * client to interpret diagnostics as error, warning, info or hint. - */ - int severity = 0; - - /** - * The diagnostic's code, which might appear in the user interface. - */ - int code = 0; - - /** - * A human-readable string describing the source of this - * diagnostic, e.g. 'typescript' or 'super lint'. - */ - String source; - - /** - * The diagnostic's message. - */ - String message; - - /** - * An array of related diagnostic information, e.g. when symbol-names within - * a scope collide all definitions can be marked via this property. - */ - Vector relatedInformation; - - Dictionary to_json() const { - Dictionary dict; - dict["range"] = range.to_json(); - dict["code"] = code; - dict["severity"] = severity; - dict["message"] = message; - dict["source"] = source; - if (!relatedInformation.is_empty()) { - Array arr; - arr.resize(relatedInformation.size()); - for (int i = 0; i < relatedInformation.size(); i++) { - arr[i] = relatedInformation[i].to_json(); - } - dict["relatedInformation"] = arr; - } - return dict; - } -}; - -// Use namespace instead of enumeration to follow the LSP specifications -/** - * Describes the content type that a client supports in various - * result literals like `Hover`, `ParameterInfo` or `CompletionItem`. - * - * Please note that `MarkupKinds` must not start with a `$`. This kinds - * are reserved for internal usage. - */ -namespace MarkupKind { -static const String PlainText = "plaintext"; -static const String Markdown = "markdown"; -}; // namespace MarkupKind - -/** - * A `MarkupContent` literal represents a string value which content is interpreted base on its - * kind flag. Currently the protocol supports `plaintext` and `markdown` as markup kinds. - * - * If the kind is `markdown` then the value can contain fenced code blocks like in GitHub issues. - * See https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting - * - * Here is an example how such a string can be constructed using JavaScript / TypeScript: - * ```typescript - * let markdown: MarkdownContent = { - * kind: MarkupKind.Markdown, - * value: [ - * '# Header', - * 'Some text', - * '```typescript', - * 'someCode();', - * '```' - * ].join('\n') - * }; - * ``` - * - * *Please Note* that clients might sanitize the return markdown. A client could decide to - * remove HTML from the markdown to avoid script execution. - */ -struct MarkupContent { - /** - * The type of the Markup - */ - String kind; - - /** - * The content itself - */ - String value; - - MarkupContent() { - kind = MarkupKind::Markdown; - } - - MarkupContent(const String &p_value) { - value = p_value; - kind = MarkupKind::Markdown; - } - - Dictionary to_json() const { - Dictionary dict; - dict["kind"] = kind; - dict["value"] = value; - return dict; - } -}; - -// Use namespace instead of enumeration to follow the LSP specifications -// lsp::EnumName::EnumValue is OK but lsp::EnumValue is not -// And here C++ compilers are unhappy with our enumeration name like Color, File, RefCounted etc. -/** - * The kind of a completion entry. - */ -namespace CompletionItemKind { -static const int Text = 1; -static const int Method = 2; -static const int Function = 3; -static const int Constructor = 4; -static const int Field = 5; -static const int Variable = 6; -static const int Class = 7; -static const int Interface = 8; -static const int Module = 9; -static const int Property = 10; -static const int Unit = 11; -static const int Value = 12; -static const int Enum = 13; -static const int Keyword = 14; -static const int Snippet = 15; -static const int Color = 16; -static const int File = 17; -static const int RefCounted = 18; -static const int Folder = 19; -static const int EnumMember = 20; -static const int Constant = 21; -static const int Struct = 22; -static const int Event = 23; -static const int Operator = 24; -static const int TypeParameter = 25; -}; // namespace CompletionItemKind - -// Use namespace instead of enumeration to follow the LSP specifications -/** - * Defines whether the insert text in a completion item should be interpreted as - * plain text or a snippet. - */ -namespace InsertTextFormat { -/** - * The primary text to be inserted is treated as a plain string. - */ -static const int PlainText = 1; - -/** - * The primary text to be inserted is treated as a snippet. - * - * A snippet can define tab stops and placeholders with `$1`, `$2` - * and `${3:foo}`. `$0` defines the final tab stop, it defaults to - * the end of the snippet. Placeholders with equal identifiers are linked, - * that is typing in one will update others too. - */ -static const int Snippet = 2; -}; // namespace InsertTextFormat - -struct CompletionItem { - /** - * The label of this completion item. By default - * also the text that is inserted when selecting - * this completion. - */ - String label; - - /** - * The kind of this completion item. Based of the kind - * an icon is chosen by the editor. The standardized set - * of available values is defined in `CompletionItemKind`. - */ - int kind = 0; - - /** - * A human-readable string with additional information - * about this item, like type or symbol information. - */ - String detail; - - /** - * A human-readable string that represents a doc-comment. - */ - MarkupContent documentation; - - /** - * Indicates if this item is deprecated. - */ - bool deprecated = false; - - /** - * Select this item when showing. - * - * *Note* that only one completion item can be selected and that the - * tool / client decides which item that is. The rule is that the *first* - * item of those that match best is selected. - */ - bool preselect = false; - - /** - * A string that should be used when comparing this item - * with other items. When `falsy` the label is used. - */ - String sortText; - - /** - * A string that should be used when filtering a set of - * completion items. When `falsy` the label is used. - */ - String filterText; - - /** - * A string that should be inserted into a document when selecting - * this completion. When `falsy` the label is used. - * - * The `insertText` is subject to interpretation by the client side. - * Some tools might not take the string literally. For example - * VS Code when code complete is requested in this example `con` - * and a completion item with an `insertText` of `console` is provided it - * will only insert `sole`. Therefore it is recommended to use `textEdit` instead - * since it avoids additional client side interpretation. - * - * @deprecated Use textEdit instead. - */ - String insertText; - - /** - * The format of the insert text. The format applies to both the `insertText` property - * and the `newText` property of a provided `textEdit`. - */ - int insertTextFormat = 0; - - /** - * An edit which is applied to a document when selecting this completion. When an edit is provided the value of - * `insertText` is ignored. - * - * *Note:* The range of the edit must be a single line range and it must contain the position at which completion - * has been requested. - */ - TextEdit textEdit; - - /** - * An optional array of additional text edits that are applied when - * selecting this completion. Edits must not overlap (including the same insert position) - * with the main edit nor with themselves. - * - * Additional text edits should be used to change text unrelated to the current cursor position - * (for example adding an import statement at the top of the file if the completion item will - * insert an unqualified type). - */ - Vector additionalTextEdits; - - /** - * An optional set of characters that when pressed while this completion is active will accept it first and - * then type that character. *Note* that all commit characters should have `length=1` and that superfluous - * characters will be ignored. - */ - Vector commitCharacters; - - /** - * An optional command that is executed *after* inserting this completion. *Note* that - * additional modifications to the current document should be described with the - * additionalTextEdits-property. - */ - Command command; - - /** - * A data entry field that is preserved on a completion item between - * a completion and a completion resolve request. - */ - Variant data; - - _FORCE_INLINE_ Dictionary to_json(bool resolved = false) const { - Dictionary dict; - dict["label"] = label; - dict["kind"] = kind; - dict["data"] = data; - dict["insertText"] = insertText; - if (resolved) { - dict["detail"] = detail; - dict["documentation"] = documentation.to_json(); - dict["deprecated"] = deprecated; - dict["preselect"] = preselect; - dict["sortText"] = sortText; - dict["filterText"] = filterText; - if (commitCharacters.size()) { - dict["commitCharacters"] = commitCharacters; - } - dict["command"] = command.to_json(); - } - return dict; - } - - void load(const Dictionary &p_dict) { - if (p_dict.has("label")) { - label = p_dict["label"]; - } - if (p_dict.has("kind")) { - kind = p_dict["kind"]; - } - if (p_dict.has("detail")) { - detail = p_dict["detail"]; - } - if (p_dict.has("documentation")) { - Variant doc = p_dict["documentation"]; - if (doc.get_type() == Variant::STRING) { - documentation.value = doc; - } else if (doc.get_type() == Variant::DICTIONARY) { - Dictionary v = doc; - documentation.value = v["value"]; - } - } - if (p_dict.has("deprecated")) { - deprecated = p_dict["deprecated"]; - } - if (p_dict.has("preselect")) { - preselect = p_dict["preselect"]; - } - if (p_dict.has("sortText")) { - sortText = p_dict["sortText"]; - } - if (p_dict.has("filterText")) { - filterText = p_dict["filterText"]; - } - if (p_dict.has("insertText")) { - insertText = p_dict["insertText"]; - } - if (p_dict.has("data")) { - data = p_dict["data"]; - } - } -}; - -/** - * Represents a collection of [completion items](#CompletionItem) to be presented - * in the editor. - */ -struct CompletionList { - /** - * This list it not complete. Further typing should result in recomputing - * this list. - */ - bool isIncomplete = false; - - /** - * The completion items. - */ - Vector items; -}; - -// Use namespace instead of enumeration to follow the LSP specifications -// lsp::EnumName::EnumValue is OK but lsp::EnumValue is not -// And here C++ compilers are unhappy with our enumeration name like String, Array, Object etc -/** - * A symbol kind. - */ -namespace SymbolKind { -static const int File = 1; -static const int Module = 2; -static const int Namespace = 3; -static const int Package = 4; -static const int Class = 5; -static const int Method = 6; -static const int Property = 7; -static const int Field = 8; -static const int Constructor = 9; -static const int Enum = 10; -static const int Interface = 11; -static const int Function = 12; -static const int Variable = 13; -static const int Constant = 14; -static const int String = 15; -static const int Number = 16; -static const int Boolean = 17; -static const int Array = 18; -static const int Object = 19; -static const int Key = 20; -static const int Null = 21; -static const int EnumMember = 22; -static const int Struct = 23; -static const int Event = 24; -static const int Operator = 25; -static const int TypeParameter = 26; -}; // namespace SymbolKind - -/** - * Represents information about programming constructs like variables, classes, - * interfaces etc. - */ -struct SymbolInformation { - /** - * The name of this symbol. - */ - String name; - - /** - * The kind of this symbol. - */ - int kind = SymbolKind::File; - - /** - * Indicates if this symbol is deprecated. - */ - bool deprecated = false; - - /** - * The location of this symbol. The location's range is used by a tool - * to reveal the location in the editor. If the symbol is selected in the - * tool the range's start information is used to position the cursor. So - * the range usually spans more then the actual symbol's name and does - * normally include things like visibility modifiers. - * - * The range doesn't have to denote a node range in the sense of a abstract - * syntax tree. It can therefore not be used to re-construct a hierarchy of - * the symbols. - */ - Location location; - - /** - * The name of the symbol containing this symbol. This information is for - * user interface purposes (e.g. to render a qualifier in the user interface - * if necessary). It can't be used to re-infer a hierarchy for the document - * symbols. - */ - String containerName; - - _FORCE_INLINE_ Dictionary to_json() const { - Dictionary dict; - dict["name"] = name; - dict["kind"] = kind; - dict["deprecated"] = deprecated; - dict["location"] = location.to_json(); - dict["containerName"] = containerName; - return dict; - } -}; - -struct DocumentedSymbolInformation : public SymbolInformation { - /** - * A human-readable string with additional information - */ - String detail; - - /** - * A human-readable string that represents a doc-comment. - */ - String documentation; -}; - -/** - * Represents programming constructs like variables, classes, interfaces etc. that appear in a document. Document symbols can be - * hierarchical and they have two ranges: one that encloses its definition and one that points to its most interesting range, - * e.g. the range of an identifier. - */ -struct DocumentSymbol { - /** - * The name of this symbol. Will be displayed in the user interface and therefore must not be - * an empty string or a string only consisting of white spaces. - */ - String name; - - /** - * More detail for this symbol, e.g the signature of a function. - */ - String detail; - - /** - * Documentation for this symbol - */ - String documentation; - - /** - * Class name for the native symbols - */ - String native_class; - - /** - * The kind of this symbol. - */ - int kind = SymbolKind::File; - - /** - * Indicates if this symbol is deprecated. - */ - bool deprecated = false; - - /** - * The range enclosing this symbol not including leading/trailing whitespace but everything else - * like comments. This information is typically used to determine if the clients cursor is - * inside the symbol to reveal in the symbol in the UI. - */ - Range range; - - /** - * The range that should be selected and revealed when this symbol is being picked, e.g the name of a function. - * Must be contained by the `range`. - */ - Range selectionRange; - - DocumentUri uri; - String script_path; - - /** - * Children of this symbol, e.g. properties of a class. - */ - Vector children; - - Dictionary to_json(bool with_doc = false) const { - Dictionary dict; - dict["name"] = name; - dict["detail"] = detail; - dict["kind"] = kind; - dict["deprecated"] = deprecated; - dict["range"] = range.to_json(); - dict["selectionRange"] = selectionRange.to_json(); - if (with_doc) { - dict["documentation"] = documentation; - dict["native_class"] = native_class; - } - Array arr; - arr.resize(children.size()); - for (int i = 0; i < children.size(); i++) { - arr[i] = children[i].to_json(with_doc); - } - dict["children"] = arr; - return dict; - } - - void symbol_tree_as_list(const String &p_uri, Vector &r_list, const String &p_container = "", bool p_join_name = false) const { - DocumentedSymbolInformation si; - if (p_join_name && !p_container.is_empty()) { - si.name = p_container + ">" + name; - } else { - si.name = name; - } - si.kind = kind; - si.containerName = p_container; - si.deprecated = deprecated; - si.location.uri = p_uri; - si.location.range = range; - si.detail = detail; - si.documentation = documentation; - r_list.push_back(si); - for (int i = 0; i < children.size(); i++) { - children[i].symbol_tree_as_list(p_uri, r_list, si.name, p_join_name); - } - } - - _FORCE_INLINE_ MarkupContent render() const { - MarkupContent markdown; - if (detail.length()) { - markdown.value = "\t" + detail + "\n\n"; - } - if (documentation.length()) { - markdown.value += marked_documentation(documentation) + "\n\n"; - } - if (script_path.length()) { - markdown.value += "Defined in [" + script_path + "](" + uri + ")"; - } - return markdown; - } - - _FORCE_INLINE_ CompletionItem make_completion_item(bool resolved = false) const { - lsp::CompletionItem item; - item.label = name; - - if (resolved) { - item.documentation = render(); - } - - switch (kind) { - case lsp::SymbolKind::Enum: - item.kind = lsp::CompletionItemKind::Enum; - break; - case lsp::SymbolKind::Class: - item.kind = lsp::CompletionItemKind::Class; - break; - case lsp::SymbolKind::Property: - item.kind = lsp::CompletionItemKind::Property; - break; - case lsp::SymbolKind::Method: - case lsp::SymbolKind::Function: - item.kind = lsp::CompletionItemKind::Method; - break; - case lsp::SymbolKind::Event: - item.kind = lsp::CompletionItemKind::Event; - break; - case lsp::SymbolKind::Constant: - item.kind = lsp::CompletionItemKind::Constant; - break; - case lsp::SymbolKind::Variable: - item.kind = lsp::CompletionItemKind::Variable; - break; - case lsp::SymbolKind::File: - item.kind = lsp::CompletionItemKind::File; - break; - default: - item.kind = lsp::CompletionItemKind::Text; - break; - } - - return item; - } -}; - -struct ApplyWorkspaceEditParams { - WorkspaceEdit edit; - - Dictionary to_json() { - Dictionary dict; - - dict["edit"] = edit.to_json(); - - return dict; - } -}; - -struct NativeSymbolInspectParams { - String native_class; - String symbol_name; - - void load(const Dictionary &p_params) { - native_class = p_params["native_class"]; - symbol_name = p_params["symbol_name"]; - } -}; - -/** - * Enum of known range kinds - */ -namespace FoldingRangeKind { -/** - * Folding range for a comment - */ -static const String Comment = "comment"; -/** - * Folding range for a imports or includes - */ -static const String Imports = "imports"; -/** - * Folding range for a region (e.g. `#region`) - */ -static const String Region = "region"; -} // namespace FoldingRangeKind - -/** - * Represents a folding range. - */ -struct FoldingRange { - /** - * The zero-based line number from where the folded range starts. - */ - int startLine = 0; - - /** - * The zero-based character offset from where the folded range starts. If not defined, defaults to the length of the start line. - */ - int startCharacter = 0; - - /** - * The zero-based line number where the folded range ends. - */ - int endLine = 0; - - /** - * The zero-based character offset before the folded range ends. If not defined, defaults to the length of the end line. - */ - int endCharacter = 0; - - /** - * Describes the kind of the folding range such as `comment' or 'region'. The kind - * is used to categorize folding ranges and used by commands like 'Fold all comments'. See - * [FoldingRangeKind](#FoldingRangeKind) for an enumeration of standardized kinds. - */ - String kind = FoldingRangeKind::Region; - - _FORCE_INLINE_ Dictionary to_json() const { - Dictionary dict; - dict["startLine"] = startLine; - dict["startCharacter"] = startCharacter; - dict["endLine"] = endLine; - dict["endCharacter"] = endCharacter; - return dict; - } -}; - -// Use namespace instead of enumeration to follow the LSP specifications -/** - * How a completion was triggered - */ -namespace CompletionTriggerKind { -/** - * Completion was triggered by typing an identifier (24x7 code - * complete), manual invocation (e.g Ctrl+Space) or via API. - */ -static const int Invoked = 1; - -/** - * Completion was triggered by a trigger character specified by - * the `triggerCharacters` properties of the `CompletionRegistrationOptions`. - */ -static const int TriggerCharacter = 2; - -/** - * Completion was re-triggered as the current completion list is incomplete. - */ -static const int TriggerForIncompleteCompletions = 3; -} // namespace CompletionTriggerKind - -/** - * Contains additional information about the context in which a completion request is triggered. - */ -struct CompletionContext { - /** - * How the completion was triggered. - */ - int triggerKind = CompletionTriggerKind::TriggerCharacter; - - /** - * The trigger character (a single character) that has trigger code complete. - * Is undefined if `triggerKind !== CompletionTriggerKind.TriggerCharacter` - */ - String triggerCharacter; - - void load(const Dictionary &p_params) { - triggerKind = int(p_params["triggerKind"]); - triggerCharacter = p_params["triggerCharacter"]; - } -}; - -struct CompletionParams : public TextDocumentPositionParams { - /** - * The completion context. This is only available if the client specifies - * to send this using `ClientCapabilities.textDocument.completion.contextSupport === true` - */ - CompletionContext context; - - void load(const Dictionary &p_params) { - TextDocumentPositionParams::load(p_params); - context.load(p_params["context"]); - } -}; - -/** - * The result of a hover request. - */ -struct Hover { - /** - * The hover's content - */ - MarkupContent contents; - - /** - * An optional range is a range inside a text document - * that is used to visualize a hover, e.g. by changing the background color. - */ - Range range; - - _FORCE_INLINE_ Dictionary to_json() const { - Dictionary dict; - dict["range"] = range.to_json(); - dict["contents"] = contents.to_json(); - return dict; - } -}; - -/** - * Represents a parameter of a callable-signature. A parameter can - * have a label and a doc-comment. - */ -struct ParameterInformation { - /** - * The label of this parameter information. - * - * Either a string or an inclusive start and exclusive end offsets within its containing - * signature label. (see SignatureInformation.label). The offsets are based on a UTF-16 - * string representation as `Position` and `Range` does. - * - * *Note*: a label of type string should be a substring of its containing signature label. - * Its intended use case is to highlight the parameter label part in the `SignatureInformation.label`. - */ - String label; - - /** - * The human-readable doc-comment of this parameter. Will be shown - * in the UI but can be omitted. - */ - MarkupContent documentation; - - Dictionary to_json() const { - Dictionary dict; - dict["label"] = label; - dict["documentation"] = documentation.to_json(); - return dict; - } -}; - -/** - * Represents the signature of something callable. A signature - * can have a label, like a function-name, a doc-comment, and - * a set of parameters. - */ -struct SignatureInformation { - /** - * The label of this signature. Will be shown in - * the UI. - */ - String label; - - /** - * The human-readable doc-comment of this signature. Will be shown - * in the UI but can be omitted. - */ - MarkupContent documentation; - - /** - * The parameters of this signature. - */ - Vector parameters; - - Dictionary to_json() const { - Dictionary dict; - dict["label"] = label; - dict["documentation"] = documentation.to_json(); - Array args; - for (int i = 0; i < parameters.size(); i++) { - args.push_back(parameters[i].to_json()); - } - dict["parameters"] = args; - return dict; - } -}; - -/** - * Signature help represents the signature of something - * callable. There can be multiple signature but only one - * active and only one active parameter. - */ -struct SignatureHelp { - /** - * One or more signatures. - */ - Vector signatures; - - /** - * The active signature. If omitted or the value lies outside the - * range of `signatures` the value defaults to zero or is ignored if - * `signatures.length === 0`. Whenever possible implementors should - * make an active decision about the active signature and shouldn't - * rely on a default value. - * In future version of the protocol this property might become - * mandatory to better express this. - */ - int activeSignature = 0; - - /** - * The active parameter of the active signature. If omitted or the value - * lies outside the range of `signatures[activeSignature].parameters` - * defaults to 0 if the active signature has parameters. If - * the active signature has no parameters it is ignored. - * In future version of the protocol this property might become - * mandatory to better express the active parameter if the - * active signature does have any. - */ - int activeParameter = 0; - - Dictionary to_json() const { - Dictionary dict; - Array sigs; - for (int i = 0; i < signatures.size(); i++) { - sigs.push_back(signatures[i].to_json()); - } - dict["signatures"] = sigs; - dict["activeSignature"] = activeSignature; - dict["activeParameter"] = activeParameter; - return dict; - } -}; - -/** - * A pattern to describe in which file operation requests or notifications - * the server is interested in. - */ -struct FileOperationPattern { - /** - * The glob pattern to match. - */ - String glob = "**/*.gd"; - - /** - * Whether to match `file`s or `folder`s with this pattern. - * - * Matches both if undefined. - */ - String matches = "file"; - - Dictionary to_json() const { - Dictionary dict; - - dict["glob"] = glob; - dict["matches"] = matches; - - return dict; - } -}; - -/** - * A filter to describe in which file operation requests or notifications - * the server is interested in. - */ -struct FileOperationFilter { - /** - * The actual file operation pattern. - */ - FileOperationPattern pattern; - - Dictionary to_json() const { - Dictionary dict; - - dict["pattern"] = pattern.to_json(); - - return dict; - } -}; - -/** - * The options to register for file operations. - */ -struct FileOperationRegistrationOptions { - /** - * The actual filters. - */ - Vector filters; - - FileOperationRegistrationOptions() { - filters.push_back(FileOperationFilter()); - } - - Dictionary to_json() const { - Dictionary dict; - - Array filts; - for (int i = 0; i < filters.size(); i++) { - filts.push_back(filters[i].to_json()); - } - dict["filters"] = filts; - - return dict; - } -}; - -/** - * The server is interested in file notifications/requests. - */ -struct FileOperations { - /** - * The server is interested in receiving didDeleteFiles file notifications. - */ - FileOperationRegistrationOptions didDelete; - - Dictionary to_json() const { - Dictionary dict; - - dict["didDelete"] = didDelete.to_json(); - - return dict; - } -}; - -/** - * Workspace specific server capabilities - */ -struct Workspace { - /** - * The server is interested in file notifications/requests. - */ - FileOperations fileOperations; - - Dictionary to_json() const { - Dictionary dict; - - dict["fileOperations"] = fileOperations.to_json(); - - return dict; - } -}; - -struct ServerCapabilities { - /** - * Defines how text documents are synced. Is either a detailed structure defining each notification or - * for backwards compatibility the TextDocumentSyncKind number. If omitted it defaults to `TextDocumentSyncKind.None`. - */ - TextDocumentSyncOptions textDocumentSync; - - /** - * The server provides hover support. - */ - bool hoverProvider = true; - - /** - * The server provides completion support. - */ - CompletionOptions completionProvider; - - /** - * The server provides signature help support. - */ - SignatureHelpOptions signatureHelpProvider; - - /** - * The server provides goto definition support. - */ - bool definitionProvider = true; - - /** - * The server provides Goto Type Definition support. - * - * Since 3.6.0 - */ - bool typeDefinitionProvider = false; - - /** - * The server provides Goto Implementation support. - * - * Since 3.6.0 - */ - bool implementationProvider = false; - - /** - * The server provides find references support. - */ - bool referencesProvider = false; - - /** - * The server provides document highlight support. - */ - bool documentHighlightProvider = false; - - /** - * The server provides document symbol support. - */ - bool documentSymbolProvider = true; - - /** - * The server provides workspace symbol support. - */ - bool workspaceSymbolProvider = true; - - /** - * The server supports workspace folder. - */ - Workspace workspace; - - /** - * The server provides code actions. The `CodeActionOptions` return type is only - * valid if the client signals code action literal support via the property - * `textDocument.codeAction.codeActionLiteralSupport`. - */ - bool codeActionProvider = false; - - /** - * The server provides code lens. - */ - CodeLensOptions codeLensProvider; - - /** - * The server provides document formatting. - */ - bool documentFormattingProvider = false; - - /** - * The server provides document range formatting. - */ - bool documentRangeFormattingProvider = false; - - /** - * The server provides document formatting on typing. - */ - DocumentOnTypeFormattingOptions documentOnTypeFormattingProvider; - - /** - * The server provides rename support. RenameOptions may only be - * specified if the client states that it supports - * `prepareSupport` in its initial `initialize` request. - */ - RenameOptions renameProvider; - - /** - * The server provides document link support. - */ - DocumentLinkOptions documentLinkProvider; - - /** - * The server provides color provider support. - * - * Since 3.6.0 - */ - ColorProviderOptions colorProvider; - - /** - * The server provides folding provider support. - * - * Since 3.10.0 - */ - FoldingRangeProviderOptions foldingRangeProvider; - - /** - * The server provides go to declaration support. - * - * Since 3.14.0 - */ - bool declarationProvider = true; - - /** - * The server provides execute command support. - */ - ExecuteCommandOptions executeCommandProvider; - - _FORCE_INLINE_ Dictionary to_json() { - Dictionary dict; - dict["textDocumentSync"] = textDocumentSync.to_json(); - dict["completionProvider"] = completionProvider.to_json(); - signatureHelpProvider.triggerCharacters.push_back(","); - signatureHelpProvider.triggerCharacters.push_back("("); - dict["signatureHelpProvider"] = signatureHelpProvider.to_json(); - //dict["codeLensProvider"] = codeLensProvider.to_json(); - dict["documentOnTypeFormattingProvider"] = documentOnTypeFormattingProvider.to_json(); - dict["renameProvider"] = renameProvider.to_json(); - dict["documentLinkProvider"] = documentLinkProvider.to_json(); - dict["colorProvider"] = false; // colorProvider.to_json(); - dict["foldingRangeProvider"] = false; //foldingRangeProvider.to_json(); - dict["executeCommandProvider"] = executeCommandProvider.to_json(); - dict["hoverProvider"] = hoverProvider; - dict["definitionProvider"] = definitionProvider; - dict["typeDefinitionProvider"] = typeDefinitionProvider; - dict["implementationProvider"] = implementationProvider; - dict["referencesProvider"] = referencesProvider; - dict["documentHighlightProvider"] = documentHighlightProvider; - dict["documentSymbolProvider"] = documentSymbolProvider; - dict["workspaceSymbolProvider"] = workspaceSymbolProvider; - dict["workspace"] = workspace.to_json(); - dict["codeActionProvider"] = codeActionProvider; - dict["documentFormattingProvider"] = documentFormattingProvider; - dict["documentRangeFormattingProvider"] = documentRangeFormattingProvider; - dict["declarationProvider"] = declarationProvider; - return dict; - } -}; - -struct InitializeResult { - /** - * The capabilities the language server provides. - */ - ServerCapabilities capabilities; - - _FORCE_INLINE_ Dictionary to_json() { - Dictionary dict; - dict["capabilities"] = capabilities.to_json(); - return dict; - } -}; - -struct GodotNativeClassInfo { - String name; - const DocData::ClassDoc *class_doc = nullptr; - const ClassDB::ClassInfo *class_info = nullptr; - - Dictionary to_json() { - Dictionary dict; - dict["name"] = name; - dict["inherits"] = class_doc->inherits; - return dict; - } -}; - -/** Features not included in the standard lsp specifications */ -struct GodotCapabilities { - /** - * Native class list - */ - List native_classes; - - Dictionary to_json() { - Dictionary dict; - Array classes; - for (List::Element *E = native_classes.front(); E; E = E->next()) { - classes.push_back(E->get().to_json()); - } - dict["native_classes"] = classes; - return dict; - } -}; - -/** Format BBCode documentation from DocData to markdown */ -static String marked_documentation(const String &p_bbcode) { - String markdown = p_bbcode.strip_edges(); - - Vector lines = markdown.split("\n"); - bool in_code_block = false; - int code_block_indent = -1; - - markdown = ""; - for (int i = 0; i < lines.size(); i++) { - String line = lines[i]; - int block_start = line.find("[codeblock]"); - if (block_start != -1) { - code_block_indent = block_start; - in_code_block = true; - line = "\n"; - } else if (in_code_block) { - line = "\t" + line.substr(code_block_indent, line.length()); - } - - if (in_code_block && line.contains("[/codeblock]")) { - line = "\n"; - in_code_block = false; - } - - if (!in_code_block) { - line = line.strip_edges(); - line = line.replace("[code]", "`"); - line = line.replace("[/code]", "`"); - line = line.replace("[i]", "*"); - line = line.replace("[/i]", "*"); - line = line.replace("[b]", "**"); - line = line.replace("[/b]", "**"); - line = line.replace("[u]", "__"); - line = line.replace("[/u]", "__"); - line = line.replace("[method ", "`"); - line = line.replace("[member ", "`"); - line = line.replace("[signal ", "`"); - line = line.replace("[enum ", "`"); - line = line.replace("[constant ", "`"); - line = line.replace("[", "`"); - line = line.replace("]", "`"); - } - - if (!in_code_block && i < lines.size() - 1) { - line += "\n\n"; - } else if (i < lines.size() - 1) { - line += "\n"; - } - markdown += line; - } - return markdown; -} -} // namespace lsp - -#endif diff --git a/modules/gdscript/tests/gdscript_test_runner.h b/modules/gdscript/tests/gdscript_test_runner.h index ee21afd9c9..033d2fcad1 100644 --- a/modules/gdscript/tests/gdscript_test_runner.h +++ b/modules/gdscript/tests/gdscript_test_runner.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef GDSCRIPT_TEST_H -#define GDSCRIPT_TEST_H +#ifndef GDSCRIPT_TEST_RUNNER_H +#define GDSCRIPT_TEST_RUNNER_H #include "../gdscript.h" #include "core/error/error_macros.h" @@ -123,4 +123,4 @@ public: } // namespace GDScriptTests -#endif // GDSCRIPT_TEST_H +#endif // GDSCRIPT_TEST_RUNNER_H diff --git a/modules/gltf/extensions/gltf_spec_gloss.h b/modules/gltf/extensions/gltf_spec_gloss.h index f8a431bdce..a45fa4296c 100644 --- a/modules/gltf/extensions/gltf_spec_gloss.h +++ b/modules/gltf/extensions/gltf_spec_gloss.h @@ -64,4 +64,5 @@ public: Ref get_spec_gloss_img(); void set_spec_gloss_img(Ref p_spec_gloss_img); }; + #endif // GLTF_SPEC_GLOSS_H diff --git a/modules/gltf/gltf_document_extension_convert_importer_mesh.h b/modules/gltf/gltf_document_extension_convert_importer_mesh.h index b7798c9517..00e664e73f 100644 --- a/modules/gltf/gltf_document_extension_convert_importer_mesh.h +++ b/modules/gltf/gltf_document_extension_convert_importer_mesh.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef GLTF_EXTENSION_EDITOR_H -#define GLTF_EXTENSION_EDITOR_H +#ifndef GLTF_DOCUMENT_EXTENSION_CONVERT_IMPORTER_MESH_H +#define GLTF_DOCUMENT_EXTENSION_CONVERT_IMPORTER_MESH_H #include "gltf_document_extension.h" @@ -46,4 +46,5 @@ protected: public: Error import_post(Ref p_state, Node *p_root) override; }; -#endif // GLTF_EXTENSION_EDITOR_H + +#endif // GLTF_DOCUMENT_EXTENSION_CONVERT_IMPORTER_MESH_H diff --git a/modules/gltf/gltf_state.h b/modules/gltf/gltf_state.h index 257de5c4e3..d2a4948f06 100644 --- a/modules/gltf/gltf_state.h +++ b/modules/gltf/gltf_state.h @@ -192,4 +192,5 @@ public: // this->material_cache = p_material_cache; //} }; + #endif // GLTF_STATE_H diff --git a/modules/gltf/structures/gltf_accessor.h b/modules/gltf/structures/gltf_accessor.h index c9abbda668..bfb71d57fe 100644 --- a/modules/gltf/structures/gltf_accessor.h +++ b/modules/gltf/structures/gltf_accessor.h @@ -101,4 +101,5 @@ public: int get_sparse_values_byte_offset(); void set_sparse_values_byte_offset(int p_sparse_values_byte_offset); }; + #endif // GLTF_ACCESSOR_H diff --git a/modules/gltf/structures/gltf_animation.h b/modules/gltf/structures/gltf_animation.h index 8688ddb937..3777f579f6 100644 --- a/modules/gltf/structures/gltf_animation.h +++ b/modules/gltf/structures/gltf_animation.h @@ -71,4 +71,5 @@ private: bool loop = false; HashMap tracks; }; + #endif // GLTF_ANIMATION_H diff --git a/modules/gltf/structures/gltf_buffer_view.h b/modules/gltf/structures/gltf_buffer_view.h index dada1e87b3..b1f500de25 100644 --- a/modules/gltf/structures/gltf_buffer_view.h +++ b/modules/gltf/structures/gltf_buffer_view.h @@ -65,4 +65,5 @@ public: void set_indices(bool p_indices); // matrices need to be transformed to this }; + #endif // GLTF_BUFFER_VIEW_H diff --git a/modules/gltf/structures/gltf_camera.h b/modules/gltf/structures/gltf_camera.h index c696d4cc6b..b7df741825 100644 --- a/modules/gltf/structures/gltf_camera.h +++ b/modules/gltf/structures/gltf_camera.h @@ -55,4 +55,5 @@ public: float get_depth_near() const { return depth_near; } void set_depth_near(float p_val) { depth_near = p_val; } }; + #endif // GLTF_CAMERA_H diff --git a/modules/gltf/structures/gltf_node.h b/modules/gltf/structures/gltf_node.h index 67a268dd1a..1a57ea32e2 100644 --- a/modules/gltf/structures/gltf_node.h +++ b/modules/gltf/structures/gltf_node.h @@ -97,4 +97,5 @@ public: GLTFLightIndex get_light(); void set_light(GLTFLightIndex p_light); }; + #endif // GLTF_NODE_H diff --git a/modules/gltf/structures/gltf_skeleton.h b/modules/gltf/structures/gltf_skeleton.h index 05bfa37a06..db88623213 100644 --- a/modules/gltf/structures/gltf_skeleton.h +++ b/modules/gltf/structures/gltf_skeleton.h @@ -98,4 +98,5 @@ public: int32_t get_bone_attachment_count(); }; + #endif // GLTF_SKELETON_H diff --git a/modules/gltf/structures/gltf_skin.h b/modules/gltf/structures/gltf_skin.h index 1127c20a3b..59b6a300ac 100644 --- a/modules/gltf/structures/gltf_skin.h +++ b/modules/gltf/structures/gltf_skin.h @@ -106,4 +106,5 @@ public: Ref get_godot_skin(); void set_godot_skin(Ref p_godot_skin); }; + #endif // GLTF_SKIN_H diff --git a/modules/hdr/image_loader_hdr.h b/modules/hdr/image_loader_hdr.h index f2d53cc206..16c0816562 100644 --- a/modules/hdr/image_loader_hdr.h +++ b/modules/hdr/image_loader_hdr.h @@ -40,4 +40,4 @@ public: ImageLoaderHDR(); }; -#endif +#endif // IMAGE_LOADER_HDR_H diff --git a/modules/jpg/image_loader_jpegd.h b/modules/jpg/image_loader_jpegd.h index de9700faec..6d631446e7 100644 --- a/modules/jpg/image_loader_jpegd.h +++ b/modules/jpg/image_loader_jpegd.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef IMAGE_LOADER_JPG_H -#define IMAGE_LOADER_JPG_H +#ifndef IMAGE_LOADER_JPEGD_H +#define IMAGE_LOADER_JPEGD_H #include "core/io/image_loader.h" @@ -40,4 +40,4 @@ public: ImageLoaderJPG(); }; -#endif +#endif // IMAGE_LOADER_JPEGD_H diff --git a/modules/jsonrpc/jsonrpc.h b/modules/jsonrpc/jsonrpc.h index f57d6aef42..1d9f2771b2 100644 --- a/modules/jsonrpc/jsonrpc.h +++ b/modules/jsonrpc/jsonrpc.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef GODOT_JSON_RPC_H -#define GODOT_JSON_RPC_H +#ifndef JSONRPC_H +#define JSONRPC_H #include "core/object/class_db.h" #include "core/variant/variant.h" @@ -67,4 +67,4 @@ public: VARIANT_ENUM_CAST(JSONRPC::ErrorCode); -#endif +#endif // JSONRPC_H diff --git a/modules/lightmapper_rd/lightmapper_rd.h b/modules/lightmapper_rd/lightmapper_rd.h index 8cb4b58a18..88860ad0d4 100644 --- a/modules/lightmapper_rd/lightmapper_rd.h +++ b/modules/lightmapper_rd/lightmapper_rd.h @@ -256,4 +256,4 @@ public: LightmapperRD(); }; -#endif // LIGHTMAPPER_H +#endif // LIGHTMAPPER_RD_H diff --git a/modules/lightmapper_rd/register_types.h b/modules/lightmapper_rd/register_types.h index 42e0ebbf77..9b72ff45d7 100644 --- a/modules/lightmapper_rd/register_types.h +++ b/modules/lightmapper_rd/register_types.h @@ -36,4 +36,4 @@ void initialize_lightmapper_rd_module(ModuleInitializationLevel p_level); void uninitialize_lightmapper_rd_module(ModuleInitializationLevel p_level); -#endif // XATLAS_UNWRAP_REGISTER_TYPES_H +#endif // LIGHTMAPPER_RD_REGISTER_TYPES_H diff --git a/modules/mbedtls/dtls_server_mbedtls.h b/modules/mbedtls/dtls_server_mbedtls.h index 29370062c4..a6626c9f65 100644 --- a/modules/mbedtls/dtls_server_mbedtls.h +++ b/modules/mbedtls/dtls_server_mbedtls.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef MBED_DTLS_SERVER_H -#define MBED_DTLS_SERVER_H +#ifndef DTLS_SERVER_MBEDTLS_H +#define DTLS_SERVER_MBEDTLS_H #include "core/io/dtls_server.h" #include "ssl_context_mbedtls.h" @@ -54,4 +54,4 @@ public: ~DTLSServerMbedTLS(); }; -#endif // MBED_DTLS_SERVER_H +#endif // DTLS_SERVER_MBEDTLS_H diff --git a/modules/mbedtls/ssl_context_mbedtls.h b/modules/mbedtls/ssl_context_mbedtls.h index dd49792abd..5883388311 100644 --- a/modules/mbedtls/ssl_context_mbedtls.h +++ b/modules/mbedtls/ssl_context_mbedtls.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef SSL_CONTEXT_MBED_TLS_H -#define SSL_CONTEXT_MBED_TLS_H +#ifndef SSL_CONTEXT_MBEDTLS_H +#define SSL_CONTEXT_MBEDTLS_H #include "crypto_mbedtls.h" @@ -90,4 +90,4 @@ public: ~SSLContextMbedTLS(); }; -#endif // SSL_CONTEXT_MBED_TLS_H +#endif // SSL_CONTEXT_MBEDTLS_H diff --git a/modules/mbedtls/stream_peer_mbedtls.h b/modules/mbedtls/stream_peer_mbedtls.h index 7660410e04..68b07feea9 100644 --- a/modules/mbedtls/stream_peer_mbedtls.h +++ b/modules/mbedtls/stream_peer_mbedtls.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef STREAM_PEER_OPEN_SSL_H -#define STREAM_PEER_OPEN_SSL_H +#ifndef STREAM_PEER_MBEDTLS_H +#define STREAM_PEER_MBEDTLS_H #include "core/io/stream_peer_ssl.h" #include "ssl_context_mbedtls.h" @@ -76,4 +76,4 @@ public: ~StreamPeerMbedTLS(); }; -#endif // STREAM_PEER_SSL_H +#endif // STREAM_PEER_MBEDTLS_H diff --git a/modules/meshoptimizer/register_types.h b/modules/meshoptimizer/register_types.h index 99c71efceb..3a84aab7bc 100644 --- a/modules/meshoptimizer/register_types.h +++ b/modules/meshoptimizer/register_types.h @@ -36,4 +36,4 @@ void initialize_meshoptimizer_module(ModuleInitializationLevel p_level); void uninitialize_meshoptimizer_module(ModuleInitializationLevel p_level); -#endif // PVR_REGISTER_TYPES_H +#endif // MESHOPTIMIZER_REGISTER_TYPES_H diff --git a/modules/mono/editor/editor_internal_calls.h b/modules/mono/editor/editor_internal_calls.h index a899634d57..8262ac211a 100644 --- a/modules/mono/editor/editor_internal_calls.h +++ b/modules/mono/editor/editor_internal_calls.h @@ -28,9 +28,9 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef EDITOR_INTERNAL_CALL_H -#define EDITOR_INTERNAL_CALL_H +#ifndef EDITOR_INTERNAL_CALLS_H +#define EDITOR_INTERNAL_CALLS_H void register_editor_internal_calls(); -#endif // EDITOR_INTERNAL_CALL_H +#endif // EDITOR_INTERNAL_CALLS_H diff --git a/modules/mono/glue/glue_header.h b/modules/mono/glue/glue_header.h index 9638b23410..f9ad1a9893 100644 --- a/modules/mono/glue/glue_header.h +++ b/modules/mono/glue/glue_header.h @@ -28,6 +28,9 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ +#ifndef GLUE_HEADER_H +#define GLUE_HEADER_H + #ifdef MONO_GLUE_ENABLED #include "../mono_gd/gd_mono_marshal.h" @@ -84,3 +87,5 @@ void godot_register_glue_header_icalls() { #include "arguments_vector.h" #endif // MONO_GLUE_ENABLED + +#endif // GLUE_HEADER_H diff --git a/modules/mono/mono_gc_handle.h b/modules/mono/mono_gc_handle.h index ab9e508c99..e2aff1d19d 100644 --- a/modules/mono/mono_gc_handle.h +++ b/modules/mono/mono_gc_handle.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef CSHARP_GC_HANDLE_H -#define CSHARP_GC_HANDLE_H +#ifndef MONO_GC_HANDLE_H +#define MONO_GC_HANDLE_H #include @@ -104,4 +104,4 @@ public: ~MonoGCHandleRef() { release(); } }; -#endif // CSHARP_GC_HANDLE_H +#endif // MONO_GC_HANDLE_H diff --git a/modules/mono/mono_gd/gd_mono_field.h b/modules/mono/mono_gd/gd_mono_field.h index 87ef245f3f..1d30f7a369 100644 --- a/modules/mono/mono_gd/gd_mono_field.h +++ b/modules/mono/mono_gd/gd_mono_field.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef GDMONOFIELD_H -#define GDMONOFIELD_H +#ifndef GD_MONO_FIELD_H +#define GD_MONO_FIELD_H #include "gd_mono.h" #include "gd_mono_header.h" @@ -75,4 +75,4 @@ public: ~GDMonoField(); }; -#endif // GDMONOFIELD_H +#endif // GD_MONO_FIELD_H diff --git a/modules/mono/mono_gd/gd_mono_marshal.h b/modules/mono/mono_gd/gd_mono_marshal.h index b25e7c916c..3b6fd25d71 100644 --- a/modules/mono/mono_gd/gd_mono_marshal.h +++ b/modules/mono/mono_gd/gd_mono_marshal.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef GDMONOMARSHAL_H -#define GDMONOMARSHAL_H +#ifndef GD_MONO_MARSHAL_H +#define GD_MONO_MARSHAL_H #include "core/variant/variant.h" @@ -602,4 +602,4 @@ DECL_TYPE_MARSHAL_TEMPLATES(Plane) #define MARSHALLED_OUT(m_type, m_from) (GDMonoMarshal::marshalled_out_##m_type(m_from)) } // namespace GDMonoMarshal -#endif // GDMONOMARSHAL_H +#endif // GD_MONO_MARSHAL_H diff --git a/modules/mono/mono_gd/gd_mono_utils.h b/modules/mono/mono_gd/gd_mono_utils.h index 246a1cd31e..300cacfa4b 100644 --- a/modules/mono/mono_gd/gd_mono_utils.h +++ b/modules/mono/mono_gd/gd_mono_utils.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef GD_MONOUTILS_H -#define GD_MONOUTILS_H +#ifndef GD_MONO_UTILS_H +#define GD_MONO_UTILS_H #include @@ -202,4 +202,4 @@ void add_internal_call(const char *p_name, R (*p_func)(P...)) { #define GD_MONO_ASSERT_THREAD_ATTACHED ((void)0) #endif -#endif // GD_MONOUTILS_H +#endif // GD_MONO_UTILS_H diff --git a/modules/mono/utils/macos_utils.h b/modules/mono/utils/macos_utils.h index 7892cb2785..ca4957f5a7 100644 --- a/modules/mono/utils/macos_utils.h +++ b/modules/mono/utils/macos_utils.h @@ -30,8 +30,8 @@ #include "core/string/ustring.h" -#ifndef MACOS_UTILS_H -#define MACOS_UTILS_H +#ifndef MONO_MACOS_UTILS_H +#define MONO_MACOS_UTILS_H #ifdef MACOS_ENABLED @@ -39,4 +39,4 @@ bool macos_is_app_bundle_installed(const String &p_bundle_id); #endif -#endif // MACOS_UTILS_H +#endif // MONO_MACOS_UTILS_H diff --git a/modules/mono/utils/macros.h b/modules/mono/utils/macros.h index 2ca1a4cbf1..b7bd9a2495 100644 --- a/modules/mono/utils/macros.h +++ b/modules/mono/utils/macros.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef UTIL_MACROS_H -#define UTIL_MACROS_H +#ifndef MONO_MACROS_H +#define MONO_MACROS_H #define _GD_VARNAME_CONCAT_B_(m_ignore, m_name) m_name #define _GD_VARNAME_CONCAT_A_(m_a, m_b, m_c) _GD_VARNAME_CONCAT_B_(hello there, m_a##m_b##m_c) @@ -69,4 +69,4 @@ public: #define SCOPE_EXIT \ auto GD_UNIQUE_NAME(gd_scope_exit) = gdmono::ScopeExitAux() + [=]() -> void -#endif // UTIL_MACROS_H +#endif // MONO_MACROS_H diff --git a/modules/mono/utils/path_utils.h b/modules/mono/utils/path_utils.h index a8cd8daf04..9a2c757361 100644 --- a/modules/mono/utils/path_utils.h +++ b/modules/mono/utils/path_utils.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef PATH_UTILS_H -#define PATH_UTILS_H +#ifndef MONO_PATH_UTILS_H +#define MONO_PATH_UTILS_H #include "core/string/string_builder.h" #include "core/string/ustring.h" @@ -58,4 +58,4 @@ String realpath(const String &p_path); String relative_to(const String &p_path, const String &p_relative_to); } // namespace path -#endif // PATH_UTILS_H +#endif // MONO_PATH_UTILS_H diff --git a/modules/mono/utils/string_utils.h b/modules/mono/utils/string_utils.h index d79888716a..fa4c5e89f4 100644 --- a/modules/mono/utils/string_utils.h +++ b/modules/mono/utils/string_utils.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef STRING_FORMAT_H -#define STRING_FORMAT_H +#ifndef MONO_STRING_UTILS_H +#define MONO_STRING_UTILS_H #include "core/string/ustring.h" #include "core/variant/variant.h" @@ -59,4 +59,4 @@ String str_format(const char *p_format, va_list p_list) _PRINTF_FORMAT_ATTRIBUTE char *str_format_new(const char *p_format, ...) _PRINTF_FORMAT_ATTRIBUTE_1_2; char *str_format_new(const char *p_format, va_list p_list) _PRINTF_FORMAT_ATTRIBUTE_1_0; -#endif // STRING_FORMAT_H +#endif // MONO_STRING_UTILS_H diff --git a/modules/openxr/action_map/openxr_action.h b/modules/openxr/action_map/openxr_action.h index 5e57f89133..a7c1c9988c 100644 --- a/modules/openxr/action_map/openxr_action.h +++ b/modules/openxr/action_map/openxr_action.h @@ -84,4 +84,4 @@ public: VARIANT_ENUM_CAST(OpenXRAction::ActionType); -#endif // !OPENXR_ACTION_H +#endif // OPENXR_ACTION_H diff --git a/modules/openxr/action_map/openxr_action_map.h b/modules/openxr/action_map/openxr_action_map.h index dcd8fc71aa..8659cd3942 100644 --- a/modules/openxr/action_map/openxr_action_map.h +++ b/modules/openxr/action_map/openxr_action_map.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef OPENXR_ACTION_SETS_H -#define OPENXR_ACTION_SETS_H +#ifndef OPENXR_ACTION_MAP_H +#define OPENXR_ACTION_MAP_H #include "core/io/resource.h" @@ -79,4 +79,4 @@ public: ~OpenXRActionMap(); }; -#endif // !OPENXR_ACTION_SETS_H +#endif // OPENXR_ACTION_MAP_H diff --git a/modules/openxr/action_map/openxr_action_set.h b/modules/openxr/action_map/openxr_action_set.h index b1d7168894..2ef7ba4c32 100644 --- a/modules/openxr/action_map/openxr_action_set.h +++ b/modules/openxr/action_map/openxr_action_set.h @@ -72,4 +72,4 @@ public: ~OpenXRActionSet(); }; -#endif // !OPENXR_ACTION_SET_H +#endif // OPENXR_ACTION_SET_H diff --git a/modules/openxr/action_map/openxr_defs.h b/modules/openxr/action_map/openxr_defs.h index 9bdd9a6ded..446e6eb9c6 100644 --- a/modules/openxr/action_map/openxr_defs.h +++ b/modules/openxr/action_map/openxr_defs.h @@ -121,4 +121,4 @@ public: static PackedStringArray get_interaction_profile_paths(); }; -#endif // !OPENXR_DEFS_H +#endif // OPENXR_DEFS_H diff --git a/modules/openxr/action_map/openxr_interaction_profile.h b/modules/openxr/action_map/openxr_interaction_profile.h index 46b1bda50f..c77fd490bb 100644 --- a/modules/openxr/action_map/openxr_interaction_profile.h +++ b/modules/openxr/action_map/openxr_interaction_profile.h @@ -98,4 +98,4 @@ public: ~OpenXRInteractionProfile(); }; -#endif // !OPENXR_INTERACTION_PROFILE_H +#endif // OPENXR_INTERACTION_PROFILE_H diff --git a/modules/openxr/editor/openxr_action_editor.h b/modules/openxr/editor/openxr_action_editor.h index 6e1b7ab779..6cf098cf08 100644 --- a/modules/openxr/editor/openxr_action_editor.h +++ b/modules/openxr/editor/openxr_action_editor.h @@ -64,4 +64,4 @@ public: OpenXRActionEditor(Ref p_action); }; -#endif // !OPENXR_ACTION_EDITOR_H +#endif // OPENXR_ACTION_EDITOR_H diff --git a/modules/openxr/editor/openxr_action_map_editor.h b/modules/openxr/editor/openxr_action_map_editor.h index dfc941b500..a19bc90f56 100644 --- a/modules/openxr/editor/openxr_action_map_editor.h +++ b/modules/openxr/editor/openxr_action_map_editor.h @@ -97,4 +97,4 @@ public: ~OpenXRActionMapEditor(); }; -#endif // !OPENXR_ACTION_MAP_EDITOR_H +#endif // OPENXR_ACTION_MAP_EDITOR_H diff --git a/modules/openxr/editor/openxr_action_set_editor.h b/modules/openxr/editor/openxr_action_set_editor.h index f3960dcbf9..d8c85d03dd 100644 --- a/modules/openxr/editor/openxr_action_set_editor.h +++ b/modules/openxr/editor/openxr_action_set_editor.h @@ -85,4 +85,4 @@ public: OpenXRActionSetEditor(Ref p_action_map, Ref p_action_set); }; -#endif // !OPENXR_ACTION_SET_EDITOR_H +#endif // OPENXR_ACTION_SET_EDITOR_H diff --git a/modules/openxr/editor/openxr_editor_plugin.h b/modules/openxr/editor/openxr_editor_plugin.h index af8ee7d54c..ce230ee95b 100644 --- a/modules/openxr/editor/openxr_editor_plugin.h +++ b/modules/openxr/editor/openxr_editor_plugin.h @@ -50,4 +50,4 @@ public: ~OpenXREditorPlugin(); }; -#endif // !OPENXR_EDITOR_PLUGIN_H +#endif // OPENXR_EDITOR_PLUGIN_H diff --git a/modules/openxr/editor/openxr_interaction_profile_editor.h b/modules/openxr/editor/openxr_interaction_profile_editor.h index f50da1a003..20a37a80eb 100644 --- a/modules/openxr/editor/openxr_interaction_profile_editor.h +++ b/modules/openxr/editor/openxr_interaction_profile_editor.h @@ -80,4 +80,4 @@ public: OpenXRInteractionProfileEditor(Ref p_action_map, Ref p_interaction_profile); }; -#endif // !OPENXR_INTERACTION_PROFILE_EDITOR_H +#endif // OPENXR_INTERACTION_PROFILE_EDITOR_H diff --git a/modules/openxr/editor/openxr_select_action_dialog.h b/modules/openxr/editor/openxr_select_action_dialog.h index ea2c30373b..cbe1380e18 100644 --- a/modules/openxr/editor/openxr_select_action_dialog.h +++ b/modules/openxr/editor/openxr_select_action_dialog.h @@ -64,4 +64,4 @@ public: OpenXRSelectActionDialog(Ref p_action_map); }; -#endif // !OPENXR_SELECT_ACTION_DIALOG_H +#endif // OPENXR_SELECT_ACTION_DIALOG_H diff --git a/modules/openxr/editor/openxr_select_interaction_profile_dialog.h b/modules/openxr/editor/openxr_select_interaction_profile_dialog.h index d177861ff3..54bfe3120a 100644 --- a/modules/openxr/editor/openxr_select_interaction_profile_dialog.h +++ b/modules/openxr/editor/openxr_select_interaction_profile_dialog.h @@ -63,4 +63,4 @@ public: OpenXRSelectInteractionProfileDialog(); }; -#endif // !OPENXR_SELECT_INTERACTION_PROFILE_DIALOG_H +#endif // OPENXR_SELECT_INTERACTION_PROFILE_DIALOG_H diff --git a/modules/openxr/extensions/openxr_android_extension.h b/modules/openxr/extensions/openxr_android_extension.h index e102197a55..88b0e310e7 100644 --- a/modules/openxr/extensions/openxr_android_extension.h +++ b/modules/openxr/extensions/openxr_android_extension.h @@ -44,4 +44,4 @@ private: static OpenXRAndroidExtension *singleton; }; -#endif // !OPENXR_ANDROID_EXTENSION_H +#endif // OPENXR_ANDROID_EXTENSION_H diff --git a/modules/openxr/extensions/openxr_extension_wrapper.h b/modules/openxr/extensions/openxr_extension_wrapper.h index 9e03d9c119..ecc6e0dd4e 100644 --- a/modules/openxr/extensions/openxr_extension_wrapper.h +++ b/modules/openxr/extensions/openxr_extension_wrapper.h @@ -104,4 +104,4 @@ public: OpenXRExtensionWrapper(p_openxr_api){}; }; -#endif // ~OPENXR_EXTENSION_WRAPPER_H +#endif // OPENXR_EXTENSION_WRAPPER_H diff --git a/modules/openxr/extensions/openxr_htc_vive_tracker_extension.h b/modules/openxr/extensions/openxr_htc_vive_tracker_extension.h index 7670bc074b..7f37351f27 100644 --- a/modules/openxr/extensions/openxr_htc_vive_tracker_extension.h +++ b/modules/openxr/extensions/openxr_htc_vive_tracker_extension.h @@ -49,4 +49,4 @@ private: bool available = false; }; -#endif // !OPENXR_HTC_VIVE_TRACKER_EXTENSION_H +#endif // OPENXR_HTC_VIVE_TRACKER_EXTENSION_H diff --git a/modules/openxr/extensions/openxr_vulkan_extension.h b/modules/openxr/extensions/openxr_vulkan_extension.h index 163540a7ba..5dddc4b9c9 100644 --- a/modules/openxr/extensions/openxr_vulkan_extension.h +++ b/modules/openxr/extensions/openxr_vulkan_extension.h @@ -90,4 +90,4 @@ private: XrResult xrCreateVulkanDeviceKHR(XrInstance p_instance, const XrVulkanDeviceCreateInfoKHR *p_create_info, VkDevice *r_device, VkResult *r_result); }; -#endif // !OPENXR_VULKAN_EXTENSION_H +#endif // OPENXR_VULKAN_EXTENSION_H diff --git a/modules/openxr/openxr_api.h b/modules/openxr/openxr_api.h index 804c7f7239..dc224c4237 100644 --- a/modules/openxr/openxr_api.h +++ b/modules/openxr/openxr_api.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef OPENXR_DRIVER_H -#define OPENXR_DRIVER_H +#ifndef OPENXR_API_H +#define OPENXR_API_H #include "core/error/error_macros.h" #include "core/math/projection.h" @@ -292,4 +292,4 @@ public: ~OpenXRAPI(); }; -#endif // !OPENXR_DRIVER_H +#endif // OPENXR_API_H diff --git a/modules/openxr/openxr_interface.h b/modules/openxr/openxr_interface.h index 9dfa9fc2bb..a99012fd1d 100644 --- a/modules/openxr/openxr_interface.h +++ b/modules/openxr/openxr_interface.h @@ -140,4 +140,4 @@ public: ~OpenXRInterface(); }; -#endif // !OPENXR_INTERFACE_H +#endif // OPENXR_INTERFACE_H diff --git a/modules/openxr/openxr_util.h b/modules/openxr/openxr_util.h index 4371b74d2f..a5cc7cd512 100644 --- a/modules/openxr/openxr_util.h +++ b/modules/openxr/openxr_util.h @@ -44,4 +44,4 @@ public: static String make_xr_version_string(XrVersion p_version); }; -#endif // !OPENXR_UTIL_H +#endif // OPENXR_UTIL_H diff --git a/modules/raycast/lightmap_raycaster.h b/modules/raycast/lightmap_raycaster.h index 4266b46ea8..2e9f59dda4 100644 --- a/modules/raycast/lightmap_raycaster.h +++ b/modules/raycast/lightmap_raycaster.h @@ -74,4 +74,4 @@ public: ~LightmapRaycasterEmbree(); }; -#endif +#endif // LIGHTMAP_RAYCASTER_H diff --git a/modules/raycast/raycast_occlusion_cull.h b/modules/raycast/raycast_occlusion_cull.h index 42433afed2..8c8b444309 100644 --- a/modules/raycast/raycast_occlusion_cull.h +++ b/modules/raycast/raycast_occlusion_cull.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef OCCLUSION_CULL_RAYCASTER_H -#define OCCLUSION_CULL_RAYCASTER_H +#ifndef RAYCAST_OCCLUSION_CULL_H +#define RAYCAST_OCCLUSION_CULL_H #include "core/io/image.h" #include "core/math/projection.h" @@ -192,4 +192,4 @@ public: ~RaycastOcclusionCull(); }; -#endif // OCCLUSION_CULL_RAYCASTER_H +#endif // RAYCAST_OCCLUSION_CULL_H diff --git a/modules/raycast/static_raycaster.h b/modules/raycast/static_raycaster.h index e2909f9b56..607a392683 100644 --- a/modules/raycast/static_raycaster.h +++ b/modules/raycast/static_raycaster.h @@ -61,4 +61,4 @@ public: ~StaticRaycasterEmbree(); }; -#endif +#endif // STATIC_RAYCASTER_H diff --git a/modules/text_server_adv/script_iterator.h b/modules/text_server_adv/script_iterator.h index 2bd045b91a..025b62c6fb 100644 --- a/modules/text_server_adv/script_iterator.h +++ b/modules/text_server_adv/script_iterator.h @@ -75,4 +75,4 @@ public: ScriptIterator(const String &p_string, int p_start, int p_length); }; -#endif //SCRIPT_ITERATOR_H +#endif // SCRIPT_ITERATOR_H diff --git a/modules/text_server_fb/text_server_fb.h b/modules/text_server_fb/text_server_fb.h index 497403afd7..b3ec4ffb38 100644 --- a/modules/text_server_fb/text_server_fb.h +++ b/modules/text_server_fb/text_server_fb.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef TEXT_SERVER_FALLBACK_H -#define TEXT_SERVER_FALLBACK_H +#ifndef TEXT_SERVER_FB_H +#define TEXT_SERVER_FB_H /*************************************************************************/ /* Fallback Text Server provides simplified TS functionality, without */ @@ -586,4 +586,4 @@ public: ~TextServerFallback(); }; -#endif // TEXT_SERVER_FALLBACK_H +#endif // TEXT_SERVER_FB_H diff --git a/modules/theora/video_stream_theora.h b/modules/theora/video_stream_theora.h index dd69bf066a..00d799dc24 100644 --- a/modules/theora/video_stream_theora.h +++ b/modules/theora/video_stream_theora.h @@ -192,4 +192,4 @@ public: virtual String get_resource_type(const String &p_path) const; }; -#endif +#endif // VIDEO_STREAM_THEORA_H diff --git a/modules/tinyexr/image_loader_tinyexr.h b/modules/tinyexr/image_loader_tinyexr.h index c147861c26..0d3de93956 100644 --- a/modules/tinyexr/image_loader_tinyexr.h +++ b/modules/tinyexr/image_loader_tinyexr.h @@ -40,4 +40,4 @@ public: ImageLoaderTinyEXR(); }; -#endif +#endif // IMAGE_LOADER_TINYEXR_H diff --git a/modules/upnp/upnp.h b/modules/upnp/upnp.h index 6d87b42c56..be7ede3ee0 100644 --- a/modules/upnp/upnp.h +++ b/modules/upnp/upnp.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef GODOT_UPNP_H -#define GODOT_UPNP_H +#ifndef UPNP_H +#define UPNP_H #include "core/object/ref_counted.h" @@ -121,4 +121,4 @@ public: VARIANT_ENUM_CAST(UPNP::UPNPResult) -#endif // GODOT_UPNP_H +#endif // UPNP_H diff --git a/modules/upnp/upnp_device.h b/modules/upnp/upnp_device.h index 18491dce27..1c9dc82df5 100644 --- a/modules/upnp/upnp_device.h +++ b/modules/upnp/upnp_device.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef GODOT_UPNP_DEVICE_H -#define GODOT_UPNP_DEVICE_H +#ifndef UPNP_DEVICE_H +#define UPNP_DEVICE_H #include "core/object/ref_counted.h" @@ -90,4 +90,4 @@ private: VARIANT_ENUM_CAST(UPNPDevice::IGDStatus) -#endif // GODOT_UPNP_DEVICE_H +#endif // UPNP_DEVICE_H diff --git a/modules/visual_script/editor/visual_script_editor.h b/modules/visual_script/editor/visual_script_editor.h index fd59d22cbe..a6df7bba73 100644 --- a/modules/visual_script/editor/visual_script_editor.h +++ b/modules/visual_script/editor/visual_script_editor.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef VISUALSCRIPT_EDITOR_H -#define VISUALSCRIPT_EDITOR_H +#ifndef VISUAL_SCRIPT_EDITOR_H +#define VISUAL_SCRIPT_EDITOR_H #include "../visual_script.h" #include "editor/create_dialog.h" @@ -374,4 +374,4 @@ public: #endif -#endif // VISUALSCRIPT_EDITOR_H +#endif // VISUAL_SCRIPT_EDITOR_H diff --git a/modules/visual_script/editor/visual_script_property_selector.h b/modules/visual_script/editor/visual_script_property_selector.h index 91d81bba47..41f8eea735 100644 --- a/modules/visual_script/editor/visual_script_property_selector.h +++ b/modules/visual_script/editor/visual_script_property_selector.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef VISUALSCRIPT_PROPERTYSELECTOR_H -#define VISUALSCRIPT_PROPERTYSELECTOR_H +#ifndef VISUAL_SCRIPT_PROPERTY_SELECTOR_H +#define VISUAL_SCRIPT_PROPERTY_SELECTOR_H #include "../visual_script.h" #include "editor/editor_help.h" @@ -226,4 +226,4 @@ public: SearchRunner(VisualScriptPropertySelector *p_selector_ui, Tree *p_results_tree); }; -#endif // VISUALSCRIPT_PROPERTYSELECTOR_H +#endif // VISUAL_SCRIPT_PROPERTY_SELECTOR_H diff --git a/modules/visual_script/visual_script_expression.h b/modules/visual_script/visual_script_expression.h index c93eb0686b..7e10f98f36 100644 --- a/modules/visual_script/visual_script_expression.h +++ b/modules/visual_script/visual_script_expression.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef VISUALSCRIPTEXPRESSION_H -#define VISUALSCRIPTEXPRESSION_H +#ifndef VISUAL_SCRIPT_EXPRESSION_H +#define VISUAL_SCRIPT_EXPRESSION_H #include "visual_script.h" #include "visual_script_builtin_funcs.h" @@ -281,4 +281,4 @@ public: void register_visual_script_expression_node(); -#endif // VISUALSCRIPTEXPRESSION_H +#endif // VISUAL_SCRIPT_EXPRESSION_H diff --git a/modules/vorbis/audio_stream_ogg_vorbis.h b/modules/vorbis/audio_stream_ogg_vorbis.h index 22c2eb4d73..9b6d928d87 100644 --- a/modules/vorbis/audio_stream_ogg_vorbis.h +++ b/modules/vorbis/audio_stream_ogg_vorbis.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef AUDIO_STREAM_LIBVORBIS_H -#define AUDIO_STREAM_LIBVORBIS_H +#ifndef AUDIO_STREAM_OGG_VORBIS_H +#define AUDIO_STREAM_OGG_VORBIS_H #include "core/variant/variant.h" #include "modules/ogg/ogg_packet_sequence.h" @@ -153,4 +153,4 @@ public: virtual ~AudioStreamOGGVorbis(); }; -#endif // AUDIO_STREAM_LIBVORBIS_H +#endif // AUDIO_STREAM_OGG_VORBIS_H diff --git a/modules/webp/image_loader_webp.h b/modules/webp/image_loader_webp.h index 448f683eb3..9a5dc6cd7c 100644 --- a/modules/webp/image_loader_webp.h +++ b/modules/webp/image_loader_webp.h @@ -40,4 +40,4 @@ public: ImageLoaderWebP(); }; -#endif +#endif // IMAGE_LOADER_WEBP_H diff --git a/modules/webrtc/webrtc_data_channel.h b/modules/webrtc/webrtc_data_channel.h index 75e29283ec..9d20ad3266 100644 --- a/modules/webrtc/webrtc_data_channel.h +++ b/modules/webrtc/webrtc_data_channel.h @@ -81,4 +81,5 @@ public: VARIANT_ENUM_CAST(WebRTCDataChannel::WriteMode); VARIANT_ENUM_CAST(WebRTCDataChannel::ChannelState); + #endif // WEBRTC_DATA_CHANNEL_H diff --git a/modules/webrtc/webrtc_multiplayer_peer.h b/modules/webrtc/webrtc_multiplayer_peer.h index 97550a3e9d..d4ed7ef7de 100644 --- a/modules/webrtc/webrtc_multiplayer_peer.h +++ b/modules/webrtc/webrtc_multiplayer_peer.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef WEBRTC_MULTIPLAYER_H -#define WEBRTC_MULTIPLAYER_H +#ifndef WEBRTC_MULTIPLAYER_PEER_H +#define WEBRTC_MULTIPLAYER_PEER_H #include "core/multiplayer/multiplayer_peer.h" #include "webrtc_peer_connection.h" @@ -106,4 +106,4 @@ public: ConnectionStatus get_connection_status() const override; }; -#endif // WEBRTC_MULTIPLAYER_H +#endif // WEBRTC_MULTIPLAYER_PEER_H diff --git a/modules/webrtc/webrtc_peer_connection.h b/modules/webrtc/webrtc_peer_connection.h index 8c324d0942..122ea3d00f 100644 --- a/modules/webrtc/webrtc_peer_connection.h +++ b/modules/webrtc/webrtc_peer_connection.h @@ -74,4 +74,5 @@ public: }; VARIANT_ENUM_CAST(WebRTCPeerConnection::ConnectionState); + #endif // WEBRTC_PEER_CONNECTION_H diff --git a/modules/websocket/emws_client.h b/modules/websocket/emws_client.h index ca327a56fa..b71fd78124 100644 --- a/modules/websocket/emws_client.h +++ b/modules/websocket/emws_client.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef EMWSCLIENT_H -#define EMWSCLIENT_H +#ifndef EMWS_CLIENT_H +#define EMWS_CLIENT_H #ifdef JAVASCRIPT_ENABLED @@ -68,4 +68,4 @@ public: #endif // JAVASCRIPT_ENABLED -#endif // EMWSCLIENT_H +#endif // EMWS_CLIENT_H diff --git a/modules/websocket/emws_peer.h b/modules/websocket/emws_peer.h index 6bb4552c37..f52f615c35 100644 --- a/modules/websocket/emws_peer.h +++ b/modules/websocket/emws_peer.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef EMWSPEER_H -#define EMWSPEER_H +#ifndef EMWS_PEER_H +#define EMWS_PEER_H #ifdef JAVASCRIPT_ENABLED @@ -90,4 +90,4 @@ public: #endif // JAVASCRIPT_ENABLED -#endif // LSWPEER_H +#endif // EMWS_PEER_H diff --git a/modules/websocket/emws_server.h b/modules/websocket/emws_server.h index ae31d9dbb0..14a9449605 100644 --- a/modules/websocket/emws_server.h +++ b/modules/websocket/emws_server.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef EMWSSERVER_H -#define EMWSSERVER_H +#ifndef EMWS_SERVER_H +#define EMWS_SERVER_H #ifdef JAVASCRIPT_ENABLED @@ -61,4 +61,4 @@ public: #endif -#endif // LWSSERVER_H +#endif // EMWS_SERVER_H diff --git a/modules/websocket/websocket_peer.h b/modules/websocket/websocket_peer.h index 13fef2424f..22099f7258 100644 --- a/modules/websocket/websocket_peer.h +++ b/modules/websocket/websocket_peer.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef WEBSOCKETPEER_H -#define WEBSOCKETPEER_H +#ifndef WEBSOCKET_PEER_H +#define WEBSOCKET_PEER_H #include "core/error/error_list.h" #include "core/io/packet_peer.h" @@ -66,4 +66,5 @@ public: }; VARIANT_ENUM_CAST(WebSocketPeer::WriteMode); -#endif // WEBSOCKETPEER_H + +#endif // WEBSOCKET_PEER_H diff --git a/modules/websocket/websocket_server.h b/modules/websocket/websocket_server.h index 7bd80851f5..ac04c4e57e 100644 --- a/modules/websocket/websocket_server.h +++ b/modules/websocket/websocket_server.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef WEBSOCKET_H -#define WEBSOCKET_H +#ifndef WEBSOCKET_SERVER_H +#define WEBSOCKET_SERVER_H #include "core/crypto/crypto.h" #include "core/object/ref_counted.h" @@ -87,4 +87,4 @@ public: ~WebSocketServer(); }; -#endif // WEBSOCKET_H +#endif // WEBSOCKET_SERVER_H diff --git a/modules/websocket/wsl_client.h b/modules/websocket/wsl_client.h index 22d7ffa839..58b867fbe4 100644 --- a/modules/websocket/wsl_client.h +++ b/modules/websocket/wsl_client.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef WSLCLIENT_H -#define WSLCLIENT_H +#ifndef WSL_CLIENT_H +#define WSL_CLIENT_H #ifndef JAVASCRIPT_ENABLED @@ -88,4 +88,4 @@ public: #endif // JAVASCRIPT_ENABLED -#endif // WSLCLIENT_H +#endif // WSL_CLIENT_H diff --git a/modules/websocket/wsl_peer.h b/modules/websocket/wsl_peer.h index abeecdd537..aabd3fd43e 100644 --- a/modules/websocket/wsl_peer.h +++ b/modules/websocket/wsl_peer.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef WSLPEER_H -#define WSLPEER_H +#ifndef WSL_PEER_H +#define WSL_PEER_H #ifndef JAVASCRIPT_ENABLED @@ -112,4 +112,4 @@ public: #endif // JAVASCRIPT_ENABLED -#endif // LSWPEER_H +#endif // WSL_PEER_H diff --git a/modules/websocket/wsl_server.h b/modules/websocket/wsl_server.h index a920e9c665..ec7567c732 100644 --- a/modules/websocket/wsl_server.h +++ b/modules/websocket/wsl_server.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef WSLSERVER_H -#define WSLSERVER_H +#ifndef WSL_SERVER_H +#define WSL_SERVER_H #ifndef JAVASCRIPT_ENABLED @@ -95,4 +95,4 @@ public: #endif // JAVASCRIPT_ENABLED -#endif // WSLSERVER_H +#endif // WSL_SERVER_H diff --git a/modules/webxr/godot_webxr.h b/modules/webxr/godot_webxr.h index 34225df001..52104895d4 100644 --- a/modules/webxr/godot_webxr.h +++ b/modules/webxr/godot_webxr.h @@ -82,4 +82,4 @@ extern int *godot_webxr_get_bounds_geometry(); } #endif -#endif /* GODOT_WEBXR_H */ +#endif // GODOT_WEBXR_H -- cgit v1.2.3