Metadata-Version: 2.5
Name: jupyterlab-scilab
Version: 0.1.2
Summary: Scilab syntax highlighting for the JupyterLab CodeMirror editor
Project-URL: Homepage, https://github.com/mottelet/jupyterlab-scilab
Author-email: Stéphane Mottelet <stephane.mottelet@utc.fr>
License: Copyright (c) 2026 Scilab Kernel Developers
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
        EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
        MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
        IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
        DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
        OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
        OR OTHER DEALINGS IN THE SOFTWARE.
License-File: LICENSE.txt
Classifier: Framework :: Jupyter
Classifier: Framework :: Jupyter :: JupyterLab
Classifier: Framework :: Jupyter :: JupyterLab :: 4
Classifier: Framework :: Jupyter :: JupyterLab :: Extensions
Classifier: Framework :: Jupyter :: JupyterLab :: Extensions :: Prebuilt
Requires-Python: >=3.8
Requires-Dist: jupyterlab<5,>=4.0.0
Description-Content-Type: text/markdown

# jupyterlab-scilab

A JupyterLab extension that registers a real "Scilab" CodeMirror language
(`text/x-scilab`), so Scilab notebooks get correct syntax highlighting in
the live editor.

## Install

```bash
pip install jupyterlab-scilab
```

or, together with the kernel itself:

```bash
pip install scilab-kernel[jupyterlab]
```

That's it -- it's a "prebuilt" JupyterLab extension, so no `jlpm`/Node.js
step is needed for end users. [scilab_kernel](https://github.com/Calysto/scilab_kernel)
picks it up automatically once installed: open a notebook with the Scilab
kernel and cells are highlighted. (Requires a scilab_kernel release that
includes [Calysto/scilab_kernel#58](https://github.com/Calysto/scilab_kernel/pull/58);
if you're on an older release, upgrade scilab_kernel first.)

## Colors

In light JupyterLab themes the highlighting uses the default colors of the
SciNotes (Monaco) light theme: structure keywords, `function`/`endfunction`,
control words (`break`, `return`, ...), `%` constants, builtin functions,
strings, numbers, comments, `TODO` comments, operators, delimiters, `:` /
`$` / `...`, and the names and arguments in a `function` header each have
their own color. Dark themes keep JupyterLab's own palette.

## Why this exists

JupyterLab has no built-in Scilab CodeMirror mode. The closest built-in
one is Octave's (Scilab's syntax being close to Octave/Matlab), but
Octave's mode only recognizes `%` as a line comment -- Scilab uses `//` --
so comments aren't styled, and JupyterLab's "Toggle Comment" (Ctrl+/)
would insert invalid Scilab syntax. This extension replaces that stopgap
with a dedicated tokenizer instead (`src/mode.ts`, a CodeMirror 6
`StreamLanguage`, the same style as CodeMirror's own legacy Octave/Matlab
modes): correct `//`/`/* */` comments, correct transpose-vs-string
disambiguation (`x'`, `[1 2 3]'`, `(a+b)'`), and ~2200 keywords/builtins
sourced directly from a real Scilab session's own `getscilabkeywords()`
and `what()` -- not a hand-guessed list.

## Status

Published and wired up: `scilab_kernel` reports `codemirror_mode:
"scilab"` and this extension provides it. Verified end-to-end against a
live JupyterLab 4.6 instance, including previously-tricky cases (`//`
comments, transpose after closing brackets, primitives like
`real`/`imag`/`cvode`/`plot2d2` that Scilab's own `getscilabkeywords()`
doesn't enumerate).

Known gaps, if you'd like to help:

- The keyword/builtin lists in `src/mode.ts` are comprehensive but not
  exhaustive -- Scilab has a very large standard library, and new names
  turn up as people use it. See the comment at the top of `src/mode.ts`
  for how to regenerate them from a Scilab session.
- No automated syntax tests yet.

## Build (for development)

Requires Node.js (18+) in addition to the Python environment JupyterLab is
installed in. Not needed just to use the extension -- see Install above.

```bash
jlpm install                    # installs the JS dependencies
jlpm build                      # compiles src/ and builds the labextension
pip install -e .                # editable install; hatch-jupyter-builder
                                 # links jupyterlab_scilab/labextension into
                                 # JupyterLab's extension search path
jupyter labextension list       # should now list jupyterlab-scilab
```

For iterative development, `jlpm watch` (in one terminal) + `jupyter lab
--watch` (in another) rebuilds on save.

## Layout

- `src/mode.ts` -- the actual Scilab tokenizer (comments, strings, numbers,
  keywords, operators).
- `src/index.ts` -- the JupyterLab plugin that registers `src/mode.ts` with
  `IEditorLanguageRegistry`.
- `package.json` / `tsconfig.json` -- the JS/TS side of the build.
- `pyproject.toml` -- packages the built JS as a pip-installable "prebuilt"
  JupyterLab extension (`hatch-jupyter-builder`), so `pip install
  jupyterlab-scilab` is enough for end users -- no separate `jlpm`/Node.js
  step for them.
