diff options
author | Yuri Rubinsky <chaosus89@gmail.com> | 2022-09-26 15:48:35 +0300 |
---|---|---|
committer | Yuri Rubinsky <chaosus89@gmail.com> | 2022-09-26 16:04:19 +0300 |
commit | 344aa610e3061c03662bae964575ddc95625564f (patch) | |
tree | 28d1a0410ddb4891ab6a87087fa5454f8d14a5d8 /editor | |
parent | 3472bdd6b6dd7c085b716caabdda16f88e6f167e (diff) |
Add defines to completion list in shaders
Diffstat (limited to 'editor')
-rw-r--r-- | editor/plugins/shader_editor_plugin.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp index ae3c578eaa..13aba0a884 100644 --- a/editor/plugins/shader_editor_plugin.cpp +++ b/editor/plugins/shader_editor_plugin.cpp @@ -385,13 +385,14 @@ static void _complete_include_paths(List<ScriptLanguage::CodeCompletionOption> * void ShaderTextEditor::_code_complete_script(const String &p_code, List<ScriptLanguage::CodeCompletionOption> *r_options) { List<ScriptLanguage::CodeCompletionOption> pp_options; + List<ScriptLanguage::CodeCompletionOption> pp_defines; ShaderPreprocessor preprocessor; String code; complete_from_path = (shader.is_valid() ? shader->get_path() : shader_inc->get_path()).get_base_dir(); if (!complete_from_path.ends_with("/")) { complete_from_path += "/"; } - preprocessor.preprocess(p_code, "", code, nullptr, nullptr, nullptr, nullptr, &pp_options, _complete_include_paths); + preprocessor.preprocess(p_code, "", code, nullptr, nullptr, nullptr, nullptr, &pp_options, &pp_defines, _complete_include_paths); complete_from_path = String(); if (pp_options.size()) { for (const ScriptLanguage::CodeCompletionOption &E : pp_options) { @@ -399,6 +400,9 @@ void ShaderTextEditor::_code_complete_script(const String &p_code, List<ScriptLa } return; } + for (const ScriptLanguage::CodeCompletionOption &E : pp_defines) { + r_options->push_back(E); + } ShaderLanguage sl; String calltip; |