Commit Graph

240 Commits (cb1569345a6f17da08241e645ab03cb2e1b78d2f)

Author SHA1 Message Date
HolonProduction 93ae8d8f0d GUI: Only cancel completion with the `ui_cancel` action 2024-09-30 21:46:28 +07:00
Adam Scott 2f4f39c7b3
Fix trackpad code completion scrolling 2024-09-17 12:37:45 +07:00
SaNeOr ed69fd66da fix: Editor, save script file: Triple quote string: spaces are converted into tabs 2024-09-16 10:01:09 +07:00
Haoyu Qiu 504e0656bb Add TextEdit option to prevent copying without a selection 2024-09-14 09:39:36 +07:00
rune-scape 60fa3ec4d4 CodeEdit: improve render speed 2024-09-04 20:51:09 +07:00
Rémi Verschelde b4eacfe0ce
Merge pull request #95285 from Calinou/codeedit-completion-color-background-translucent
Draw a checkerboard behind translucent colors in CodeEdit autocompletion previews
2024-08-27 22:27:49 +07:00
Rémi Verschelde db5003519a
Merge pull request #89554 from smnast/backspace-unfold
Fix backspace always unfolding previous line
2024-08-19 16:04:34 +07:00
Hugo Locurcio fb88658cc8
Draw a checkerboard behind translucent colors in CodeEdit autocompletion previews
This makes translucent colors easier to interpret as such
and is consistent with how they're displayed in ColorPicker.
2024-08-09 00:03:11 +07:00
bruvzg dc98e432e5
[macOS] Fix code completion list scrolling with trackpad. 2024-07-15 08:12:19 +07:00
kit a7da814c6b CodeEdit Fix move lines up/down viewport and selection issues 2024-06-25 15:31:20 +07:00
A Thousand Ships fbb879debd
[Scene] Add `SceneStringNames::text/value_changed` 2024-06-19 09:44:38 +07:00
MrPersonDev 2860b99077 Fix backspace always unfolding previous line 2024-05-27 13:30:19 +07:00
Robert Wallis 0e97e1bc62 Fix crash during code editor folding and LSP 2024-05-23 20:01:11 +07:00
kit 773a473807 Overhaul multiple caret editing in TextEdit.
Use a multicaret edit to delay merging overlapping carets until the end.
2024-04-26 14:26:10 +07:00
kit 154f727c7a Overhaul TextEdit selection.
The caret is now a part of the selection.
2024-04-26 14:24:10 +07:00
VolTer de8b6f7a3c Add editor settings for autocompletion with NodePath and StringName 2024-03-19 17:23:54 +07:00
Garrett Gu 4ab08fb99f Fix bug related to multicursor and backspacing with brackets 2024-03-14 11:48:48 +07:00
Rafael Chuva 8c36282feb Fix region section not ignoring #region and #endregion when in a string
When using the script editor, if the keywords #region and #endregion where
in a string and ate the start of the line, the editor would not ignore them
and count them as the actual keywords, which when folded, would only fold
until the first #endregion in a string, for example.

By checking if these keywords were in a string, this commit now ensures the
editor ignores strings and fold the section correctly.

Fixes #89115.
2024-03-11 00:04:39 +07:00
Michael Alexsander d70c45b5c8
Add option to add built-in strings in the POT generation 2024-02-28 11:34:26 +07:00
Raul Santos 5ba92e5a57
Fix some DEFVALs to use the right type
- Use `StringName()` in DEFVAL for StringNames.
- Use `Variant()` in DEFVAL for Variants.
2024-02-23 01:50:18 +07:00
kit a6af442b05 Apply TextEdit IME on most actions 2024-01-29 15:07:19 +07:00
Yuri Sizov 40e7192393 Merge pull request #85191 from HolonProduction/off-by-one-code-edit
Fix updating delimiter cache of `CodeEdit` when typing on the first line
2023-12-20 15:07:44 +07:00
CHM 3744ef50e4 Make it possible to show code hint and code completion at the same time
Make code completion position more consistent

