Commit graph

232 commits

Author SHA1 Message Date
James Westman
078ce2f5b8 cli: Add decompile command
This command converts .ui files to Blueprint, similar to the porting
tool, but on individual files.
2024-08-23 18:29:34 -05:00
James Westman
4d3dc92448 decompiler: Support list accessibility properties 2024-08-23 18:16:02 -05:00
Julian Schmidhuber
3dfce3bbe0 Allow for multiple a11y properties 2024-08-18 13:17:41 +02:00
James Westman
b308adc3af Remove backslash from f-string expression
This restriction was removed in Python 3.12, but plenty of users still
have older versions.
2024-08-15 18:28:29 -05:00
James Westman
22514b96dc completions: Fix invalid escape sequence 2024-07-29 17:36:41 -05:00
James Westman
c1a82a034b decompiler: Add more decompilable tags
Add more tags to the list of things the decompiler can handle. This
required some changes to track the containing object class in the
DecompileCtx, since some objects use the same tag names.

The improved support means we can test the decompiler on most of the
test suite. Any new test samples will by default be tested to ensure the
decompiler produces the original blueprint file.

Also, updated the decompiler to always use double quotes.
2024-07-26 23:05:37 -05:00
James Westman
ea4c7245be errors: Show error length with carets
Use multiple carets to show the span of the error (up to the end of the
first line), rather than just a caret on the first character.
2024-07-27 03:38:43 +00:00
James Westman
2dcf0c154b errors: Fix caret when tabs are present
Replace all tabs with two spaces and account for that when positioning
the caret under the error location.
2024-07-27 03:38:43 +00:00
James Westman
9570dceaa8 errors: In suggestions, use "insert" or "remove"
Previously it always said "replace", leading to incorrect wording.
2024-07-27 03:38:43 +00:00
James Westman
8d734f7bbd lsp: Add hover docs for lookup expression props 2024-07-27 02:52:56 +00:00
James Westman
8dfa10019b lsp: Fix online docs links for interfaces 2024-07-27 02:52:56 +00:00
James Westman
24eed1048e gir: Fix assignable_to for template types
If we don't know the template's parent type, we should be able to assign
it to an extern type, since we don't know anything about that either.
2024-07-27 02:40:27 +00:00
James Westman
3a712af4dd Fix crash with bad escape sequence in string array
Invalid escape sequences aren't a fatal parser error, so the AST can be
built even when one is present, in which case the string token is None.
2024-07-26 21:10:33 -05:00
James Westman
b33cc7ccd7
adw-breakpoint: Fix bug when setting template prop
When a breakpoint setter's target object was the template, the compiler
failed with an assertion error. Fixed by allowing TemplateType objects
there. The assertion is still needed to make the type checker happy.
2024-07-22 20:31:15 -05:00
Sonny Piers
adc2be1454 Support template without parent 2024-07-04 22:14:16 +00:00
Sonny Piers
896dd7f824 fix linter 2024-07-04 22:07:02 +00:00
Sonny Piers
b76f4eef50 lsp: Use snippet for object completion 2024-07-04 22:07:02 +00:00
Sonny Piers
8c102cf9dc lsp: Fix syntax for signal completion 2024-07-04 22:07:02 +00:00
Sonny Piers
a075b26769 lsp: Extend completion documentation 2024-07-04 22:07:02 +00:00
Diego Augusto
da5b9909fc Support array type 2024-07-04 22:02:51 +00:00
Marco Capypara Köpcke
f1cf70b6eb xgettext compatibility: Output 'yes' for translatable 2024-07-04 22:29:16 +02:00
Sonny Piers
e44494e6e2 decompiler: Use bind instead of bind-property 2024-06-29 13:32:34 +00:00
Szepesi Tibor
6bae860326
lsp: Fix semantic token positions 2024-06-20 13:38:12 +02:00
James Westman
442fff69b6 Fix crash in validate_parent_type
If the type being checked for is not found (e.g. the library is not
installed or is out of date), parent.full_name would be None.
2024-05-30 17:51:40 -05:00
Gregor Niehl
25d08e56cb signals: Support after keyword 2024-05-30 22:34:05 +00:00
James Westman
07e824d8e7 lang: Also allow Gtk.ListHeader in factory template 2024-05-04 12:27:12 -05:00
James Westman
c502dee36b output: Don't add @generated notice to subtemplates
There's already a notice at the top of the file, it doesn't need to be
in subtemplates.

