UNIC Config for Visual Studio Code

Language support for UNIC, the Universal
Configuration Format, in Visual Studio Code. The extension works with
*.unic files and does not require Go or a separately installed CLI.
Features
- Syntax highlighting for fields, attributes, lists, maps, strings, comments,
booleans, and numbers.
- Live syntax diagnostics for malformed delimiters, unterminated strings,
missing field terminators, and invalid map entries.
- Canonical document formatting: four-space indentation, normalized whitespace,
safe string quoting, and preserved comments. Invalid documents are not
modified by the formatter.
- Snippets for fields, blocks, blocks with attributes, lists, maps, comments,
and starter documents.
- English and Russian extension metadata.
Semantic validation against an application-specific schema or Go structs is
intentionally outside the scope of this extension.
Example
server web 80 { # public server
host '127.0.0.1';
tags [api, 'public web'];
credentials (user, admin, password, secret);
}
Use Format Document in VS Code to format a valid UNIC document.
UNIC Syntax
UNIC is a text file containing fields, blocks, lists, and maps. Basic rules:
Basic constructs
| Construct |
Example |
Description |
| Field |
key value; |
Assigns a scalar value (string, number, boolean). |
| Block |
key { field1 val1; field2 val2; } |
Groups fields (similar to a struct). |
| List |
key [val1, val2, val3]; |
Ordered collection of values. |
| Map |
key (key1, val1, key2, val2); |
Key‑value pairs (keys are always strings). |
| Attributes |
key attr1 attr2 { ... } |
Values before an opening block brace become struct attributes. |
String escaping
To avoid conflicts with system characters ({}[]();,#), spaces, quotes, or line breaks, the following rules apply:
- If the string contains
", {, }, [, ], (, ), #, ;, , or spaces – enclose it in single quotes: 'hello "world"'.
- If the string contains
', {, }, [, ], (, ), #, ;, , or spaces – enclose it in double quotes: "hello 'world'".
- If the string contains both
' and " as well as special characters or line breaks – use triple backticks: ```hello 'world' "foo"```.
Input must be valid UTF-8. Invalid UTF-8 sequences are rejected with a parse
error.
Example:
message 'Hello, "friend"!';
path "C:\\Program Files\\App";
multiline ```first line
second line```;
Attributes
If values are given before an opening block brace, they are interpreted as struct attributes. The attr=N tag sets the ordinal number (starting from 1).
Example:
server web 80 { host 'localhost'; }
corresponds to the struct:
package main
type Server struct {
Tag string `unic:"tag,attr=1"` // "web"
Port int `unic:"port,attr=2"` // 80
Host string `unic:"host"`
}
Contributing
- Create a branch from
master.
- Make the change and add or update tests.
- Run
make check and make package.
- Open a pull request describing the behavior change.
License
Copyright © 2026 The OSSPkg Team. Distributed under the
BSD 3-Clause License.
| |