David Lechner
62d7fdff36
editor/sagas: disable code completion trigger on space
...
This gets in the way when typing comments and often results in
accepting a completion that was not intended.
Fixes: https://github.com/pybricks/support/issues/894
2022-12-30 16:07:52 -06:00
David Lechner
7d5c9710e5
editor/sagas: fix signature trigger characters
...
The intended behavior is that comma should trigger signature help when
it is not showing. retrigger only triggers if already showing.
2022-12-30 16:04:48 -06:00
David Lechner
d119cb564e
editor: fix find widget z-index
...
When open, the find widget was visible above modal dialogs because
of z-index.
2022-12-30 14:08:36 -06:00
David Lechner
810ee362c6
editor/sagas: maintain jedi sort order
...
Now that jedi returns names that start with `_`, we need to make sure
they don't end up at the top of the list for completions.
2022-12-28 17:23:59 -06:00
David Lechner
a981bcbda2
editor/pybricksMicroPython: fix numeric literal highlighting
...
This was picking up leading underscores, e.g. the first `__` in
`__name__`.
2022-12-28 16:40:43 -06:00
David Lechner
1482e9f197
editor/pybricksMicroPython: add constant formatting
2022-12-27 17:35:11 -06:00
David Lechner
098c8e60ab
editor/pybricksMicroPython: add Side to hub template
...
This is included in pybricks.parameters on all hubs.
2022-12-27 17:35:11 -06:00
David Lechner
43a6f63eaf
editor/pybricksMicroPython: improve f-string highlighting
...
Fixes: https://github.com/pybricks/support/issues/875
2022-12-27 17:35:11 -06:00
David Lechner
5bef7e2637
editor/pybricksMicroPython: improve operator highlighting
...
This handles newer things like the := operator better.
2022-12-27 17:35:11 -06:00
David Lechner
1db0c48844
editor/pybricksMicroPython: improve numeric literal highlighting
...
- Drop Python 2.x "L" suffix.
- Add support for underscores.
- Drop including leading minus sign.
- Add support for binary.
- Add support for octal.
2022-12-27 17:35:11 -06:00
David Lechner
27b8b1e428
editor: fix iOS keyboard button position
2022-12-21 19:44:11 -06:00
David Lechner
f4598db3a4
use console.error instead of console.log for unexpected errors
2022-12-17 14:04:12 -06:00
David Lechner
b8a1c70536
editor: remove console.log
...
This was from debugging and was missed.
2022-12-17 14:04:12 -06:00
David Lechner
9d71bb4734
eslint: enable react-hooks checks
...
Also fix all errors, which can lead to subtile bugs.
Mostly fixings deps and refactoring to make typescript happy.
2022-12-17 13:56:01 -06:00
David Lechner
8d05a73770
editor: fix aria labels on tablist and tabpanel
2022-12-16 17:54:36 -06:00
David Lechner
dc27d45f20
editor: hide welcome logo from screen readers
...
The welcome logo/animation is just for fun/looks so screen readers
don't need to know about it.
2022-12-16 17:54:36 -06:00
Laurens Valk
3e56a6b493
editor/translations: Copy edit.
2022-12-15 14:59:36 -06:00
David Lechner
cc20ab8c35
editor: move docs toggle from settings
...
This removes the docs toggle switch from the settings and adds a new
docs toggle button to the editor.
Fixes: https://github.com/pybricks/support/issues/778
2022-12-06 15:38:58 -06:00
David Lechner
05445c1b07
settings: use sessionStorage for doc state
...
This adds use of sessionStorage for the documentation visibility toggle.
This way, when multiple windows are open, the docs can be controlled
separately in each window. Local storage is still used as the default
value for new windows.
Issue: https://github.com/pybricks/support/issues/807
2022-12-06 15:38:58 -06:00
Laurens Valk
65e5e6af08
editor/welcome: Stop on click.
...
Don't reset the position.
2022-12-02 09:20:08 +01:00
David Lechner
6a979cafa8
editor: add pybricks logo welcome
2022-12-01 17:08:19 -06:00
David Lechner
3a0130d73f
editor: fix spinner jumping to top on page load
2022-12-01 17:08:19 -06:00
David Lechner
35cef50e44
editor: drop use of react-monaco-editor
...
The upstream package is currently broken and doesn't actually save us
any work.
2022-12-01 17:08:19 -06:00
David Lechner
e01fb1fbe9
eslint: strict equality
...
Enforce use of ===/!== and fix existing issues.
2022-11-23 17:20:45 -06:00
David Lechner
bb8015eae5
test: finish TODO for escape key hack
...
Fix was merged upstream so we can remove the hack.
2022-11-22 15:56:56 -06:00
David Lechner
db438be40b
editor: finish remove hack TODO
...
The upstream fix was merged, so the workaround is no longer needed.
2022-11-22 15:56:56 -06:00
David Lechner
ede6f80f49
explorer/newFileWizard: add empty file option
...
Fixes: https://github.com/pybricks/pybricks-code/issues/771
2022-10-28 18:01:39 -05:00
David Lechner
694b064683
remove unnecessary {}
2022-10-27 13:17:51 -05:00
David Lechner
0725203d66
app: lazy-load terminal
...
This changes the terminal sagas and components to be lazy loaded to
improve time until first render.
2022-10-27 13:17:51 -05:00
David Lechner
c49f37f5e4
editor: lazy load
...
This makes the required changes needed to make the editor components
and sagas lazy-load to improve the time before the first render of the
app.
This is done by making sure we only import types from the monaco editor
module anywhere other than the saga and the component modules and using
React.lazy to lazy-load the component and start the sagas.
This cuts the main bundle time to less than 1/2 so load time should be
over twice as fast now.
2022-10-27 13:17:51 -05:00
David Lechner
57c87da464
editor: disable word-based suggestions
...
This turns off the default word-based suggestions. This was useful when
we didn't have proper code completion but now can be distracting.
Fixes: https://github.com/pybricks/support/issues/757
2022-10-25 13:48:02 -05:00
David Lechner
e41a297922
editor: close tab on middle-click
...
Fixes: https://github.com/pybricks/support/issues/758
2022-10-25 12:57:07 -05:00
David Lechner
7e726fffaf
mpy/alerts: implement compiler error
...
This shows the output from mpy-cross and has a button to go to the
error.
2022-10-19 18:26:37 -05:00
David Lechner
7e2404d583
pybricksMicropython: add support for peer file code completion
...
This allows importing user-created files and getting code completion
for those imports. This is done by mirroring the dexie-based file
system used by the editor to the emscripten based file system used
by pyodide. In the future, ideally we would have some sort of shared
file system, but this works for now.
Note: completing `from ` doesn't list user files/modules because of
filters in the pybricks-jedi python package but completing
`from my_file import ` does work as expected.
2022-09-13 14:19:29 -05:00
David Lechner
d6df128860
i18n: use automatic type inference of translation keys
...
Finally figured out a way to make typescript strongly type translation
keys so we can avoid the tedium of creating enums of translation keys.
2022-07-22 13:48:50 -05:00
David Lechner
b70777178c
editor/sagas: avoid console noise in tests
2022-07-18 14:54:44 -05:00
David Lechner
90cd4865e8
Add support for MPY ABI v6.
...
Pybricks firmware v3.2.0b2 has updated to MicroPython 1.19 which
includes breaking changes to the MPY binary file format.
2022-07-06 12:51:01 -05:00
David Lechner
096eea7077
editor: add basic intellisense
...
This adds basic intellisense for code completion and function signatures
using the Python `jedi` package running in a Pyodide environment.
2022-06-24 19:15:32 -05:00
David Lechner
883807b4b4
fix breaking changes for user-event v14
2022-06-02 18:45:28 -05:00
David Lechner
1403dbb2f5
fix codeql recommendations
...
https://github.com/pybricks/pybricks-code/pull/823/checks?check_run_id=6695406302
2022-06-01 13:27:32 -05:00
David Lechner
41e826d73b
editor: save view state on change
...
Instead of trying to save the view state when a window "closes", which
is unreliable, we just save the state on every change.
2022-05-31 17:43:54 -05:00
David Lechner
818865462e
editor: handle files by uuid
...
This changes things up a bit so that files are handled by uuid instead
of path. The allows for files to be renamed without breaking things.
Also some improvements with persistence of the view state for each
file is made.
2022-05-31 17:21:29 -05:00
David Lechner
a3e55c828a
move useI18n to i18n.ts
...
Since we are using the react-i18n babel loader plugin, useI18n can only
be used once per file. Also we have to remember to add the istanbul
ignore next comment each time we use it. By moving this to a common
file, it can be easily copied and pasted when a new submodule is
created and we don't have to remember the rules when calling it.
2022-05-21 13:57:58 -05:00
David Lechner
e7366c8afd
rework alerts
...
This starts moving alerts to the same subsystem where they are relevant
instead of putting everything in notifications.
So far, only the explorer file in use error is handled like this.
2022-05-20 19:25:18 -05:00
David Lechner
3dc03f3879
editor: save file to correct path
...
previously, all files were being saved as main.py
2022-05-19 10:44:31 -05:00
David Lechner
057ba4bab9
spelling
2022-05-18 18:21:01 -05:00
David Lechner
d02e38795b
editor/sagas: fix error creating model on hot reload
2022-05-18 17:47:29 -05:00
David Lechner
325562996b
replace useUniqueId() with useId()
...
there should only be one way to do a thing...
2022-05-18 17:16:32 -05:00
David Lechner
4580869e6f
editor: don't keep file open when editing
...
Since open takes a lock on the file, it prevented other file operations.
2022-05-18 13:11:06 -05:00
David Lechner
5dc6b2e4cb
util: drop preventBrowserNativeContextMenu
...
This is done once at the top-level app, so is no longer needed.
2022-05-12 19:20:46 -05:00