Fixes #158.
2024-05-02 20:19:00 -05:00
James Westman
988e69ab25 lang: Allow ColumnView widgets to be built
Allow BuilderListItemFactory to contain Gtk.ColumnViewRow or
Gtk.ColumnViewCell templates, in addition to Gtk.ListItem templates.
This is necessary for people to use Gtk.ColumnView idiomatically in
Blueprint.

Fixes #157.
2024-05-02 20:19:00 -05:00
Gregor Niehl
84e529a4a8 Formatter CLI: Provide option to suppress diff 2024-04-27 12:04:44 +00:00
James Westman
1c8d7daea2 lsp: Fix deprecation warnings 2024-04-06 14:33:20 -05:00
James Westman
6a078ee075 Add warning for unused imports 2024-04-06 14:33:20 -05:00
Sonny Piers
05d6ff1fd7 Disable completer if applies_in_subclass type is not found
https://gitlab.gnome.org/jwestman/blueprint-compiler/-/merge_requests/177#note_1990521
2024-02-02 11:03:16 +01:00
Sonny Piers
ba8b492134 Add support for Adw.AlertDialog 2024-02-02 11:03:16 +01:00
James Westman
6522421251 Fix formatting 2024-02-01 19:38:19 -06:00
James Westman
a689150a8b errors: Print code actions in error message
Previously they were only exposed by the language server, but now the
command line will print the old and new text.
2024-01-25 20:02:02 -06:00
Gregor Niehl
cb30bec7b1 decompiler: Format resulting Blueprints 2023-12-29 02:30:13 +00:00
James Westman
2e9db2eca5
errors: Fix bug when compiling empty file 2023-12-24 21:40:45 -06:00
Gregor Niehl
0cdccf5f54 Formatter CLI: Error if no files are found 2023-12-22 01:33:17 +00:00
gregorni
e5cde71fc1 Tiny formatter improvements 2023-12-19 02:29:09 +00:00
James Westman
e261180dcc language: Add translation-domain
This allows you to set the translation domain of a blueprint file.
2023-12-13 23:43:29 +00:00
gregorni
c5fa33363f formatter: Handle Inline comments 2023-12-13 02:12:50 +00:00
James Westman
80aaee374d formatter: Tweak whitespace in special cases 2023-11-04 16:54:03 -05:00
James Westman
d39257cabf formatter: Ensure the file ends with one newline 2023-11-04 15:57:31 -05:00
Gregor Niehl
703e2626dd Formatter: Close empty objects on same line 2023-11-04 13:49:56 +00:00
Sonny Piers
3c424d03a4 lsp: Fix bad argument for compile 2023-11-03 23:14:42 +01:00
JCWasmx86
ceb70271fd lsp: Fix classname 2023-11-03 15:26:08 +00:00
Gregor Niehl
4fa64cdf33 Add a formatter 2023-11-03 06:49:22 -05:00
James Westman
2faa9207de tokenizer: Allow escaped newlines
The docs said multi-line strings were possible by escaping the newline
character, but this was not actually implemented.

Fixes #132.
2023-10-26 18:50:07 -05:00
James Westman
09bed9a9f5 tokenizer: Fix QUOTED regex
unescape_quote() assumed that a QUOTED token wouldn't end in the middle
of an escape sequence, but that assumption could fail (a bug found by
the fuzzer).
2023-09-28 18:21:07 -05:00
James Westman
3d5a5521aa decompiler: Use single quotes 2023-09-28 17:18:45 -05:00