Add whitespace before if
2023-12-19 19:34:34 +07:00
HolonProduction d5847fa54e Fix updating delimiter cache of `CodeEdit` when typing on the first line 2023-12-18 14:07:46 +07:00
Danil Alexeev 881fe67d94
Code Editor: Fix regression with using doc comments for code regions 2023-10-13 09:38:03 +07:00
Adam Scott 25cbb682f5
Fix code completion override of home and end keys 2023-10-06 14:48:45 +07:00
Rémi Verschelde b11309ddb6
Merge pull request #81633 from matorin57/code-completion-popup
Avoid resetting the code completion popup excessively
2023-10-03 17:20:49 +07:00
PucklaMotzer09 d2e651f403 Add Duplicate Lines shortcut to CodeTextEditor
This keyboard shortcut has been made with inspiration from the VS Code keyboard shortcut editor.action.copyLinesDownAction. It duplicates all selected lines and inserts them below no matter where the caret is within the line.
2023-09-25 23:41:31 +07:00
DESKTOP-UT43QTQ\Garrigan-Desktop 303d0994e9 Avoid resetting the code completion popup excessively 2023-09-20 15:49:25 +07:00
ajreckof 6afadbaa9f Replace Ctrl in editor shortcuts with Cmd or Ctrl depending on platform 2023-09-19 10:29:07 +07:00
Yuri Sizov fe000277ea Bind remaining theme properties to their respective classes
This adds binds for GraphEdit/GraphElement/GraphNode, which were
skipped before due to a rework. This also adds binds for Window,
which was skipped before due to a complicated code organization.

Also adds theme cache entries/direct cache access to a few places
that previously missed it. Some theme properties are now exposed
to other classes via friendships or public getters for convenience.

This removes all string-based theme access from scene/ classes.
2023-09-13 19:31:35 +07:00
Jean-Michel Bernard 67dce301aa Add code region folding to CodeEdit 2023-09-11 18:36:40 +07:00
Yuri Sizov 2924bfd4d3 Register theme properties with ThemeDB 2023-09-11 13:45:23 +07:00
ajreckof 1eb3d99ff7 Fix CodeEdit completion being very slow in certain cases 2023-08-10 08:15:41 +07:00
Rémi Verschelde 858e8748e8
Fix or workaround recent extension API compatibility issues
- Add compatibility methods for `RenderingDevice::shader_create_from_bytecode`
  and `CodeEdit::get_text_for_symbol_loopup`.
- Silence errors which now have compatibility methods.
- Acknowledge GraphEdit/GraphNode compat breakage, intended and WIP.
2023-08-03 12:07:21 +07:00
Yuri Sizov 2bd904e3db Merge pull request #73196 from Vilcrow/fix-lookup-symbol
Fix jumping to function definition using `Ctrl+LMB` or the "Lookup Symbol" button
2023-07-24 19:32:12 +07:00
S.V.I. Vilcrow 56e2fad319 Fixed the jumping to function definition using 'Ctrl+LMB' and the 'Lookup Symbol' button. 2023-07-12 21:30:35 +07:00
MewPurPur 6e182d41f4 Hide breakpoint indicator when mouse leaves CodeEdit 2023-06-21 11:30:40 +07:00
Rémi Verschelde 0653f7a5b0
Merge pull request #77722 from ApplecrispEric/drag-drop-autocomplete
Cancel autocomplete after initiating drag
2023-06-20 09:20:52 +07:00
Eric Brown 42bc437615 Changed autocomplete to cancel when the user begins a drag 2023-06-19 15:44:13 +07:00
ajreckof e9a2060b27 Fix wrong alphabetical order in autocompletion sorting.
Co-Authored-By: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
2023-06-16 14:04:07 +07:00
ajreckof 006e899bb3 sort code completions with rules
Fixups

Add levenshtein distance for comparisons, remove kind sort order, try to improve as many different use cases as possible

Trying again to improve code completion

Sort code autocompletion options by similarity based on input

To make it really brief, uses a combination `String.similiary`, the category system introduced in a previous PR, and some filtering to yield more predictable results, instead of scattering every completion option at seemingly random.

It also gives much higher priority to strings that contain the base in full, closer to the beginning or are perfect matches.

