├── .gitignore ├── .vscode └── launch.json ├── CHANGELOG.md ├── LICENSE ├── README.md ├── images └── icon.png ├── language-configuration.json ├── package.json ├── script ├── bootstrap └── publish ├── syntaxes └── dts.tmLanguage.json └── vsc-extension-quickstart.md /.gitignore: -------------------------------------------------------------------------------- 1 | *.vsix -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | // A launch configuration that launches the extension inside a new window 2 | { 3 | "version": "0.1.1", 4 | "configurations": [ 5 | { 6 | "name": "Launch Extension", 7 | "type": "extensionHost", 8 | "request": "launch", 9 | "runtimeExecutable": "${execPath}", 10 | "args": ["--extensionDevelopmentPath=${workspaceRoot}" ] 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | All notable changes to the "devicetree" extension will be documented in this file. 3 | 4 | The format is based on [Keep a Changelog](http://keepachangelog.com/) 5 | and this project adheres to [Semantic Versioning](http://semver.org/). 6 | 7 | ## [0.1.1] - 2018-09-19 8 | ### Added 9 | - Support for `.dtso` files 10 | 11 | ## [0.1.0] - 2017-01-20 12 | ### Added 13 | - DeviceTree logo as extension icon 14 | 15 | ## [0.0.1] - 2017-01-19 16 | ### Added 17 | - Initial release 18 | - Grammar specification 19 | - Syntax highlighting -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Pietro Lorefice 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DeviceTree Language Support for Visual Studio Code 2 | 3 | Syntax highlighting for DeviceTree (`.dts`) files in VSCode. 4 | 5 | ## Features 6 | 7 | * Syntax highlighting 8 | 9 | ## Requirements 10 | 11 | The extension supports VSCode `1.5.0` and above. 12 | 13 | ## How to install 14 | 15 | * Open the command palette (`Shift-Ctrl-P`) in VSCode 16 | * Select `Extensions: Install Extensions` 17 | * Search for `DeviceTree` and install it 18 | * Reload the editor to start using it 19 | 20 | ## Known Issues 21 | 22 | None so far :) 23 | 24 | ## Release Notes 25 | 26 | See [changelog](https://github.com/plorefice/vscode-devicetree/blob/master/CHANGELOG.md) 27 | 28 | ## License 29 | 30 | [MIT](https://github.com/plorefice/vscode-devicetree/blob/master/LICENSE) -------------------------------------------------------------------------------- /images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/plorefice/vscode-devicetree/d24ace4dbb6da3163fba6672e96238436b34ec84/images/icon.png -------------------------------------------------------------------------------- /language-configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | "comments": { 3 | "lineComment": "//", 4 | "blockComment": [ "/*", "*/" ] 5 | }, 6 | "brackets": [ 7 | ["{", "}"], 8 | ["[", "]"], 9 | ["(", ")"] 10 | ], 11 | "autoClosingPairs": [ 12 | ["{", "}"], 13 | ["[", "]"], 14 | ["(", ")"], 15 | ["\"", "\""], 16 | ["<", ">"] 17 | ], 18 | "surroundingPairs": [ 19 | ["{", "}"], 20 | ["[", "]"], 21 | ["(", ")"], 22 | ["\"", "\""], 23 | ["'", "'"] 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "devicetree", 3 | "displayName": "DeviceTree", 4 | "description": "DeviceTree Language Support for Visual Studio Code", 5 | "version": "0.1.1", 6 | "icon": "images/icon.png", 7 | "publisher": "plorefice", 8 | "author": { 9 | "name": "Pietro Lorefice" 10 | }, 11 | "engines": { 12 | "vscode": "^1.5.0" 13 | }, 14 | "homepage": "https://github.com/plorefice/vscode-devicetree", 15 | "repository": { 16 | "type": "git", 17 | "url": "https://github.com/plorefice/vscode-devicetree.git" 18 | }, 19 | "bugs": { 20 | "url": "https://github.com/plorefice/vscode-devicetree/issues" 21 | }, 22 | "categories": [ 23 | "Programming Languages" 24 | ], 25 | "contributes": { 26 | "languages": [{ 27 | "id": "dts", 28 | "aliases": ["DeviceTree", "dts"], 29 | "extensions": [".dts",".dtsi", ".dtso"], 30 | "configuration": "./language-configuration.json" 31 | }], 32 | "grammars": [{ 33 | "language": "dts", 34 | "scopeName": "source.dts", 35 | "path": "./syntaxes/dts.tmLanguage.json" 36 | }] 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /script/bootstrap: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # script/bootstrap 4 | # Resolve all the dependencies required by the application to run. 5 | 6 | set -eu 7 | 8 | cd "$(dirname "$0")/.." 9 | 10 | # Check if a specific program is already installed and available 11 | check_installed() 12 | { 13 | [ -n "$(command -v $1)" ] && return 0 || return 1 14 | } 15 | 16 | # vsce required for deploy 17 | if ! check_installed vsce; then 18 | npm install -g vsce 19 | fi 20 | 21 | -------------------------------------------------------------------------------- /script/publish: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # script/publish 4 | # Publish the extension to the marketplace 5 | 6 | set -eu 7 | 8 | cd "$(dirname "$0")/.." 9 | 10 | # Install the required tools 11 | ./script/bootstrap 12 | 13 | # Publish extension 14 | VERSION=$(grep version package.json | sed 's|.*"version": "\(.*\)",.*|\1|') 15 | 16 | read -p "You are about to release v.${VERSION} of the extension. Proceed? [Y/n] " -n 1 -r 17 | echo 18 | 19 | if [[ $REPLY =~ ^[Yy]$ ]]; then 20 | vsce publish 21 | fi 22 | 23 | -------------------------------------------------------------------------------- /syntaxes/dts.tmLanguage.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", 3 | "scopeName": "source.dts", 4 | "name": "DTS", 5 | "comment": "DeviceTree Language syntax", 6 | "fileTypes": [ 7 | "dts", "dtsi" 8 | ], 9 | "patterns": [ 10 | { 11 | "comment": "Line comments", 12 | "begin": "//", 13 | "beginCaptures": { 14 | "0": { 15 | "name": "punctuation.definition.comment.dts" 16 | } 17 | }, 18 | "end": "$", 19 | "name": "comment.line.double-slash.dts" 20 | }, 21 | { 22 | "comment": "Include directives", 23 | "match": "(#include)(\\s+(<|\")([^>\"]*)(>|\"))", 24 | "captures": { 25 | "1": { 26 | "name": "keyword.directive.dts" 27 | }, 28 | "2": { 29 | "name": "string.quoted.double.dts" 30 | }, 31 | "3": { 32 | "name": "punctuation.definition.string.begin.dts" 33 | }, 34 | "4": { 35 | "name": "entity.name.include.dts" 36 | }, 37 | "5": { 38 | "name": "punctuation.definition.string.end.dts" 39 | } 40 | } 41 | }, 42 | { 43 | "comment": "Binary properties", 44 | "begin": "\\[", 45 | "end": "\\]", 46 | "name": "constant.numeric.dts" 47 | }, 48 | { 49 | "comment": "String literals", 50 | "begin": "\"", 51 | "beginCaptures": { 52 | "0": { 53 | "name": "punctuation.definition.string.begin.dts" 54 | } 55 | }, 56 | "end": "\"", 57 | "endCaptures": { 58 | "0": { 59 | "name": "punctuation.definition.string.end.dts" 60 | } 61 | }, 62 | "name": "string.quoted.double.dts", 63 | "patterns": [ 64 | { 65 | "include": "#strings" 66 | } 67 | ] 68 | }, 69 | { 70 | "comment": "Labels", 71 | "match": "^\\s*([0-9a-zA-Z_\\-+,.]+):", 72 | "captures": { 73 | "1": { 74 | "name": "entity.name.type.dts" 75 | } 76 | } 77 | }, 78 | { 79 | "comment": "Node names", 80 | "match": "(/|([[:alpha:][:digit:]\\-_]+)(@[0-9a-fA-F]+)?)\\s*{", 81 | "captures": { 82 | "1": { 83 | "name": "entity.name.function.dts" 84 | } 85 | } 86 | }, 87 | { 88 | "comment": "Cell properties", 89 | "begin": "<", 90 | "beginCaptures": { 91 | "0": { 92 | "name": "punctuation.definition.list.begin.dts" 93 | } 94 | }, 95 | "end": ">", 96 | "endCaptures": { 97 | "0": { 98 | "name": "punctuation.definition.list.end.dts" 99 | } 100 | }, 101 | "patterns": [ 102 | { 103 | "include": "#references" 104 | }, 105 | { 106 | "include": "#numbers" 107 | }, 108 | { 109 | "include": "#macros" 110 | }, 111 | { 112 | "include": "#blockcomments" 113 | } 114 | ] 115 | }, 116 | { 117 | "include": "#references" 118 | }, 119 | { 120 | "include": "#blockcomments" 121 | } 122 | ], 123 | "repository": { 124 | "brackets": { 125 | "patterns": [ 126 | { 127 | "match": "\\{|\\}", 128 | "name": "punctuation.other.bracket.curly.go" 129 | }, 130 | { 131 | "match": "\\(|\\)", 132 | "name": "punctuation.other.bracket.round.go" 133 | }, 134 | { 135 | "match": "\\[|\\]", 136 | "name": "punctuation.other.bracket.square.go" 137 | } 138 | ] 139 | }, 140 | "keywords": { 141 | "patterns": [ 142 | { 143 | "match": "\\b#include\\b", 144 | "name": "keyword.directive.dts" 145 | } 146 | ] 147 | }, 148 | "strings": { 149 | "name": "string.quoted.double.dts", 150 | "begin": "\"", 151 | "end": "\"", 152 | "patterns": [ 153 | { 154 | "name": "constant.character.escape.dts", 155 | "match": "\\\\." 156 | } 157 | ] 158 | }, 159 | "blockcomments": { 160 | "name": "comment.block.dts", 161 | "begin": "/\\*", 162 | "end": "\\*/", 163 | "patterns": [ 164 | { 165 | "name": "punctuation.definition.comment.dts", 166 | "match": "\\\\." 167 | } 168 | ] 169 | }, 170 | "references": { 171 | "patterns": [ 172 | { 173 | "match": "&[0-9a-zA-Z,._\\-+]+", 174 | "name": "variable.name.dts" 175 | } 176 | ] 177 | }, 178 | "numbers": { 179 | "patterns": [ 180 | { 181 | "match": "(0x[0-9a-fA-F]+|[[:digit:]]+)", 182 | "name": "constant.numeric.dts" 183 | } 184 | ] 185 | }, 186 | "macros": { 187 | "patterns": [ 188 | { 189 | "match": "[0-9a-zA-Z_]+", 190 | "name": "constant.numeric.dts" 191 | } 192 | ] 193 | } 194 | } 195 | } -------------------------------------------------------------------------------- /vsc-extension-quickstart.md: -------------------------------------------------------------------------------- 1 | # Welcome to your VS Code Extension 2 | 3 | ## What's in the folder 4 | * This folder contains all of the files necessary for your extension 5 | * `package.json` - this is the manifest file in which you declare your language support and define 6 | the location of the grammar file that has been copied into you extension. 7 | * `syntaxes/dts.tmLanguage.json` - this is the Text mate grammar file that is used for tokenization 8 | * `language-configuration.json` - this the language configuration, defining the tokens that are used for 9 | comments and brackets. 10 | 11 | ## Get up and running straight away 12 | * Make sure the language configuration settings in `language-configuration.json` are accurate 13 | * press `F5` to open a new window with your extension loaded 14 | * create a new file with a file name suffix matching your language 15 | * verify that syntax highlight works and that the language configuration settings are working 16 | 17 | ## Make changes 18 | * you can relaunch the extension from the debug toolbar after making changes to the files listed above 19 | * you can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes 20 | 21 | ## Add more language features 22 | * To add features such as intellisense, hovers and validators check out the VS Code extenders documentation at 23 | https://code.visualstudio.com/docs 24 | 25 | ## Install your extension 26 | * To start using your extension with Visual Studio Code copy it into the /.vscode/extensions folder and restart Code. 27 | * To share your extension with the world, read on https://code.visualstudio.com/docs about publishing an extension. --------------------------------------------------------------------------------