Editor Support
KDAL ships first-party editor support for VS Code and Vim/Neovim.
The Vim files are in the release archives, and kdalup install --profile full
installs them; the VS Code extension is a separate release asset.
VS Code Extension
Section titled “VS Code Extension”The kdal-lang extension provides a full IDE experience for .kdh and .kdc files.
Installation
Section titled “Installation”The extension is not on the VS Code Marketplace yet. Download
kdal-lang-0.2.0.vsix from the v0.2.0 release and install it:
code --install-extension kdal-lang-0.2.0.vsixFeatures
Section titled “Features”| Feature | Description |
|---|---|
| Syntax highlighting | Separate TextMate grammars for .kdh and .kdc |
| Code snippets | .kdh: device, reg, sig - .kdc: driver, onprobe, onremove, onread, onwrite, onsignal, onpower, rr, rw, log |
| Lint on save | Runs kdality lint automatically (configurable) |
| File icons | Distinct icons for .kdh and .kdc |
| Status bar | Shows toolchain version and status |
| Build tasks | Auto-detected task definitions for compile/lint/simulate |
| Context menus | Right-click actions scoped by file language |
Commands
Section titled “Commands”| Command | Shortcut | Scope |
|---|---|---|
| KDAL: Compile Driver | kdal.compile |
.kdc files |
| KDAL: Lint File | kdal.lint |
.kdh and .kdc |
| KDAL: Create New Project | kdal.init |
Always |
| KDAL: Simulate Device | kdal.simulate |
.kdh files |
| KDAL: Generate Device Tree | kdal.dtgen |
.kdh files |
| KDAL: Generate Test | kdal.testgen |
.kdc files |
| KDAL: Show Toolchain Info | kdal.showToolchainInfo |
Always |
Settings
Section titled “Settings”| Setting | Default | Description |
|---|---|---|
kdal.toolchainPath |
"" |
Path to kdalc/kdality binaries |
kdal.stdlibPath |
"" |
Path to stdlib .kdh files |
kdal.lintOnSave |
true |
Run linter automatically on save |
Task Definitions
Section titled “Task Definitions”The extension registers a kdal task type. Example .vscode/tasks.json:
{ "version": "2.0.0", "tasks": [ { "type": "kdal", "command": "compile", "file": "${file}", "label": "KDAL: Compile current file" } ]}Supported commands: compile, lint, simulate, dt-gen, test-gen.
Vim / Neovim Plugin
Section titled “Vim / Neovim Plugin”vim-kdal provides syntax highlighting, filetype detection, compiler
integration, and code folding.
Installation
Section titled “Installation”Choose your preferred plugin manager:
vim-plug:
Plug 'NguyenTrongPhuc552003/kdal', { 'rtp': 'editor/vim/vim-kdal' }lazy.nvim:
{ 'NguyenTrongPhuc552003/kdal', config = function() vim.opt.rtp:append( vim.fn.stdpath('data') .. '/lazy/kdal/editor/vim/vim-kdal' ) end,}Pathogen:
cd ~/.vim/bundlegit clone https://github.com/NguyenTrongPhuc552003/kdal.git# Add to .vimrc:# set rtp+=~/.vim/bundle/kdal/editor/vim/vim-kdalManual / System-wide:
cd editor/vim/vim-kdal./install-vim.sh # copies to ~/.vim/# or with the SDK:kdalup install --profile fullFeatures
Section titled “Features”| Feature | Description |
|---|---|
| Syntax highlighting | Full EBNF grammar coverage for .kdh and .kdc |
| Filetype detection | Automatic for .kdh and .kdc (Vim + Neovim ≥ 0.8 filetype.lua) |
| Comment toggling | Works with gc (vim-commentary) |
| Smart indentation | 4-space indent with smartindent |
| Syntax folding | Fold on brace blocks with zc/zo |
| Compiler plugins | :compiler kdality (lint → quickfix), :compiler kdalc (compile → quickfix) |
Compiler Integration
Section titled “Compiler Integration”" Lint the current file and jump to first warning:compiler kdality:make %
" Compile the current driver and jump to errors:compiler kdalc:make %Errors and warnings populate the quickfix list (:copen).
Plugin Files
Section titled “Plugin Files”| Path | Purpose |
|---|---|
ftdetect/kdal.vim |
Filetype detection (.kdh, .kdc) |
syntax/kdh.vim |
.kdh syntax rules |
syntax/kdc.vim |
.kdc syntax rules |
ftplugin/kdh.vim |
.kdh comment/indent settings |
ftplugin/kdc.vim |
.kdc comment/indent settings |
compiler/kdality.vim |
:compiler kdality - lint |
compiler/kdalc.vim |
:compiler kdalc - compile |
plugin/kdal.vim |
Plugin entry point |
filetype.lua |
Neovim ≥ 0.8 detection |