Commit graph

72 commits

Author SHA1 Message Date
VolTer 952703d921 Make GDScript number highlighting stricter 2023-03-01 21:27:32 +01:00
Haoyu Qiu 5a283bdbcd Allow unicode identifier in GDScript syntax highlighter 2023-01-29 13:17:05 +08:00
Rémi Verschelde d95794ec8a
One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".
2023-01-05 13:25:55 +01:00
VolTer 52cfd4551d Stop highlighting node refs if they are invalid identifiers 2023-01-03 16:00:16 +02:00
Markus Sauermann 3b14f0334c Remove redundant Variant-types initializations 2022-11-14 19:35:19 +01:00
kobewi e48c5daddf Unify usage of GLOBAL/EDITOR_GET 2022-10-18 19:01:48 +02:00
Rune 624af7e032 GDScript: fix highlighting '.' after global class name 2022-10-11 22:18:19 -07:00
bruvzg 0103af1ddd
Fix MSVC warnings, rename shadowed variables, fix uninitialized values, change warnings=all to use /W4. 2022-10-07 11:32:33 +03:00
VolTer 2d48bf0b88 Fix more highlighting bugs 2022-10-02 17:44:39 +02:00
Rémi Verschelde cb39d7d08b Merge pull request #65074 from MewPurPur/booleans-highlighting-fix
Fix highlighting after value keywords
2022-09-27 09:58:58 +02:00
VolTer 54bb9c3dd5 Fixed a case for global function highlighting 2022-08-31 23:12:23 +02:00
VolTer ff362f8586 Add missing values to binary operator highlighter check exceptions 2022-08-31 08:51:26 +02:00
VolTer 1342b8ccd6 Follow-up fixes to number highlighting 2022-08-29 20:54:56 +02:00
VolTer a33ed6c046 Fix number highlighting 2022-08-29 11:35:46 +02:00
Rémi Verschelde 09086b0bb0
Merge pull request #64651 from MewPurPur/fix-globalfunc-highlighting
Add new highlighting color for `@GDScript` and `@GlobalScope` functions
2022-08-27 18:44:14 +02:00
VolTer 88ad758b41 Added highlighting color for GDScript and GlobalScope functions 2022-08-25 17:00:16 +02:00
VolTer 73bbc61eb4 Tweaked StringName highlighting color 2022-08-25 08:32:14 +02:00
kobewi 8be27dc59e Replace Array return types with TypedArray 2022-08-22 22:42:36 +02:00
Max Hilbrunner 6f273d2156
Merge pull request #63326 from MewPurPur/binary-highlighting-fix
Fix highlighting of multiple operators
2022-08-19 01:27:02 +02:00
VolTer 2e6108d181 Improve binary operator highlighting 2022-08-14 15:49:07 +02:00
Hugo Locurcio 0a24d40836
Improve script editor's light theme syntax colors for better readability
New colors were hand-picked to have a better contrast rate,
while still following the general coloring of the previous light theme.

This improves the light theme's accessibility, especially in outdoor
environments with direct sunlight.
2022-07-31 23:40:48 +02:00
kobewi df5655fdca Highlight ^NodePath and &StringName differently 2022-07-19 20:20:30 +02:00
George Marques eba3e0a9fc
GDScript: Support % in shorthand for get_node
The `%` is used in scene unique nodes. Now `%` can also be used instead
of `$` for the shorthand, besides being allowed generally anywhere in
the path as the prefix for a node name.
2022-05-27 13:46:18 -03:00
reduz 8b7c7f5a75 Add a new HashMap implementation
Adds a new, cleaned up, HashMap implementation.

* Uses Robin Hood Hashing (https://en.wikipedia.org/wiki/Hash_table#Robin_Hood_hashing).
* Keeps elements in a double linked list for simpler, ordered, iteration.
* Allows keeping iterators for later use in removal (Unlike Map<>, it does not do much
  for performance vs keeping the key, but helps replace old code).
* Uses a more modern C++ iterator API, deprecates the old one.
* Supports custom allocator (in case there is a wish to use a paged one).

This class aims to unify all the associative template usage and replace it by this one:
* Map<> (whereas key order does not matter, which is 99% of cases)
* HashMap<>
* OrderedHashMap<>
* OAHashMap<>
2022-05-12 11:21:29 +02:00
Hendrik Brucker b396fd4eef Improve compilation speed (forward declarations/includes cleanup) 2022-02-12 02:46:22 +01:00
bruvzg 244db37508
Cleanup and move char functions to the char_utils.h header. 2022-02-04 11:35:01 +02:00
Anilforextra adbe948bda String: Add contains(). 2022-02-04 01:28:02 +05:45
Paulb23 fffeecfd68 Improvments for SyntaxHighlighters
- Fix immedate Funcion in lamba highlight
- Highlight signals as one colour
- Highlight node paths as one colour
- Highlight escape chars in strings
2022-01-15 15:39:55 +00:00
Rémi Verschelde fe52458154
Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-03 21:27:34 +01:00
Nathan Franke 49403cbfa0
Replace String comparisons with "", String() to is_empty()
Also:
- Adds two stress tests to test_string.h
- Changes to .empty() on std::strings
2021-12-09 04:48:38 -06:00
Gordon MacPherson 1881b3adc5
Improve GDScript Editor and Improve latency
Improvements:
- GDScript Highlighter is faster by 25% as keys are smaller (hashes instead of strings)
- Removes message queue from _apply_settings_change to allow resize to work correctly
- Some performance fixes are pending still

Note: this resolves the code editor behaving badly when resizing in debug builds
2021-09-21 13:56:47 +02:00
Lyuma 31f790299c Use OrderedHashMap for autoloads to preserve order 2021-08-26 21:55:26 -07:00
reduz 3682978aee Replace BIND_VMETHOD by new GDVIRTUAL syntax
* New syntax is type safe.
* New syntax allows for type safe virtuals in native extensions.
* New syntax permits extremely fast calling.

Note: Everything was replaced where possible except for `_gui_input` `_input` and `_unhandled_input`.
These will require API rework on a separate PR as they work different than the rest of the functions.

Added a new method flag METHOD_FLAG_OBJECT_CORE, used internally. Allows to not dump the core virtuals like `_notification` to the json API, since each language will implement those as it is best fits.
2021-08-22 08:23:58 -03:00
Max Hilbrunner 5161c97c9c Remove underscore hacks
Way less cruft. :)

