Commit graph

29607 commits

Author SHA1 Message Date
thislooksfun 22a955b2d7 LibGUI: Abstract out widget and layout class matching 2021-11-02 17:53:22 +01:00
thislooksfun e1e856132c LibGUI: Don't suggest widgets inside layouts
Having a widget inside a layout is meaningless, so why suggest them in
the first place?
2021-11-02 17:53:22 +01:00
thislooksfun e403796842 LibGUI: Abstract out some duplicated logic for suggesting properties
A lot of the code in this area is duplicated, which is not great. In
fact this also fixes a bug where suggested partially matched props
would include read-only properties, since that check had only been
added to one of the two loops.
2021-11-02 17:53:22 +01:00
thislooksfun 0be3f5b4ae HackStudio: Append a / when completing a directory 2021-11-02 17:53:22 +01:00
thislooksfun 8b3a2cdad9 HackStudio: Correctly handle nested paths
Previously the paths were concatinated incorrectly, so triggering
the autocomplete on `#include "foo/bar"` would never work. Now it
does. :^)
2021-11-02 17:53:22 +01:00
thislooksfun a6a71869d7 HackStudio: Handle autocomplete inside #include's <> and "" 2021-11-02 17:53:22 +01:00
thislooksfun 4143f6f906 LibGUI: Make sure that children are actually widgets
Previously this section of code would blindly add *anything* as a child
as long as it has been registered as an object. Since there is no
guarentee that those objects are, in fact, Widgets, this feels like a
logical fallacy.

For example, up until this change, this is perfectly valid GML:

```
@GUI::Widget {
    layout: @GUI::VerticalBoxLayout {
    }

    @GUI::VerticalBoxLayout {
    }
}
```

What exactly does it do? Who knows! It doesn't seem to *break*, but I
think we can all agree it shouldn't be valid.

Instead, we now actually verify that the registered class inherets from
GUI::Widget before adding it as a child. We also error if it's not,
which should hopefully help new GML writers from forgetting to write
'layout: ' before the layout definition and being confused as to why
it's not working.
2021-11-02 17:53:22 +01:00
thislooksfun eb3ca64819 LibGUI: Dynamically process layouts from GML files
There are only two layouts at the moment, but that could (and probably
will) change in the future. Why limit ourselves by hardcoding these
checks when we can do it dynamically instead?
2021-11-02 17:53:22 +01:00
thislooksfun 03b52e26f0 LibGUI: Use fuzzy matching for GML suggestions 2021-11-02 17:53:22 +01:00
thislooksfun 1a3ea0c892 LibGUI: Add myself to the copyright header 2021-11-02 17:53:22 +01:00
thislooksfun 49b4dfd6cd LibGUI: Suggest 'layout' even before the user starts typing 2021-11-02 17:53:22 +01:00
thislooksfun 8863fe5852 LibGUI: Remove unused check
This check was removed as it will now never trigger.

The completion has the suffix ': ' on it, and the key does not.
Therefore if the user has not yet typed the ':', it will not be equal,
and after they do the check on line 167 will fail so the entry won't be
in the list to begin with.
2021-11-02 17:53:22 +01:00
thislooksfun 9a70ae1593 LibGUI: Automatically append ': ' after autocompleted GML properties 2021-11-02 17:53:22 +01:00
thislooksfun f7f9d09e72 LibGUI: Remove GUI::AutocompleteProvider::Entry::kind
The only code using it was removed in the previous commit.
2021-11-02 17:53:22 +01:00
thislooksfun f699dbdc3f HackStudio+LibGUI: Handle #include quotes and brackets in the engine
Previously we had a special case in order to auto-append quotes or
angle brackets to #include statements. After the previous commit this
is no longer necessary.
2021-11-02 17:53:22 +01:00
thislooksfun a5b3c3f85f LibGUI: Allow completion suggestions to fill and display different text
There are times when it is nice to display one suggestion but fill
something different. This lays the groundwork for allowing
GMLAutocompleteProvider to automatically add ': ' to the end of
suggested properties, while keeping the ': ' suffix from cluttering up
the suggestion UI.
2021-11-02 17:53:22 +01:00
thislooksfun 96029a4ac6 LibGUI: Replace the already typed text when autocompleting
This was a great optimization before, but it locks us out of some neat
features, like fuzzy matching.
2021-11-02 17:53:22 +01:00
thislooksfun f8c98cbf55 LibGUI: Show autocomplete for Layout properties 2021-11-02 17:53:22 +01:00
thislooksfun b0122744a6 LibGUI: Match layout classes even after you start typing
The previous commit fixed the issue with layout classes not being
suggested at all, but there was still another issue. Once you started
typing the class name a different suggester would take over and only
show widgets. This commit makes it so it still only suggests layouts
in that situation.

This, combined with the last commit, makes autocompleting layouts way
more discoverable and user-friendly. :^)
2021-11-02 17:53:22 +01:00
thislooksfun f048d16be5 LibGUI: Correctly suggest layout classes
Previously when the GMLAutocompleteProvider was invoked just after the
'layout:' tag it would suggest nothing. This is because Layouts do not
inherit from Widget, so the two checks would always eliminate every
suggestion from the list. This patch makes it always suggest any
(registered) object that inherits from GUI::Layout.