Also moves CodeCompletionOptionCompare to code_edit.cpp

Co-Authored-By: Micky <66727710+Mickeon@users.noreply.github.com>
Co-Authored-By: Eric M <41730826+EricEzaM@users.noreply.github.com>
2023-05-23 05:12:34 +07:00
Paulb23 0b3fba45c6 Move convert_indent into CodeEdit 2023-05-07 13:08:37 +07:00
Rémi Verschelde c0ee2b4968
Merge pull request #76145 from manueldun/usability-auto-indent
Fix auto-indentation in typed arrays, comments, and after colon
2023-04-24 16:45:35 +07:00
Manuel Dun fa7e6ddb83 Fix auto-indentation in typed arrays, comments, and after colon
Now the editor won't add indentation when pressing enter, is
declaring typed variables and there is a colon in the comment

example:
var a:=0#:[press enter]
no indentation
2023-04-20 18:48:21 +07:00
Yuri Sizov de416c5cbd
Merge pull request #74623 from MewPurPur/edit-text-with-style
Code style improvements to text_edit and related
2023-04-17 19:08:08 +07:00
bruvzg a5009f4d3c
[Web] Detect host OS and use macOS keys on mac hosts. 2023-04-11 10:58:54 +07:00
VolTer f587a21899 Code style improvements to text_edit and related 2023-04-08 19:33:56 +07:00
Juan Linietsky 37362202a4 Fix CI build error
Fixes potential use of uninitialized variable.
2023-04-08 18:21:08 +07:00
Yuri Sizov db2f99cdc0 Implement theme item cache in TextEdit and CodeEdit 2023-04-03 18:01:10 +07:00
Rémi Verschelde 420ea5c0ad
Merge pull request #73074 from M4rYu5/capslock-editor-completion-fix
Editor: Ignore CapsLock when pressed alone
2023-04-03 15:58:11 +07:00
Yuri Sizov ff98395556 Prevent passing events from CodeEdit to TextEdit when code completion is active 2023-03-09 15:54:08 +07:00
Arman Elgudzhyan 688d00b706 Don't autocomplete numbers in GDScript
Cancel code autocompletion when a numerical value is entered. Avoids interference when setting numbers.
2023-03-06 14:20:24 +07:00
VolTer 9de731a9ec Fix Indent/Unindent without a selection not causing a redraw 2023-02-19 21:08:04 +07:00
VolTer d16df33021 Fix autocomplete persisting at the beginning of a line 2023-02-15 09:24:13 +07:00
M4rYu5 97d355c13d Now, in editor, CapsLock behave like a modifier key: does nothing when pressed alone.
Before, it ended up closing the code completion, and rerendering portions of editor.
2023-02-13 10:46:00 +07:00
poohcom1 c161ee3519 Fix autocomplete filter not including substrings 2023-01-23 11:35:57 +07:00
kobewi b427d3585c Allow unindent without selection 2023-01-18 17:05:15 +07:00
Paulb23 1aac10d73d Fixed adding extra quote when completing strings 2023-01-14 15:28:22 +07:00
Eric M 1d30653efb Fix crash in CodeEdit when caret column exceeds line length. 2023-01-11 22:52:37 +07:00
Juan Linietsky 2b815df3c1 Use BitField<> in core type masks
* All core types masks are now correctly marked as bitfields.
* The enum hacks in MouseButtonMask and many other types are gone. This ensures that binders to other languages non C++ can actually implement type safe bitmasks.
* Most bitmask operations replaced by functions in BitField<>
* Key is still a problem because its enum and mask at the same time. While it kind of works in C++, this most likely can't be implemented safely in other languages and will have to be changed at some point. Mostly left as-is.
* Documentation and API dump updated to reflect bitfields in core types.
2023-01-08 22:17:40 +07:00
Michael Bickel 5d09bf8f05 fix typo 'comleption' -> 'completion' 2023-01-06 19:52:19 +07: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 +07:00
Paulb23 29f7bea241 Fix autocomplete with autobrace completion not adding closing pair 2022-12-19 14:20:52 +07:00
Hayden Leete 530b1f3f7a Fix autocomplete box placement 2022-12-17 12:33:29 +07:00
Rémi Verschelde 82b1cd6753
Merge pull request #62675 from Jummit/tolerant_lookup
Allow drag-clicking before symbol lookup
2022-12-03 21:30:57 +07:00
bruvzg 3add6dcd89
Add `Control::localize_numeral_system` property to toggle automatic numeral system conversion. 2022-11-17 14:59:56 +07:00
Alfred Reinold Baudisch 7127e57bf8 Pass caret index when deleting selection with backspace
Fixes and closes #67992
2022-11-05 08:55:18 +07:00
Rémi Verschelde 87cdc2ea60
Merge pull request #67994 from YeldhamDev/how_suggestive
Stop centering clicked suggestions in the autocomplete popup
2022-11-02 14:15:32 +07:00
Michael Alexsander 4b6e6c6758 Stop centering clicked suggestions in the autocomplete popup 2022-10-28 20:22:28 +07:00
Paulb23 b5dc8e24be Fix crash in code completion when using an invalid / null font 2022-10-16 16:47:27 +07:00
VolTer d6e60f45a1 Improved breakpoints hover indicator 2022-10-10 04:36:45 +07:00
Jummit a6c1cfae99 Allow drag-clicking before symbol lookup
This makes it easier for touch and tablet users to do symbol lookups in
the code editor.
2022-10-09 18:42:54 +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 +07:00
Paulb23 e9180241e8 Add multi caret support to CodeEdit 2022-10-05 17:19:26 +07:00
Paulb23 4a9d4e3dad Add mutliple Caret support to TextEdit 2022-10-05 17:19:26 +07:00
Rémi Verschelde 1b31241445 Merge pull request #65540 from MewPurPur/easier-bookmarks
Implement Shift+LMB as a Way to Toggle Bookmarks
2022-09-26 08:20:40 +07:00
VolTer c8cb93d022 Shift+LMB to Toggle Bookmarks 2022-09-08 22:23:14 +07:00
bruvzg 6f4d233062
Fix key mapping changes when moving from macOS to other platform
Removes separate `Command` key (use `Meta` instead).
Adds an event flag to automatically remap `Command` <-> `Control` (cannot be set alongside `Control` or `Meta`).
2022-09-07 18:45:35 +07:00
Micky e31bb5ffeb Rename `CanvasItem.update()` to `queue_redraw()`
Affects a lot of classes. Very thoroughly checked signal connections and deferred calls to this method, add_do_method/add_undo_method calls, and so on.