Co-authored-by: Ignacio Roldán Etcheverry <neikeq@users.noreply.github.com>
2021-08-17 16:10:28 +02:00
Paulb23 bcfc591f86 Reorganise text editor settings 2021-08-16 17:18:49 +01:00
Rémi Verschelde ac3322b0af
Use const references where possible for List range iterators 2021-07-25 12:22:25 +02:00
Aaron Franke 4e6efd1b07
Use C++ iterators for Lists in many situations 2021-07-23 17:38:28 -04:00
reduz 6631f66c2a Optimize StringName usage
* Added a new macro SNAME() that constructs and caches a local stringname.
* Subsequent usages use the cached version.
* Since these use a global static variable, a second refcounter of static usages need to be kept for cleanup time.
* Replaced all theme usages by this new macro.
* Replace all signal emission usages by this new macro.
* Replace all call_deferred usages by this new macro.

This is part of ongoing work to optimize GUI and the editor.
2021-07-18 21:20:02 -03:00
Lightning_A e28fd07b2b Rename instance()->instantiate() when it's a verb 2021-06-19 20:49:18 -06:00
Hugo Locurcio 32e97cb805
Highlight annotations in the GDScript syntax highlighter
By default, a orange color is used to highlight annotations in the
script editor.
2021-06-06 21:33:23 +02:00
Hugo Locurcio 1704be0a44
Rename the bundled text editor themes for consistency with themes
The Adaptive text editor theme is the default, and has therefore
been renamed Default for consistency with the Default theme preset.
It keeps its automatic dark/light switch status.

The Default text editor theme was actually a legacy Godot 2-style theme,
so it has been renamed to Godot 2 to match the theme preset.
Its background color has been changed to be a constant opaque color,
since the new editor theme made the theme look less good on a translucent
background. The previous background color on light theme also lacked
contrast.
2021-05-31 14:02:13 +02:00
Hugo Locurcio e905e8f145
Highlight control flow keywords with a different color
This makes them easier to distinguish from other keywords.
2021-05-05 22:38:12 +02:00
Lucas Van Mol 749d0c708c Fix highlight color for class attributes that are also keywords 2021-01-26 15:17:18 +01:00
Rémi Verschelde b5334d14f7
Update copyright statements to 2021
Happy new year to the wonderful Godot community!

2020 has been a tough year for most of us personally, but a good year for
Godot development nonetheless with a huge amount of work done towards Godot
4.0 and great improvements backported to the long-lived 3.2 branch.

We've had close to 400 contributors to engine code this year, authoring near
7,000 commit! (And that's only for the `master` branch and for the engine code,
there's a lot more when counting docs, demos and other first-party repos.)

Here's to a great year 2021 for all Godot users 🎆
2021-01-01 20:19:21 +01:00
Paulb23 ee4a1c99a7 Switch from recursion to iterative for backfilling colour regions 2020-10-03 14:58:55 +01:00
bruvzg 80b8eff6aa
[Complex Test Layouts] Change String to use UTF-32 encoding on all platforms. 2020-09-03 19:56:24 +03:00
Paulb23 6cdcdbc242 Fix color region end key seach and start key order 2020-08-22 19:55:44 +01:00
Paulb23 5cf2cf8646 Fix colour region continuation over blank lines, issue 41120 2020-08-08 15:36:46 +01:00
George Marques 5d6e853806
New GDScript tokenizer and parser
Sometimes to fix something you have to break it first.

This get GDScript mostly working with the new tokenizer and parser but
a lot of things isn't working yet. It compiles and it's usable, and that
should be enough for now.

Don't worry: other huge commits will come after this.
2020-07-20 11:38:39 -03:00
Paulb23 bc4cee4458 Extract Syntax highlighting from TextEdit and add EditorSyntaxHighlighter
- Extacted all syntax highlighting code from text edit
- Removed enable syntax highlighting from text edit
- Added line_edited_from signal to text_edit
- Renamed get/set_syntax_highlighting to get/set_syntax_highlighter
- Added EditorSyntaxHighligher
2020-07-11 17:09:58 +01:00