This should make layouts more discoverable and easier to quickly use.
2021-11-02 17:53:22 +01:00
thislooksfun 989c111d65 LibGUI: Remove unnecessary curly braces
Not needed for the commit, but I always try to leave the code nicer
than I found it. :)
2021-11-02 17:53:22 +01:00
thislooksfun 416988cc7f LibGUI: Register layouts with inheritance 2021-11-02 17:53:22 +01:00
thislooksfun 6dc2749795 LibGUI: Register GUI::Layout
This will be used later to check inheritence.
2021-11-02 17:53:22 +01:00
thislooksfun 9cf9e604c3 LibCore: Add REGISTER_ABSTRACT_CORE_OBJECT
This behaves identically to REGISTER_CORE_OBJECT, but the resulting
ObjectClassRegistration's construct() method will always return null.
2021-11-02 17:53:22 +01:00
thislooksfun c3b0b9057e LibCore+LibGUI: Make ObjectClassRegistration::construct() nullable
This lays the groundwork for allowing the registration of abstract
core objects, which will be needed for improved GML autocomplete.
2021-11-02 17:53:22 +01:00
Linus Groh 0e537e2e1f LibJS/Tests: Fix arg name in Instant.prototype.toZonedDateTime() test
"item", not "items".
2021-11-02 17:51:02 +01:00
Linus Groh 654380c2c2 LibJS: Implement Temporal.PlainDate.prototype.subtract() 2021-11-02 13:29:25 +01:00
Linus Groh bcd96c80f3 LibJS: Implement Temporal.PlainDate.prototype.add() 2021-11-02 13:29:25 +01:00
Nicolas Danelon b233cdde77 Documentation: Update BuildInstructionsMacOS.md
- gcc@10 is not available for M1, using gcc 11.
- the path to qemu is now dynamic
2021-11-02 12:24:39 +01:00
thislooksfun 03494ed6ba Meta: Add a check to ensure grep -P stays gone
grep -P does not work on macOS, but grep -E does.
2021-11-02 12:23:30 +01:00
thislooksfun a984545a94 Meta: Run find in the current dir
macOS's find requires a leading search scope. Without this change this
lint step fails.
2021-11-02 12:23:30 +01:00
thislooksfun 19bd302f6a Meta: Adhere to latest ScriptCheck standards (SC2268) 2021-11-02 12:23:30 +01:00
thislooksfun 3e32acc3e4 Meta: Add special case for macOS
macOS's `find` does not support the '-executable' flag, nor does it
support the '-perm /' syntax, but we can make it work with a special
case.
2021-11-02 12:23:30 +01:00
thislooksfun 170e956c80 Meta: Remove unnecessary -i
Using `xargs -i <cmd> {}` is just doing the default behavior of xargs,
but with extra steps that also don't work on macOS.
2021-11-02 12:23:30 +01:00
thislooksfun c2d44209a8 Meta: Use grep -E/F, not grep -P
grep -E and -F are POSIX standard, and meets all our matching needs.
2021-11-02 12:23:30 +01:00
Musab Kılıç 4de7b3ad24 PixelPaint: Map color_distance_squared from 0 to 1 2021-11-02 12:20:48 +01:00
Ben Wiederhake 686efb6737 ConfigureComponents: Reduce duplicated code 2021-11-02 11:36:23 +01:00
Brian Gianforcaro 9f6eabd73a Kernel: Move TTY subsystem to use KString instead of AK::String
This is minor progress on removing the `AK::String` API from the Kernel
in the interest of improving OOM safety.
2021-11-02 11:34:31 +01:00
Brian Gianforcaro 71f05c70b4 Kernel: Remove duplicate constructor from TTY/VirtualConsole
This removes some code dupe from the constructors.

By removing this duplicate constructor we can utilize the main
VirtualConsole::create factory implementation and call that from the
VirtualConsole::create_with_preset_log factory method.
2021-11-02 11:34:31 +01:00
Brian Gianforcaro 2c85f65519 Kernel: Switch BIOSSysFSComponent constructor to AK::StringView
These are constants, they don't need to be dynamically allocated.
Another minor step towards removing `AK::String` from the Kernel
and improving OOM safety.
2021-11-02 11:34:31 +01:00
Linus Groh 897471c852 Meta: Don't check for toolchain if serenity.sh target is lagom
This is just silly :^)

    $ serenity run lagom js
    WARNING: unknown toolchain 'js'. Defaulting to GNU.
             Valid values are 'Clang', 'GNU' (default)
2021-11-02 11:09:05 +01:00
Jelle Raaijmakers 0909bbfe38 Documentation: Update required Qemu dev packages
Without `libspice-server-dev`, Qemu will build without SPICE support.
2021-11-02 11:08:17 +01:00
Ben Wiederhake 59619572d6 LibThreading: Remove redundant method 2021-11-02 11:07:26 +01:00
Ben Wiederhake 17d95bc1db Utilities: Remove misbehaving-application
This used to be a target to demonstrate a bug in Inspector (#3159).
However, now that the inspection direction has inverted, this no longer
makes any sense.
2021-11-02 11:07:07 +01:00
Idan Horowitz 19e28d5798 LibWeb: Convert is_named_property_exposed_on_object to ThrowCompletions
This is the last usage of old-style exceptions in the WrapperGenerator.
2021-11-02 10:41:25 +02:00
Linus Groh 07b0aded99 LibJS: Implement Temporal.PlainDateTime.prototype.subtract() 2021-11-02 09:24:35 +01:00
Linus Groh c4e371b3da LibJS: Implement Temporal.PlainDateTime.prototype.add() 2021-11-02 09:24:35 +01:00
Linus Groh 643a2433db LibJS: Enable Temporal.Calendar.prototype.dateAdd() test that now passes 2021-11-02 09:24:35 +01:00
Linus Groh d49bbb1da3 LibJS: Implement TODO()'d parts of balance_duration()
Massive :yakstack:, so I understand why it was skipped in the first
place :^)
2021-11-02 09:24:35 +01:00
Luke Wilde 17fd08d752 LibJS: Implement Temporal.PlainTime.prototype.subtract()
a
2021-11-01 23:51:23 +01:00