Also renames the internal `_update_callback()` to `_redraw_callback()` for consistency.

Just a few comments have also been changed to say "redraw".

In CPUParticles2D, there was a private variable with the same name. It has been renamed to `do_redraw`.
2022-08-29 14:59:47 +07:00
Rémi Verschelde fd6453c45e Revert "Remove NOTIFICATION_ENTER_TREE when paired with NOTIFICATION_THEME_CHANGED"
This reverts commit 4b817a565c.

Fixes #64988.
Fixes #64997.

This caused several regressions (#64988, #64997,
https://github.com/godotengine/godot/issues/64997#issuecomment-1229970605)
which point at a flaw in the current logic:

- `Control::NOTIFICATION_ENTER_TREE` triggers a *deferred* notification with
  `NOTIFCATION_THEME_CHANGED` as introduced in #62845.
- Some classes use their `THEME_CHANGED` to cache theme items in
  member variables (e.g. `style_normal`, etc.), and use those member
  variables in `ENTER_TREE`, `READY`, `DRAW`, etc. Since the `THEME_CHANGE`
  notification is now deferred, they end up accessing invalid state and this
  can lead to not applying theme properly (e.g. for EditorHelp) or crashing
  (e.g. for EditorLog or CodeEdit).

So we need to go back to the drawing board and see if `THEME_CHANGED` can be
called earlier so that the previous logic still works?

Or can we refactor all engine code to make sure that:
- `ENTER_TREE` and similar do not depend on theme properties cached in member
  variables.
- Or `THEME_CHANGE` does trigger a general UI update to make sure that any
  bad theme handling in `ENTER_TREE` and co. gets fixed when `THEME_CHANGE`
  does arrive for the first time. But that means having a temporary invalid
  (and possibly still crashing) state, and doing some computations twice
  which might be heavy (e.g. `EditorHelp::_update_doc()`).
2022-08-29 11:11:29 +07:00
Aaron Record 4b817a565c Remove NOTIFICATION_ENTER_TREE when paired with NOTIFICATION_THEME_CHANGED 2022-08-27 11:52:29 +07:00
kobewi 8be27dc59e Replace Array return types with TypedArray 2022-08-22 22:42:36 +07:00
bruvzg 8823eae328
Rename OSX to macOS and iPhoneOS to iOS. 2022-07-21 09:37:52 +07:00
bruvzg 344ba0ffaf
Refactor Font configuration and import UI, and Font resources. 2022-07-06 14:12:36 +07:00
MinusKube 336400dc42 Add the ability to drag the code completion scrollbar using the mouse click 2022-07-03 23:47:52 +07:00
Aaron Record 900c676b02 Use range iterators for RBSet in most cases 2022-05-19 12:09:16 +07:00
reduz 746dddc067 Replace most uses of Map by HashMap
* Map is unnecessary and inefficient in almost every case.
* Replaced by the new HashMap.
* Renamed Map to RBMap and Set to RBSet for cases that still make sense
  (order matters) but use is discouraged.

There were very few cases where replacing by HashMap was undesired because
keeping the key order was intended.
I tried to keep those (as RBMap) as much as possible, but might have missed
some. Review appreciated!
2022-05-16 10:37:48 +07:00
bruvzg 081b6b8053
Add ALT NUM+ {hex code} character input support for LineEdit, TextEdit and CodeEdit. 2022-05-13 09:33:24 +07: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 +07:00
Hugo Locurcio 180e5d3028
Remove `RES` and `REF` typedefs in favor of spelled out `Ref<>`
These typedefs don't save much typing compared to the full `Ref<Resource>`
and `Ref<RefCounted>`, yet they sometimes introduce confusion among
new contributors.
2022-05-03 01:43:50 +07:00
Nathan Franke 925e54ad65
fix lines ending in comments causing auto indent 2022-04-28 20:07:10 +07:00
FireForge 3073b85de9 Rename theme properties to include underscores
- check_vadjust -> check_v_adjust
- close_h_ofs -> close_h_offset
- close_v_ofs -> close_v_offset
- commentfocus -> comment_focus
- hseparation -> h_separation
- ofs -> offset
- selectedframe -> selected_frame
- state_machine_selectedframe -> state_machine_selected_frame
- table_hseparation -> table_h_separation
- table_vseparation -> table_v_separation
- vseparation -> v_separation
2022-04-23 11:16:18 +07:00
FireForge 88b09694e7 Fix inspector group name capitalization 2022-03-28 14:02:06 +07:00
reduz 360dea5348 Add GDExtension support to Script
* Ability to create script languages from GDExtension
* Some additions to gdnative_extension.h to make this happen
* Moved the GDExtension binder to core

This now allows creating scripting languages from GDExtension, with the same ease as if it was a module. It replaces the old PluginScript from Godot 3.x.
Warning: GodotCPP will need to be updated to support this (it may be a bit of work as ScriptInstance needs to be created over there again).
2022-03-27 16:13:00 +07:00
Rémi Verschelde 0f5455230c
Use `switch` consistently in `_notification` (`scene` folder) 2022-02-15 18:44:55 +07:00
bruvzg 29199579f7
Add sub-pixel glyph positioning support. 2022-02-12 19:55:52 +07:00
bruvzg 244db37508
Cleanup and move char functions to the `char_utils.h` header. 2022-02-04 11:35:01 +07:00
Anilforextra adbe948bda String: Add contains(). 2022-02-04 01:28:02 +07:00
Igor Kordiukiewicz f170d6a171 With auto_brace_complete enabled, selected text now gets wrapped by braces 2022-01-30 17:33:13 +07:00