Commit Graph
90 Commits
Author SHA1 Message Date
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
David Lechner fa0a9a109c editor: improve a18y and visual appearance 2022-05-12 16:14:48 -05:00
David Lechner edd8ebfd64 Add Activities
This adds a new Activities tab list and view similar to VS code. The
Explorer and Settings are migrated to this view.
2022-05-12 12:33:21 -05:00
David Lechner 65623f801d update for breaking blueprintjs style changes
it is no longer feasible to build the blueprintjs css ourselves, so we
just use all of the default variable values and override things using
selectors instead.
2022-05-11 18:13:36 -05:00
David Lechner 5ee74187eb optimize svgs
The new webpack doesn't like the xml namespaces and refuses to compile
so we have to save the svg files in optimized form.
2022-05-10 20:26:58 -05:00
David Lechner 8ffaf64292 fileStorage: add file create option
When opening a file, sometimes we want to create it if it does not
exist and sometimes we don't.
2022-04-08 18:29:05 -05:00
David Lechner 8ac77560fb editor: add tabs for controlling open/active files 2022-04-07 21:17:09 -05:00
David Lechner 158e8f2693 fix typo 2022-04-06 09:01:14 -05:00
David Lechner 89a2019a98 explorer: add action for activating file
this simply forwards the action to the editor module
2022-04-05 18:10:06 -05:00
David Lechner b9dbaaa5cb fileStorage: implement file locks
This breaks down reading and writing into low-level and high level sagas.

Opening now takes a lock on the file so that it can only have one writer
or have multiple readers. The low-level read and write sagas use the
file descriptor to determine if the file is still open before actually
performing the action.

Since we are using the web locks api, these locks should work across
browser tabs/windows.

The high-level read/write sagas perform the low-level open, read/write,
close operations in a single call.

The high-level delete and rename sagas are also updated to take locks
on the files while performing the respective operations and will fail
if the file is already being used somewhere else.
2022-04-04 15:24:08 -05:00
David Lechner 1709591afc fileStorage: untangle file id/name
We were using file UUID and path interchangeable. This adds a new UUID
type for static checking and fixes a bunch of issues found.
2022-04-01 17:24:00 -05:00
David Lechner 1515e5ae4f fileStorage: add file handles
This changes how files work. There is now an open function that
translates a path to a file handle (id). Then this handle is used
to perform other actions on the file. The file contents are moved
to a separate table so that the actual file storage is independent
of the database (e.g. in the future, we may use File Access API).

We store a hash of the file contents in the metadata file so we can
detect file changes without having to compare file contents.

We also separate the change and add actions.
2022-04-01 13:41:10 -05:00
David Lechner 54a475cebc drop 'editor' saga context
This is no longer used.
2022-03-26 13:52:33 -05:00
David Lechner c158e4f0e2 editor: add editorGetValue() saga
This is another step towards removing the 'editor' context.
2022-03-26 13:44:55 -05:00
David Lechner 79d5b06136 editor: move isReady state from app
This is a step towards getting rid of the 'editor' context.
2022-03-26 12:03:08 -05:00
David Lechner 3eac7d384f fileStorage/sagas: remove editor init from fileStorage
This is still a bit of a hack but is one step towards being able to
remove the 'editor' context.
2022-03-26 11:49:23 -05:00
David Lechner 3c48d115d7 editor/Editor: use hooks to configure editor
This fixes the issue of the editor not being updated when properties
change.
2022-03-25 17:49:56 -05:00
David Lechner 2be1c26f82 editor/Editor: drop unused argument 2022-03-25 16:26:56 -05:00
David Lechner f36e774d1e coverage: ignore useI18n 2022-03-25 15:54:04 -05:00
David Lechner 9f254f035f i18n: use babel-loader plugin 2022-03-25 15:54:04 -05:00
David Lechner a4660e979c settings: switch to useTernaryDarkMode
useDarkMode kept reverting back to the system default during development
2022-03-15 17:40:46 -05:00