diff --git a/core/object/script_language.h b/core/object/script_language.h
index daf21609d9..2c2f38bc75 100644
--- a/core/object/script_language.h
+++ b/core/object/script_language.h
@@ -294,6 +294,7 @@ public:
CODE_COMPLETION_KIND_NODE_PATH,
CODE_COMPLETION_KIND_FILE_PATH,
CODE_COMPLETION_KIND_PLAIN_TEXT,
+ CODE_COMPLETION_KIND_KEYWORD,
CODE_COMPLETION_KIND_MAX
};
diff --git a/core/object/script_language_extension.cpp b/core/object/script_language_extension.cpp
index 8773b364d5..72182308fb 100644
--- a/core/object/script_language_extension.cpp
+++ b/core/object/script_language_extension.cpp
@@ -193,5 +193,6 @@ void ScriptLanguageExtension::_bind_methods() {
BIND_ENUM_CONSTANT(CODE_COMPLETION_KIND_NODE_PATH);
BIND_ENUM_CONSTANT(CODE_COMPLETION_KIND_FILE_PATH);
BIND_ENUM_CONSTANT(CODE_COMPLETION_KIND_PLAIN_TEXT);
+ BIND_ENUM_CONSTANT(CODE_COMPLETION_KIND_KEYWORD);
BIND_ENUM_CONSTANT(CODE_COMPLETION_KIND_MAX);
}
diff --git a/doc/classes/CodeEdit.xml b/doc/classes/CodeEdit.xml
index ee2bf18038..5e29ae55cb 100644
--- a/doc/classes/CodeEdit.xml
+++ b/doc/classes/CodeEdit.xml
@@ -670,6 +670,9 @@
Marks the option as unclassified or plain text.
+
+ Marks the option as a keyword.
+
The option is local to the location of the code completion query - e.g. a local variable. Subsequent value of location represent options from the outer class, the exact value represent how far they are (in terms of inner classes).
diff --git a/doc/classes/ScriptLanguageExtension.xml b/doc/classes/ScriptLanguageExtension.xml
index b405881607..cf41bcee04 100644
--- a/doc/classes/ScriptLanguageExtension.xml
+++ b/doc/classes/ScriptLanguageExtension.xml
@@ -431,7 +431,9 @@
-
+
+
+
diff --git a/editor/gui/code_editor.cpp b/editor/gui/code_editor.cpp
index f55e1fd962..e11631c47f 100644
--- a/editor/gui/code_editor.cpp
+++ b/editor/gui/code_editor.cpp
@@ -1101,6 +1101,9 @@ Ref CodeTextEditor::_get_completion_icon(const ScriptLanguage::CodeCo
case ScriptLanguage::CODE_COMPLETION_KIND_FUNCTION:
tex = get_editor_theme_icon(SNAME("MemberMethod"));
break;
+ case ScriptLanguage::CODE_COMPLETION_KIND_KEYWORD:
+ tex = get_editor_theme_icon(SNAME("Keyword"));
+ break;
case ScriptLanguage::CODE_COMPLETION_KIND_PLAIN_TEXT:
tex = get_editor_theme_icon(SNAME("BoxMesh"));
break;
diff --git a/editor/icons/Keyword.svg b/editor/icons/Keyword.svg
new file mode 100644
index 0000000000..f5c79405e2
--- /dev/null
+++ b/editor/icons/Keyword.svg
@@ -0,0 +1 @@
+
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp
index c19d8061ad..9abeed0c00 100644
--- a/modules/gdscript/gdscript_editor.cpp
+++ b/modules/gdscript/gdscript_editor.cpp
@@ -1622,7 +1622,7 @@ static void _find_identifiers(const GDScriptParser::CompletionContext &p_context
const char **kw = _keywords;
while (*kw) {
- ScriptLanguage::CodeCompletionOption option(*kw, ScriptLanguage::CODE_COMPLETION_KIND_PLAIN_TEXT);
+ ScriptLanguage::CodeCompletionOption option(*kw, ScriptLanguage::CODE_COMPLETION_KIND_KEYWORD);
r_result.insert(option.display, option);
kw++;
}
@@ -1635,7 +1635,7 @@ static void _find_identifiers(const GDScriptParser::CompletionContext &p_context
const char **kws = _keywords_with_space;
while (*kws) {
- ScriptLanguage::CodeCompletionOption option(*kws, ScriptLanguage::CODE_COMPLETION_KIND_PLAIN_TEXT);
+ ScriptLanguage::CodeCompletionOption option(*kws, ScriptLanguage::CODE_COMPLETION_KIND_KEYWORD);
option.insert_text += " ";
r_result.insert(option.display, option);
kws++;
diff --git a/modules/gdscript/language_server/gdscript_language_protocol.cpp b/modules/gdscript/language_server/gdscript_language_protocol.cpp
index 095b56dd0d..a5538ddafb 100644
--- a/modules/gdscript/language_server/gdscript_language_protocol.cpp
+++ b/modules/gdscript/language_server/gdscript_language_protocol.cpp
@@ -607,7 +607,10 @@ Array GDScriptLanguageProtocol::lsp_completion(const Dictionary &p_params) {
case ScriptLanguage::CODE_COMPLETION_KIND_PLAIN_TEXT:
item.kind = LSP::CompletionItemKind::Text;
break;
- default: {
+ case ScriptLanguage::CODE_COMPLETION_KIND_KEYWORD:
+ item.kind = LSP::CompletionItemKind::Keyword;
+ break;
+ case ScriptLanguage::CODE_COMPLETION_KIND_MAX: {
}
}
diff --git a/scene/gui/code_edit.cpp b/scene/gui/code_edit.cpp
index 1c6b5634b3..94b3b52f21 100644
--- a/scene/gui/code_edit.cpp
+++ b/scene/gui/code_edit.cpp
@@ -3120,6 +3120,7 @@ void CodeEdit::_bind_methods() {
BIND_ENUM_CONSTANT(KIND_NODE_PATH);
BIND_ENUM_CONSTANT(KIND_FILE_PATH);
BIND_ENUM_CONSTANT(KIND_PLAIN_TEXT);
+ BIND_ENUM_CONSTANT(KIND_KEYWORD);
BIND_ENUM_CONSTANT(LOCATION_LOCAL);
BIND_ENUM_CONSTANT(LOCATION_PARENT_MASK);
diff --git a/scene/gui/code_edit.h b/scene/gui/code_edit.h
index 0a458929f6..3a607c1d16 100644
--- a/scene/gui/code_edit.h
+++ b/scene/gui/code_edit.h
@@ -50,6 +50,7 @@ public:
KIND_NODE_PATH,
KIND_FILE_PATH,
KIND_PLAIN_TEXT,
+ KIND_KEYWORD,
};
// core/object/script_language.h - ScriptLanguage::CodeCompletionLocation
diff --git a/servers/rendering/shader_language.cpp b/servers/rendering/shader_language.cpp
index b1c248a6a6..4d3c135848 100644
--- a/servers/rendering/shader_language.cpp
+++ b/servers/rendering/shader_language.cpp
@@ -11495,7 +11495,7 @@ Error ShaderLanguage::complete(const String &p_code, const ShaderCompileInfo &p_
if (keyword_list[i].excluded_shader_types.has(shader_type_identifier) || keyword_list[i].excluded_functions.has(current_function)) {
continue;
}
- ScriptLanguage::CodeCompletionOption option(keyword_list[i].text, ScriptLanguage::CODE_COMPLETION_KIND_PLAIN_TEXT);
+ ScriptLanguage::CodeCompletionOption option(keyword_list[i].text, ScriptLanguage::CODE_COMPLETION_KIND_KEYWORD);
r_options->push_back(option);
}
}