PML for AVEVA E3D — VS Code Extension

Full-featured Language Server Protocol (LSP) extension for AVEVA E3D PML (Programmable Macro Language) in Visual Studio Code.
Languages: English • Русский
English
✨ Features
- 🎨 Syntax Highlighting — Full PML1/PML2 syntax support
- 📝 IntelliSense — Smart autocomplete for keywords, methods, variables
- 🔍 Navigation — Go to Definition, Find References, Document Symbols
- 🧭 Method Usage Preview — Hover a
define method .name(...) declaration to see the first usage locations with file/line links
- 🐛 Diagnostics — Real-time parser and configurable semantic checks
- 🔧 LSP Server — Full Language Server Protocol support
- 📋 Signature Help — Parameter hints for method calls
- 🎯 Hover Information — Quick documentation on hover
- 🗂️ Workspace Indexing — Fast symbol search across project
- 📖 Examples & Tutorials — Built-in gadget examples and documentation (Button Gadgets, Frame Gadgets, etc.)
- 🔢 Array Tools — Smart array indexing, reindexing, and manipulation commands
- 📝 Form Gadget Snippets — Code snippets for Button, Frame, and other form gadgets
- 📚 Context Menus — Quick access to sorting, array manipulation, and form tools
- 🖨️
$P Print Tools — Highlight print/debug lines, show a status count, navigate next/previous, comment, uncomment, or delete print lines
- 🧭 PDMS Command Compatibility — Curated PDMS command starter whitelist for command-style PML lines
🚀 Quick Start
Installation
Option 1: From GitHub Releases (Recommended)
- Download the latest
pml-aveva-e3d-*.vsix from Releases
- In VSCode:
Extensions → ... → Install from VSIX
- Reload VSCode
Option 2: Development Mode
git clone https://github.com/mikhalchankasm/vscode-pml-aveva-e3d.git
cd vscode-pml-aveva-e3d
npm install
npm run compile
# Press F5 in VS Code to launch Extension Development Host
Build VSIX Package
npm run pack # Creates pml-aveva-e3d-X.X.X.vsix
📁 Supported File Types
.pml .pmlobj .pmlfnc .pmlfrm .pmlmac .pmlcmd
Lines that start with $P or $p are treated as PML print/debug output lines:
- full-line highlighting and overview ruler marker;
- active-file counter in the status bar;
- hover actions:
Prev, Next, Comment, Delete, Actions;
- command palette actions: next/previous print, comment all, uncomment all, delete all.
🧭 PDMS Command Starter Whitelist
The parser accepts curated PDMS command-style lines via:
packages/pml-language-server/src/data/pdmsCommands.ts
Entries include the first command word, category, and short hover text. Add only the first command word in lowercase, for example move, add, or q.
⚙️ Diagnostics Settings
pml.diagnostics.formErrors: controls parser diagnostics for .pmlfrm files while form DSL support is still limited.
off (default): suppress form parser diagnostics.
warning: show form parser diagnostics as warnings.
error: show form parser diagnostics as errors.
pml.diagnostics.formReferences: opt-in callback/gadget reference validation for .pmlfrm files.
off (default): do not validate references.
warning: warn when callbacks target missing methods or !this.<name> references an unknown form member/gadget.
error: report those findings as errors.
- Runs only after the form parses without parser errors to avoid cascade noise.
📚 Documentation
🛠️ Development
Project Structure:
vscode-pml-extension/
├── src/ # Extension client code
│ ├── extension.ts # Main entry point
│ ├── languageClient.ts # LSP client
│ └── ...
├── packages/pml-language-server/ # LSP server
│ └── src/
│ ├── server.ts # LSP server main
│ ├── parser/ # PML parser
│ ├── providers/ # LSP providers (completion, hover, etc.)
│ └── diagnostics/ # Error detection
├── syntaxes/ # TextMate grammar
├── objects/ # PML type knowledge base
└── examples/ # Test files
Commands:
npm run compile - Compile TypeScript
npm run watch - Watch mode (auto-compile)
npm run pack - Build VSIX package
npm test - Run tests
🐛 Known Issues
- Form files (.pmlfrm) have limited parser support (intentional - complex DSL)
- Find All References / Rename use workspace text scanning in important paths; AST/index-based lookup is planned after form parser stabilization.
- object ARRAY() syntax may show "Expected expression" warning (parser limitation, does not affect functionality)
📝 License
MIT License - see LICENSE
Русский
✨ Возможности
- 🎨 Подсветка синтаксиса — Полная поддержка PML1/PML2
- 📝 IntelliSense — Умные подсказки для ключевых слов, методов, переменных
- 🔍 Навигация — Переход к определению, поиск ссылок, символы документа
- 🐛 Diagnostics — Real-time parser and configurable semantic checks
- 🔧 LSP сервер — Полная поддержка Language Server Protocol
- 📋 Подсказки параметров — Помощь при вызове методов
- 🎯 Информация при наведении — Быстрая документация
- 🗂️ Индексация проекта — Быстрый поиск символов по всему проекту
- 🖨️ Инструменты
$P — Подсветка print/debug строк, счетчик, переход next/previous, comment/uncomment/delete
- 🧭 Совместимость с PDMS-командами — Редактируемый whitelist стартовых слов PDMS-команд
🚀 Быстрый старт
Установка
Вариант 1: Из GitHub Releases (Рекомендуется)
- Скачайте последний
pml-aveva-e3d-*.vsix из Releases
- В VSCode:
Расширения → ... → Установить из VSIX
- Перезагрузите VSCode
Вариант 2: Режим разработки
git clone https://github.com/mikhalchankasm/vscode-pml-aveva-e3d.git
cd vscode-pml-aveva-e3d
npm install
npm run compile
# Нажмите F5 в VS Code для запуска Extension Development Host
Сборка VSIX пакета
npm run pack # Создаёт pml-aveva-e3d-X.X.X.vsix
📁 Поддерживаемые типы файлов
.pml .pmlobj .pmlfnc .pmlfrm .pmlmac .pmlcmd
🖨️ Инструменты $P
Строки, которые начинаются с $P или $p, подсвечиваются как print/debug output. В редакторе доступен счетчик в status bar, hover-действия и команды для перехода к следующей/предыдущей print-строке, а также comment/uncomment/delete.
🧭 Whitelist PDMS-команд
Whitelist стартовых слов команд лежит здесь:
packages/pml-language-server/src/data/pdmsCommands.ts
Записи содержат первое слово команды, категорию и короткий hover-текст. Добавляйте только первое слово команды в lowercase, например move, add, q.
⚙️ Настройки диагностики
pml.diagnostics.formErrors: управляет parser diagnostics для .pmlfrm, пока поддержка form DSL остается ограниченной.
off (по умолчанию): не показывать parser diagnostics для форм.
warning: показывать parser diagnostics для форм как предупреждения.
error: показывать parser diagnostics для форм как ошибки.
pml.diagnostics.formReferences: опциональная проверка callback/gadget references для .pmlfrm.
off (по умолчанию): не проверять ссылки.
warning: предупреждать, если callback указывает на отсутствующий метод или !this.<name> ссылается на неизвестный member/gadget.
error: показывать такие замечания как ошибки.
- Работает только когда форма парсится без parser errors, чтобы не создавать каскадный шум.
📚 Документация
🛠️ Разработка
Структура проекта:
vscode-pml-extension/
├── src/ # Клиентская часть расширения
│ ├── extension.ts # Точка входа
│ ├── languageClient.ts # LSP клиент
│ └── ...
├── packages/pml-language-server/ # LSP сервер
│ └── src/
│ ├── server.ts # Главный файл LSP сервера
│ ├── parser/ # Парсер PML
│ ├── providers/ # LSP провайдеры (автодополнение, подсказки и т.д.)
│ └── diagnostics/ # Обнаружение ошибок
├── syntaxes/ # TextMate грамматика
├── objects/ # База знаний типов PML
└── examples/ # Тестовые файлы
Команды:
npm run compile - Компиляция TypeScript
npm run watch - Режим наблюдения (авто-компиляция)
npm run pack - Сборка VSIX пакета
npm test - Запуск тестов
🐛 Известные проблемы
- Файлы форм (.pmlfrm) имеют ограниченную поддержку парсера (намеренно - сложный DSL)
- Find All References / Rename use workspace text scanning in important paths; AST/index-based lookup is planned after form parser stabilization.
- object ARRAY() может показывать предупреждение "Expected expression" (ограничение парсера, не влияет на функциональность)
📝 Лицензия
MIT License - см. LICENSE
🤝 Contributing
Contributions are welcome! See CONTRIBUTING.md for guidelines.
💬 Support
Made with ❤️ for AVEVA E3D PML developers