diff options
| author | A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> | 2024-05-06 16:20:20 +0200 |
|---|---|---|
| committer | A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> | 2024-05-08 12:37:42 +0200 |
| commit | a0dbdcc3abbd3e6307c6e68d0e60f8c0fa31d576 (patch) | |
| tree | 0b8d0a36f69e28096b06956ebbe2c5e6f7e403a3 /modules/gdscript | |
| parent | 281fe39929303a8ef12e72ff7999b849bbe0678d (diff) | |
| download | redot-engine-a0dbdcc3abbd3e6307c6e68d0e60f8c0fa31d576.tar.gz | |
Replace `find` with `contains/has` where applicable
* Replaces `find(...) != -1` with `contains` for `String`
* Replaces `find(...) == -1` with `!contains` for `String`
* Replaces `find(...) != -1` with `has` for containers
* Replaces `find(...) == -1` with `!has` for containers
Diffstat (limited to 'modules/gdscript')
| -rw-r--r-- | modules/gdscript/language_server/gdscript_workspace.cpp | 2 | ||||
| -rw-r--r-- | modules/gdscript/tests/test_lsp.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/modules/gdscript/language_server/gdscript_workspace.cpp b/modules/gdscript/language_server/gdscript_workspace.cpp index 819611099e..09defdf8cd 100644 --- a/modules/gdscript/language_server/gdscript_workspace.cpp +++ b/modules/gdscript/language_server/gdscript_workspace.cpp @@ -695,7 +695,7 @@ const lsp::DocumentSymbol *GDScriptWorkspace::resolve_symbol(const lsp::TextDocu } else { ScriptLanguage::LookupResult ret; - if (symbol_identifier == "new" && parser->get_lines()[p_doc_pos.position.line].replace(" ", "").replace("\t", "").find("new(") > -1) { + if (symbol_identifier == "new" && parser->get_lines()[p_doc_pos.position.line].replace(" ", "").replace("\t", "").contains("new(")) { symbol_identifier = "_init"; } if (OK == GDScriptLanguage::get_singleton()->lookup_code(parser->get_text_for_lookup_symbol(pos, symbol_identifier, p_func_required), symbol_identifier, path, nullptr, ret)) { diff --git a/modules/gdscript/tests/test_lsp.h b/modules/gdscript/tests/test_lsp.h index 6192272f80..b85c727bc5 100644 --- a/modules/gdscript/tests/test_lsp.h +++ b/modules/gdscript/tests/test_lsp.h @@ -227,7 +227,7 @@ Vector<InlineTestData> read_tests(const String &p_path) { if (InlineTestData::try_parse(lines, i, d)) { if (!d.name.is_empty()) { // Safety check: names must be unique. - if (names.find(d.name) != -1) { + if (names.has(d.name)) { FAIL(vformat("Duplicated name '%s' in '%s'. Names must be unique!", d.name, p_path)); } names.append(d.name); |
