# @valtzu/codemirror-lang-el

> Symfony Expression Language language support for CodeMirror

Latest version **1.4.0** (published 2026-01-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install @valtzu/codemirror-lang-el
pnpm add @valtzu/codemirror-lang-el
yarn add @valtzu/codemirror-lang-el
bun add @valtzu/codemirror-lang-el
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.4.0 |
| Published | 2026-01-18 |
| First published | 2023-09-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 7 |
| Unpacked size | 98.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Maintainers | valtzu |

## Links

- npm: https://www.npmjs.com/package/@valtzu/codemirror-lang-el
- Repository: https://github.com/valtzu/codemirror-lang-el
- Homepage: https://github.com/valtzu/codemirror-lang-el#readme
- Issues: https://github.com/valtzu/codemirror-lang-el/issues
- npm.io page: https://npm.io/package/@valtzu/codemirror-lang-el

## Dependencies (7)

- [@lezer/lr](https://npm.io/package/@lezer/lr.md) ^1.0.0
- [@codemirror/lint](https://npm.io/package/@codemirror/lint.md) ^6.4.2
- [@codemirror/view](https://npm.io/package/@codemirror/view.md) ^6.26.3
- [@lezer/highlight](https://npm.io/package/@lezer/highlight.md) ^1.0.0
- [@codemirror/state](https://npm.io/package/@codemirror/state.md) ^6.2.1
- [@codemirror/language](https://npm.io/package/@codemirror/language.md) ^6.0.0
- [@codemirror/autocomplete](https://npm.io/package/@codemirror/autocomplete.md) ^6.9.0

## Recent versions

- 1.4.0 (latest) — 2026-01-18
- 1.3.0 — 2025-11-16
- 1.2.0 — 2025-08-22
- 1.1.0 — 2025-03-29
- 1.0.0 — 2025-03-01
- 0.10.0 — 2025-02-15
- 0.9.0 — 2025-01-26
- 0.8.0 — 2024-12-30
- 0.7.0 — 2024-10-14
- 0.6.2 — 2024-06-15
- 0.6.1 — 2024-06-15
- 0.6.0 — 2024-05-20
- 0.5.3 — 2024-05-18
- 0.5.2 — 2024-04-12
- 0.5.1 — 2024-04-11
- … 9 more at https://npm.io/package/@valtzu/codemirror-lang-el/versions

## README

## Symfony Expression Language support for CodeMirror 6

### Features

#### Linting

![image](https://github.com/user-attachments/assets/7f7dca5b-51fb-41d0-bfe2-d64a6ac6bf85)

1. Lint variable & function names
1. Lint object properties & methods, even on expression result
1. Lint argument count
1. Lint argument types

#### Autocompletion

![image](https://github.com/valtzu/codemirror-lang-el/assets/652734/a5a7bfdc-2869-4cbb-98f6-0abe361d55ba)

1. Complete variables & functions
1. Complete object properties & methods, even on expression result
1. Complete operator keywords (like `starts with`)
1. Show list of all available keywords (using `Ctrl+space` by default)

#### Hover tooltip

![image](https://github.com/valtzu/codemirror-lang-el/assets/652734/3cfd7a49-4503-491c-972d-26d209ea26f3)

1. Show description about a variable / function / object member / keyword

#### Function argument hints

![image](https://github.com/user-attachments/assets/571e056a-3947-4eda-b118-4f1850428fc4)

1. Show function argument name when the editor cursor is exactly at starting position of the argument

---

### Installation

#### Web Component

If you're using Bootstrap UI, check the [Web Component](https://github.com/valtzu/symfony-expression-editor) to hide all CodeMirror stuff.

```html
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<script type="module" src="https://esm.sh/symfony-expression-editor"></script>
<textarea class="form-control" is="expression-editor" rows="1">'foobar' starts with 'foo'</textarea>
```

#### Symfony AssetMapper

```
bin/console importmap:require @valtzu/codemirror-lang-el
```

#### npm

```
npm install @valtzu/codemirror-lang-el
```

#### Yarn

```
yarn add @valtzu/codemirror-lang-el
```

---

### Configuration

See [CONFIGURATION.md](CONFIGURATION.md)

### Example

[Live demo](https://jsfiddle.net/32ybaetz/)

```html
<div id="editor"></div>
<script type="module">
    import { EditorView, basicSetup } from "codemirror";
    import { acceptCompletion } from "@codemirror/autocomplete";
    import { keymap } from "@codemirror/view";
    import { expressionlanguage } from "@valtzu/codemirror-lang-el";
    import { defaultKeymap } from "@codemirror/commands";

    let editor = new EditorView({
        extensions: [
            basicSetup,
            keymap.of([...defaultKeymap, {key: "Tab", run: acceptCompletion}]),
            expressionlanguage({
                types: {
                    "User": {
                        identifiers: [
                            { name: "self", type: ["User"], info: 'Self-reference for property-access demonstration purposes' },
                            { name: "name", type: ["string"] },
                            { name: "age", type: ["int"], info: "Years since birthday", detail: "years" },
                        ],
                        functions: [
                            { name: "isActive", returnType: ["bool"] },
                            { name: "getGroup", args: [], returnType: ["Group"], info: 'Get the user group' },
                        ],
                    },
                    "Group": {
                        identifiers: [{ name: "name", type: ["string"] }]
                    }
                },
                identifiers: [
                    { name: "user", type: ["User"], info: 'This is the user' },
                ],
                functions: [
                    { name: "is_granted", args: [{name: "attributes", type: ["string"]}, {name: "object", type: ["object"], optional: true}], info: 'Check if subject has permission to the object', returnType: ['bool'] },
                ],
            })
        ],
        parent: document.getElementById('editor'),
        doc: 'is_granted(user, user.self.getGroup())',
    });
</script>
```

### Using OpenAI codex

Create `.env` file with
```
OPENAI_API_KEY="..."
```

Then use `docker compose run --rm codex` to develop with AI.

### Contributing

Contributions are welcome.

---
_Source: https://npm.io/package/@valtzu/codemirror-lang-el · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
