diff --git a/README.rst b/README.rst index 46ca1ef..654ece0 100644 --- a/README.rst +++ b/README.rst @@ -6,6 +6,15 @@ trame-code |pypi_download| Widget for Monaco VS code editor for trame +The editor can surface language features (autocomplete and hover +documentation) from your own server-side callbacks: pass ``completion`` +and ``hover`` callables to the widget. The example below shows Python/VTK +completion and a hover docstring driven entirely from those callbacks. + +.. image:: https://raw.githubusercontent.com/Kitware/trame-code/master/docs/completion-hover.png + :alt: Monaco editor showing Python/VTK completion and a hover docstring + :align: center + License ----------------------------------------------------------- diff --git a/docs/completion-hover.png b/docs/completion-hover.png new file mode 100644 index 0000000..03f1276 Binary files /dev/null and b/docs/completion-hover.png differ diff --git a/src/trame_code/module/__init__.py b/src/trame_code/module/__init__.py index 3e9bf6d..d36a198 100644 --- a/src/trame_code/module/__init__.py +++ b/src/trame_code/module/__init__.py @@ -1,16 +1,22 @@ from pathlib import Path +from trame_code import __version__ + # Compute local path to serve serve_path = str(Path(__file__).with_name("serve").resolve()) +# Version the served directory so a client re-fetches JS/CSS after an upgrade +# instead of getting a stale bundle from the browser cache. +serve_directory = f"__trame_code_{__version__}" + # Serve directory for JS/CSS files -serve = {"__trame_code": serve_path} +serve = {serve_directory: serve_path} # List of JS files to load (usually from the serve path above) -scripts = ["__trame_code/trame-code.umd.js"] +scripts = [f"{serve_directory}/trame-code.umd.js"] # List of CSS files to load (usually from the serve path above) -styles = ["__trame_code/style.css"] +styles = [f"{serve_directory}/style.css"] # List of Vue plugins to install/load vue_use = ["trame_code"]