|
| 1 | +{ |
| 2 | + // Note that this file should stay in sync with 'typescript-language-basics/language-configuration.json' |
| 3 | + "comments": { |
| 4 | + "lineComment": "//", |
| 5 | + "blockComment": ["/*", "*/"] |
| 6 | + }, |
| 7 | + "brackets": [ |
| 8 | + ["${", "}"], |
| 9 | + ["{", "}"], |
| 10 | + ["[", "]"], |
| 11 | + ["(", ")"] |
| 12 | + ], |
| 13 | + "autoClosingPairs": [ |
| 14 | + { |
| 15 | + "open": "{", |
| 16 | + "close": "}" |
| 17 | + }, |
| 18 | + { |
| 19 | + "open": "[", |
| 20 | + "close": "]" |
| 21 | + }, |
| 22 | + { |
| 23 | + "open": "(", |
| 24 | + "close": ")" |
| 25 | + }, |
| 26 | + { |
| 27 | + "open": "'", |
| 28 | + "close": "'", |
| 29 | + "notIn": ["string", "comment"] |
| 30 | + }, |
| 31 | + { |
| 32 | + "open": "\"", |
| 33 | + "close": "\"", |
| 34 | + "notIn": ["string"] |
| 35 | + }, |
| 36 | + { |
| 37 | + "open": "`", |
| 38 | + "close": "`", |
| 39 | + "notIn": ["string", "comment"] |
| 40 | + }, |
| 41 | + { |
| 42 | + "open": "/**", |
| 43 | + "close": " */", |
| 44 | + "notIn": ["string"] |
| 45 | + } |
| 46 | + ], |
| 47 | + "surroundingPairs": [ |
| 48 | + ["{", "}"], |
| 49 | + ["[", "]"], |
| 50 | + ["(", ")"], |
| 51 | + ["'", "'"], |
| 52 | + ["\"", "\""], |
| 53 | + ["`", "`"], |
| 54 | + ["<", ">"] |
| 55 | + ], |
| 56 | + "autoCloseBefore": ";:.,=}])>` \n\t", |
| 57 | + "folding": { |
| 58 | + "markers": { |
| 59 | + "start": "^\\s*//\\s*#?region\\b", |
| 60 | + "end": "^\\s*//\\s*#?endregion\\b" |
| 61 | + } |
| 62 | + }, |
| 63 | + "wordPattern": { |
| 64 | + "pattern": "(-?\\d*\\.\\d\\w*)|([^\\`\\~\\@\\!\\%\\^\\&\\*\\(\\)\\-\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:\\'\\\"\\,\\.\\<\\>/\\?\\s]+)" |
| 65 | + }, |
| 66 | + "indentationRules": { |
| 67 | + "decreaseIndentPattern": { |
| 68 | + "pattern": "^\\s*[\\}\\]\\)].*$" |
| 69 | + }, |
| 70 | + "increaseIndentPattern": { |
| 71 | + "pattern": "^.*(\\{[^}]*|\\([^)]*|\\[[^\\]]*)$" |
| 72 | + }, |
| 73 | + // e.g. * ...| or */| or *-----*/| |
| 74 | + "unIndentedLinePattern": { |
| 75 | + "pattern": "^(\\t|[ ])*[ ]\\*[^/]*\\*/\\s*$|^(\\t|[ ])*[ ]\\*/\\s*$|^(\\t|[ ])*[ ]\\*([ ]([^\\*]|\\*(?!/))*)?$" |
| 76 | + }, |
| 77 | + "indentNextLinePattern": { |
| 78 | + "pattern": "^((.*=>\\s*)|((.*[^\\w]+|\\s*)(if|while|for)\\s*\\(.*\\)\\s*))$" |
| 79 | + } |
| 80 | + }, |
| 81 | + "onEnterRules": [ |
| 82 | + { |
| 83 | + // e.g. /** | */ |
| 84 | + "beforeText": { |
| 85 | + "pattern": "^\\s*/\\*\\*(?!/)([^\\*]|\\*(?!/))*$" |
| 86 | + }, |
| 87 | + "afterText": { |
| 88 | + "pattern": "^\\s*\\*/$" |
| 89 | + }, |
| 90 | + "action": { |
| 91 | + "indent": "indentOutdent", |
| 92 | + "appendText": " * " |
| 93 | + } |
| 94 | + }, |
| 95 | + { |
| 96 | + // e.g. /** ...| |
| 97 | + "beforeText": { |
| 98 | + "pattern": "^\\s*/\\*\\*(?!/)([^\\*]|\\*(?!/))*$" |
| 99 | + }, |
| 100 | + "action": { |
| 101 | + "indent": "none", |
| 102 | + "appendText": " * " |
| 103 | + } |
| 104 | + }, |
| 105 | + { |
| 106 | + // e.g. * ...| |
| 107 | + "beforeText": { |
| 108 | + "pattern": "^(\\t|[ ])*[ ]\\*([ ]([^\\*]|\\*(?!/))*)?$" |
| 109 | + }, |
| 110 | + "previousLineText": { |
| 111 | + "pattern": "(?=^(\\s*(/\\*\\*|\\*)).*)(?=(?!(\\s*\\*/)))" |
| 112 | + }, |
| 113 | + "action": { |
| 114 | + "indent": "none", |
| 115 | + "appendText": "* " |
| 116 | + } |
| 117 | + }, |
| 118 | + { |
| 119 | + // e.g. */| |
| 120 | + "beforeText": { |
| 121 | + "pattern": "^(\\t|[ ])*[ ]\\*/\\s*$" |
| 122 | + }, |
| 123 | + "action": { |
| 124 | + "indent": "none", |
| 125 | + "removeText": 1 |
| 126 | + } |
| 127 | + }, |
| 128 | + { |
| 129 | + // e.g. *-----*/| |
| 130 | + "beforeText": { |
| 131 | + "pattern": "^(\\t|[ ])*[ ]\\*[^/]*\\*/\\s*$" |
| 132 | + }, |
| 133 | + "action": { |
| 134 | + "indent": "none", |
| 135 | + "removeText": 1 |
| 136 | + } |
| 137 | + }, |
| 138 | + { |
| 139 | + "beforeText": { |
| 140 | + "pattern": "^\\s*(\\bcase\\s.+:|\\bdefault:)$" |
| 141 | + }, |
| 142 | + "afterText": { |
| 143 | + "pattern": "^(?!\\s*(\\bcase\\b|\\bdefault\\b))" |
| 144 | + }, |
| 145 | + "action": { |
| 146 | + "indent": "indent" |
| 147 | + } |
| 148 | + }, |
| 149 | + { |
| 150 | + // Decrease indentation after single line if/else if/else, for, or while |
| 151 | + "previousLineText": "^\\s*(((else ?)?if|for|while)\\s*\\(.*\\)\\s*|else\\s*)$", |
| 152 | + // But make sure line doesn't have braces or is not another if statement |
| 153 | + "beforeText": "^\\s+([^{i\\s]|i(?!f\\b))", |
| 154 | + "action": { |
| 155 | + "indent": "outdent" |
| 156 | + } |
| 157 | + }, |
| 158 | + // Indent when pressing enter from inside () |
| 159 | + { |
| 160 | + "beforeText": "^.*\\([^\\)]*$", |
| 161 | + "afterText": "^\\s*\\).*$", |
| 162 | + "action": { |
| 163 | + "indent": "indentOutdent", |
| 164 | + "appendText": "\t" |
| 165 | + } |
| 166 | + }, |
| 167 | + // Indent when pressing enter from inside {} |
| 168 | + { |
| 169 | + "beforeText": "^.*\\{[^\\}]*$", |
| 170 | + "afterText": "^\\s*\\}.*$", |
| 171 | + "action": { |
| 172 | + "indent": "indentOutdent", |
| 173 | + "appendText": "\t" |
| 174 | + } |
| 175 | + }, |
| 176 | + // Indent when pressing enter from inside [] |
| 177 | + { |
| 178 | + "beforeText": "^.*\\[[^\\]]*$", |
| 179 | + "afterText": "^\\s*\\].*$", |
| 180 | + "action": { |
| 181 | + "indent": "indentOutdent", |
| 182 | + "appendText": "\t" |
| 183 | + } |
| 184 | + }, |
| 185 | + // Add // when pressing enter from inside line comment |
| 186 | + { |
| 187 | + "beforeText": { |
| 188 | + "pattern": "(?<!\\w:)\/\/.*" |
| 189 | + }, |
| 190 | + "afterText": { |
| 191 | + "pattern": "^(?!\\s*$).+" |
| 192 | + }, |
| 193 | + "action": { |
| 194 | + "indent": "none", |
| 195 | + "appendText": "// " |
| 196 | + } |
| 197 | + } |
| 198 | + ] |
| 199 | +} |
0 commit comments