{"id":29092395,"url":"https://github.com/parisneo/toml_hilighter","last_synced_at":"2025-06-28T07:06:43.484Z","repository":{"id":289551739,"uuid":"971518250","full_name":"ParisNeo/toml_hilighter","owner":"ParisNeo","description":"A vscode extention to hilight toml files","archived":false,"fork":false,"pushed_at":"2025-06-05T07:57:06.000Z","size":2381,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-05T08:42:52.449Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ParisNeo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-23T16:35:46.000Z","updated_at":"2025-06-05T07:57:09.000Z","dependencies_parsed_at":"2025-04-23T21:45:02.277Z","dependency_job_id":null,"html_url":"https://github.com/ParisNeo/toml_hilighter","commit_stats":null,"previous_names":["parisneo/toml_hilighter"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ParisNeo/toml_hilighter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ParisNeo%2Ftoml_hilighter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ParisNeo%2Ftoml_hilighter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ParisNeo%2Ftoml_hilighter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ParisNeo%2Ftoml_hilighter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ParisNeo","download_url":"https://codeload.github.com/ParisNeo/toml_hilighter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ParisNeo%2Ftoml_hilighter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262389477,"owners_count":23303342,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-28T07:06:41.418Z","updated_at":"2025-06-28T07:06:43.476Z","avatar_url":"https://github.com/ParisNeo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TOML Highlighting, Validation, Schema \u0026 Autocompletion for VS Code\n\n[![Visual Studio Marketplace Version](https://img.shields.io/visual-studio-marketplace/v/ParisNeo.toml-hilighter?style=flat-square\u0026label=Marketplace)](https://marketplace.visualstudio.com/items?itemName=ParisNeo.toml-hilighter)\n[![Visual Studio Marketplace Installs](https://img.shields.io/visual-studio-marketplace/i/ParisNeo.toml-hilighter?style=flat-square)](https://marketplace.visualstudio.com/items?itemName=ParisNeo.toml-hilighter)\n[![Visual Studio Marketplace Rating](https://img.shields.io/visual-studio-marketplace/r/ParisNeo.toml-hilighter?style=flat-square)](https://marketplace.visualstudio.com/items?itemName=ParisNeo.toml-hilighter)\n\nComprehensive syntax highlighting, **TOML v1.0.0 syntax validation**, **JSON Schema based validation**, and **schema-aware autocompletion** for TOML (Tom's Obvious, Minimal Language) files in Visual Studio Code.\n\n![TOML Highlighting](images/demo.gif)\n![TOML Validation Demo](images/demo2.gif)\n\nThis extension provides detailed syntax highlighting for all TOML v1.0.0 features, adds real-time TOML syntax validation, introduces JSON Schema based validation, and offers schema-driven autocompletion to make your configuration files easier to read, write, and debug.\n\n## Features\n\n*   **Full TOML v1.0.0 Syntax Highlighting:** Covers all TOML data types and structures.\n*   **Real-time TOML Syntax Validation:** Catches TOML syntax errors as you type, powered by [`@ltd/j-toml`](https://github.com/LongTengDao/j-toml).\n*   **JSON Schema Validation:**\n    *   Validates TOML documents against specified JSON Schemas for structural and content correctness.\n    *   Associate schemas via `# $schema:` comments or `toml.schema.associations` setting.\n    *   Supports local and remote (HTTP/HTTPS) schemas.\n    *   Includes schema caching and a \"TOML Schemas\" output channel for diagnostics.\n*   **JSON Schema-based Autocompletion (MVP):**\n    *   Suggests TOML keys based on `properties` in the associated schema.\n    *   Provides autocompletion for `enum` values.\n    *   Suggests `true` and `false` for boolean types.\n    *   Displays schema `description` and `type` for completion items.\n    *   Context-aware suggestions (initial implementation focuses on current table scope and key prefixes).\n*   **Comments, Operators, Structure:** Clear highlighting and scoping.\n*   **Language Configuration:** Bracket matching, auto-closing, commenting (`#`).\n*   **Customizable Colors:** Via TextMate scopes in `settings.json`.\n\n## Installation\n\n1.  Open **Visual Studio Code**.\n2.  Go to the **Extensions** view (`Ctrl+Shift+X` or `Cmd+Shift+X`).\n3.  Search for `TOML Highlighting ParisNeo`.\n4.  Click **Install**.\n5.  Reload VS Code if prompted.\n\nAlternatively, install via the command line:\n```bash\ncode --install-extension ParisNeo.toml-hilighter\n```\n\n## Usage\n\nThe extension automatically activates for `.toml` files.\n\n*   **Syntax Highlighting:** Applied immediately.\n*   **Syntax Validation:** Errors appear in the \"Problems\" panel.\n*   **Schema Validation:** If a schema is associated (see below), violations are reported in \"Problems\".\n*   **Autocompletion:** Triggered as you type or by pressing `Ctrl+Space` (or your configured keybinding). Suggestions for keys and values (enums, booleans) will appear if a schema is active and relevant.\n\n### Associating JSON Schemas\n\n(This section remains the same as before, explaining `$schema` comment and `toml.schema.associations`)\n\nYou can associate a JSON schema with your TOML files in two ways:\n\n1.  **In-file `$schema` comment (Recommended for project-specific schemas):**\n    Add a comment at the top of your TOML file:\n    ```toml\n    # $schema: ./path/to/your/schema.json\n    # or\n    # $schema: https://example.com/remote/schema.json\n\n    title = \"My TOML Configuration\"\n    # ... rest of your TOML content\n    ```\n    Relative paths are resolved against the location of the TOML file. This method takes precedence over settings-based associations.\n\n2.  **VS Code Settings (`toml.schema.associations`):**\n    Configure associations in your `settings.json` (`Ctrl+,` or `Cmd+,`):\n    ```json\n    \"toml.schema.associations\": {\n        \"**/my-project-config.toml\": \"./schemas/project-specific.json\",\n        \"**/another-pattern/*.toml\": \"https://json.schemastore.org/cargo\",\n        \"/Users/me/global_configs/**/conf.toml\": \"/absolute/path/to/global_schema.json\"\n    }\n    ```\n    The key is a glob pattern that matches TOML file paths, and the value is the schema URI (local path relative to the workspace root, absolute path, or an HTTPS URL).\n\n### Schema Validation \u0026 Autocompletion Notes\n\n*   Both schema validation and autocompletion require a successfully parsed TOML document (no syntax errors).\n*   **Validation Errors:** For the initial implementation, schema validation errors are typically placed on the line of the `# $schema` comment or the first line of the document. The diagnostic message will contain the `instancePath` (TOML path) and the error message from `ajv`.\n*   **Autocompletion Context:** The current autocompletion is an MVP. It primarily understands the current table context (e.g., keys within `[table.name]`) and simple key prefixes. More complex TOML structures for context detection (like inline tables or deeply nested keys defined non-sequentially) will be improved in future versions.\n*   The \"TOML Schemas\" output channel (`View \u003e Output`, then select \"TOML Schemas\" from the dropdown) provides logs related to schema loading, validation, and completion activity.\n\n## Configuration\n\nThis extension offers the following settings (accessible via `settings.json`):\n\n*   `toml.schema.enableValidation` (boolean, default: `true`):\n    Enable or disable JSON Schema validation for TOML files.\n*   `toml.schema.enableCompletions` (boolean, default: `true`):\n    Enable or disable JSON Schema-based autocompletion for TOML files.\n*   `toml.schema.associations` (object, default: `{}`):\n    Associate TOML files matching glob patterns with JSON Schemas.\n    Example: `{ \"**/mypackage.toml\": \"./schemas/mypackage.schema.json\" }`\n*   `toml.schema.cache.maxSize` (integer, default: `20`):\n    Maximum number of compiled schemas to keep in the cache. Set to `0` to disable caching (not recommended for remote schemas).\n\n## Customization (Highlighting)\n\n(This section remains the same as before)\n\nYou can customize the syntax highlighting colors by targeting the TextMate scopes used in this extension within your VS Code `settings.json`. The default customizations provide examples:\n\n```json\n\"editor.tokenColorCustomizations\": {\n    \"[toml]\": { // Apply only to TOML files\n        \"textMateRules\": [\n            {\n                \"name\": \"TOML Sections (User Override)\",\n                \"scope\": [\n                    \"entity.name.section.table.toml\",\n                    \"entity.name.section.array.table.toml\",\n                    \"punctuation.definition.table.begin.toml\",\n                    \"punctuation.definition.table.end.toml\",\n                    \"punctuation.definition.table.array.begin.toml\",\n                    \"punctuation.definition.table.array.end.toml\",\n                    \"entity.name.section.key.quoted.toml\"\n                 ],\n                \"settings\": {\n                    \"foreground\": \"#C586C0\"\n                }\n            },\n            {\n                \"name\": \"TOML Keys (User Override)\",\n                \"scope\": [\n                   \"variable.other.key.toml\"\n                ],\n                \"settings\": {\n                   \"foreground\": \"#9CDCFE\"\n                }\n            }\n        ]\n    }\n}\n```\n\nRefer to the `syntaxes/toml.tmLanguage.json` file for a full list of scopes.\n\n## Dependencies\n\n*   [`@ltd/j-toml`](https://github.com/LongTengDao/j-toml): For parsing and validating TOML syntax.\n*   [`ajv`](https://ajv.js.org/): For JSON Schema validation.\n*   [`ajv-formats`](https://github.com/ajv-validator/ajv-formats): For additional format validation in Ajv.\n\nThese dependencies are bundled with the extension.\n\n## Contributing\n\nContributions, issues, and feature requests are welcome! Please check the [repository issues](https://github.com/ParisNeo/toml_hilighter/issues) page.\n\n## License\n\nThis extension is licensed under the [MIT License](LICENSE).\n\n---\n\n**Enjoy clearer, more correct, well-structured, and intelligently completed TOML files!**","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparisneo%2Ftoml_hilighter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparisneo%2Ftoml_hilighter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparisneo%2Ftoml_hilighter/lists"}