Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add codemirror extension example #231

Merged
merged 5 commits into from
Apr 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 21 additions & 20 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: master
pull_request:
branches: "*"
branches: '*'

jobs:
build_extensions:
Expand All @@ -14,28 +14,29 @@ jobs:
fail-fast: false
matrix:
example:
- kernel-messaging
- kernel-output
- datagrid
- documents
- hello-world
- signals
- codemirror-extension
- command-palette
- commands
- completer
- contentheader
- context-menu
- launcher
- custom-log-console
- datagrid
- documents
- hello-world
- launcher
- kernel-messaging
- kernel-output
- log-messages
- main-menu
- metadata-form
- notifications
- react-widget
- settings
- signals
- state
- toolbar-button
- widgets
- completer
- contentheader
- metadata-form
os: [ubuntu-latest, macos-latest, windows-latest]

defaults:
Expand Down Expand Up @@ -75,13 +76,13 @@ jobs:
if: steps.filter.outputs.extension == 'true'
uses: actions/setup-node@v3
with:
node-version: "18.x"
node-version: '18.x'
- name: Install Python
if: steps.filter.outputs.extension == 'true'
uses: actions/setup-python@v4
with:
python-version: "3.11"
architecture: "x64"
python-version: '3.11'
architecture: 'x64'
- name: Get pip cache dir
if: steps.filter.outputs.extension == 'true'
id: pip-cache
Expand Down Expand Up @@ -171,7 +172,7 @@ jobs:
if: steps.filter.outputs.extension == 'true'
uses: actions/setup-node@v3
with:
node-version: "18.x"
node-version: '18.x'
- name: Check config files
if: steps.filter.outputs.extension == 'true'
run: |
Expand All @@ -185,8 +186,8 @@ jobs:
if: steps.filter.outputs.extension == 'true'
uses: actions/setup-python@v4
with:
python-version: "3.11"
architecture: "x64"
python-version: '3.11'
architecture: 'x64'
- name: Get pip cache dir
if: steps.filter.outputs.extension == 'true'
id: pip-cache
Expand Down Expand Up @@ -295,12 +296,12 @@ jobs:
- name: Install node
uses: actions/setup-node@v3
with:
node-version: "18.x"
node-version: '18.x'
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
architecture: "x64"
python-version: '3.11'
architecture: 'x64'
- name: Get pip cache dir
id: pip-cache
run: |
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

1. [Goal](#tldr)
1. [Develop by Examples](#develop-by-examples)
1. [CodeMirror extension](#codemirror-extension)
1. [Commands](#commands)
1. [Command Palette](#command-palette)
1. [Completer](#completer)
Expand Down Expand Up @@ -90,6 +91,7 @@ You may find it easier to learn how to create extensions _by examples_, instead

Start with the [Hello World](hello-world) and then jump to the topic you are interested in.

- [CodeMirror extension](codemirror-extension)
- [Commands](commands)
- [Command Palette](command-palette)
- [Completer](completer)
Expand Down Expand Up @@ -125,6 +127,12 @@ We have structured the examples based on the [extension points](https://jupyterl

You are welcome to open any [issue](https://github.com/jupyterlab/extension-examples/issues) or [pull request](https://github.com/jupyterlab/extension-examples/pulls).

### [CodeMirror extension](codemirror-extension)

Add a configurable CodeMirror extension.

[![CodeMirror extension](codemirror-extension/preview.png)](codemirror-extension)

### [Commands](commands)

Extend the main app with a Command.
Expand Down
19 changes: 19 additions & 0 deletions codemirror-extension/.copier-answers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_commit: v4.0.2
_src_path: gh:jupyterlab/extension-template
author_email: ''
author_name: Project Jupyter Contributors
data_format: string
file_extension: ''
has_binder: false
has_settings: false
kind: frontend
labextension_name: '@jupyterlab-examples/codemirror-extension'
mimetype: ''
mimetype_name: ''
project_short_description: A minimal JupyterLab extension adding a CodeMirror extension.
python_name: jupyterlab_examples_codemirror_extension
repository: https://github.com/jupyterlab/extension-examples
test: true
viewer_name: ''

125 changes: 125 additions & 0 deletions codemirror-extension/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
*.bundle.*
lib/
node_modules/
*.log
.eslintcache
.stylelintcache
*.egg-info/
.ipynb_checkpoints
*.tsbuildinfo
jupyterlab_examples_codemirror_extension/labextension
# Version file is handled by hatchling
jupyterlab_examples_codemirror_extension/_version.py

# Integration tests
ui-tests/test-results/
ui-tests/playwright-report/

# Created by https://www.gitignore.io/api/python
# Edit at https://www.gitignore.io/?templates=python

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage/
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# Mr Developer
.mr.developer.cfg
.project
.pydevproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# End of https://www.gitignore.io/api/python

# OSX files
.DS_Store

# Yarn cache
.yarn/
6 changes: 6 additions & 0 deletions codemirror-extension/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
**/node_modules
**/lib
**/package.json
!/package.json
jupyterlab_examples_codemirror_extension
3 changes: 3 additions & 0 deletions codemirror-extension/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
enableImmutableInstalls: false

nodeLinker: node-modules
29 changes: 29 additions & 0 deletions codemirror-extension/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
BSD 3-Clause License

Copyright (c) 2023, Project Jupyter Contributors
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Loading