Commit graph

157 commits

Author SHA1 Message Date
ajreckof
1eb3d99ff7 Fix CodeEdit completion being very slow in certain cases 2023-08-10 08:15:41 +02: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 +02: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 +02: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 +03:00
MewPurPur
6e182d41f4 Hide breakpoint indicator when mouse leaves CodeEdit 2023-06-21 11:30:40 +02: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 +02: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 +02: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 +02:00
Paulb23
0b3fba45c6 Move convert_indent into CodeEdit 2023-05-07 13:08:37 +01: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 +02: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 -04: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 +02:00
bruvzg
a5009f4d3c
[Web] Detect host OS and use macOS keys on mac hosts. 2023-04-11 10:58:54 +03:00
VolTer
f587a21899 Code style improvements to text_edit and related 2023-04-08 19:33:56 +02:00
Juan Linietsky
37362202a4 Fix CI build error
Fixes potential use of uninitialized variable.
2023-04-08 18:21:08 +02:00
Yuri Sizov
db2f99cdc0 Implement theme item cache in TextEdit and CodeEdit 2023-04-03 18:01:10 +02: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 +02:00
Yuri Sizov
ff98395556 Prevent passing events from CodeEdit to TextEdit when code completion is active 2023-03-09 15:54:08 +01: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 -08:00
VolTer
9de731a9ec Fix Indent/Unindent without a selection not causing a redraw 2023-02-19 21:08:04 +01:00
VolTer
d16df33021 Fix autocomplete persisting at the beginning of a line 2023-02-15 09:24:13 +01: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 +02: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 +01:00
Paulb23
1aac10d73d Fixed adding extra quote when completing strings 2023-01-14 15:28:22 +00:00
Eric M
1d30653efb Fix crash in CodeEdit when caret column exceeds line length. 2023-01-11 22:52:37 +10: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 +01:00
Michael Bickel
5d09bf8f05 fix typo 'comleption' -> 'completion' 2023-01-06 19:52:19 +01: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
Paulb23
29f7bea241 Fix autocomplete with autobrace completion not adding closing pair 2022-12-19 14:20:52 +00:00
Hayden Leete
530b1f3f7a Fix autocomplete box placement 2022-12-17 12:33:29 +13: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 +01:00
bruvzg
3add6dcd89
Add Control::localize_numeral_system property to toggle automatic numeral system conversion. 2022-11-17 14:59:56 +02:00
Alfred Reinold Baudisch
7127e57bf8 Pass caret index when deleting selection with backspace
Fixes and closes #67992
2022-11-05 08:55:18 +01: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 +01:00
Michael Alexsander
4b6e6c6758 Stop centering clicked suggestions in the autocomplete popup 2022-10-28 20:22:28 -03:00
Paulb23
b5dc8e24be Fix crash in code completion when using an invalid / null font 2022-10-16 16:47:27 +01:00
VolTer
d6e60f45a1 Improved breakpoints hover indicator 2022-10-10 04:36:45 +02: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 +02: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
Paulb23
e9180241e8 Add multi caret support to CodeEdit 2022-10-05 17:19:26 +01:00
Paulb23
4a9d4e3dad Add mutliple Caret support to TextEdit 2022-10-05 17:19:26 +01: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 +02:00
VolTer
c8cb93d022 Shift+LMB to Toggle Bookmarks 2022-09-08 22:23:14 +02: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 +02: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 +02: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 +02:00
Aaron Record
4b817a565c Remove NOTIFICATION_ENTER_TREE when paired with NOTIFICATION_THEME_CHANGED 2022-08-27 11:52:29 -06:00
kobewi
8be27dc59e Replace Array return types with TypedArray 2022-08-22 22:42:36 +02:00