| 1 |
{ |
| 2 |
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", |
| 3 |
"name": "nushell", |
| 4 |
"scopeName": "source.nushell", |
| 5 |
"patterns": [ |
| 6 |
{ |
| 7 |
"include": "#define-variable" |
| 8 |
}, |
| 9 |
{ |
| 10 |
"include": "#define-alias" |
| 11 |
}, |
| 12 |
{ |
| 13 |
"include": "#function" |
| 14 |
}, |
| 15 |
{ |
| 16 |
"include": "#extern" |
| 17 |
}, |
| 18 |
{ |
| 19 |
"include": "#module" |
| 20 |
}, |
| 21 |
{ |
| 22 |
"include": "#use-module" |
| 23 |
}, |
| 24 |
{ |
| 25 |
"include": "#expression" |
| 26 |
}, |
| 27 |
{ |
| 28 |
"include": "#comment" |
| 29 |
} |
| 30 |
], |
| 31 |
"repository": { |
| 32 |
"string": { |
| 33 |
"patterns": [ |
| 34 |
{ |
| 35 |
"include": "#string-single-quote" |
| 36 |
}, |
| 37 |
{ |
| 38 |
"include": "#string-backtick" |
| 39 |
}, |
| 40 |
{ |
| 41 |
"include": "#string-double-quote" |
| 42 |
}, |
| 43 |
{ |
| 44 |
"include": "#string-interpolated-double" |
| 45 |
}, |
| 46 |
{ |
| 47 |
"include": "#string-interpolated-single" |
| 48 |
}, |
| 49 |
{ |
| 50 |
"include": "#string-bare" |
| 51 |
} |
| 52 |
] |
| 53 |
}, |
| 54 |
"string-escape": { |
| 55 |
"match": "\\\\(?:[bfrnt\\\\'\"/]|u[0-9a-fA-F]{4})", |
| 56 |
"name": "constant.character.escape.nushell" |
| 57 |
}, |
| 58 |
"string-bare": { |
| 59 |
"match": "[^$\\[{(\"',|#\\s|][^\\[\\]{}()\"'\\s#,|]*", |
| 60 |
"name": "string.bare.nushell" |
| 61 |
}, |
| 62 |
"string-single-quote": { |
| 63 |
"begin": "'", |
| 64 |
"beginCaptures": { |
| 65 |
"0": { |
| 66 |
"name": "punctuation.definition.string.begin.nushell" |
| 67 |
} |
| 68 |
}, |
| 69 |
"end": "'", |
| 70 |
"endCaptures": { |
| 71 |
"0": { |
| 72 |
"name": "punctuation.definition.string.end.nushell" |
| 73 |
} |
| 74 |
}, |
| 75 |
"name": "string.quoted.single.nushell" |
| 76 |
}, |
| 77 |
"string-backtick": { |
| 78 |
"begin": "`", |
| 79 |
"beginCaptures": { |
| 80 |
"0": { |
| 81 |
"name": "punctuation.definition.string.begin.nushell" |
| 82 |
} |
| 83 |
}, |
| 84 |
"end": "`", |
| 85 |
"endCaptures": { |
| 86 |
"0": { |
| 87 |
"name": "punctuation.definition.string.end.nushell" |
| 88 |
} |
| 89 |
}, |
| 90 |
"name": "string.quoted.single.nushell" |
| 91 |
}, |
| 92 |
"string-double-quote": { |
| 93 |
"begin": "\"", |
| 94 |
"beginCaptures": { |
| 95 |
"0": { |
| 96 |
"name": "punctuation.definition.string.begin.nushell" |
| 97 |
} |
| 98 |
}, |
| 99 |
"end": "\"", |
| 100 |
"endCaptures": { |
| 101 |
"0": { |
| 102 |
"name": "punctuation.definition.string.end.nushell" |
| 103 |
} |
| 104 |
}, |
| 105 |
"name": "string.quoted.double.nushell", |
| 106 |
"patterns": [ |
| 107 |
{ |
| 108 |
"match": "\\w+" |
| 109 |
}, |
| 110 |
{ |
| 111 |
"include": "#string-escape" |
| 112 |
} |
| 113 |
] |
| 114 |
}, |
| 115 |
"string-interpolated-double": { |
| 116 |
"begin": "\\$\"", |
| 117 |
"beginCaptures": { |
| 118 |
"0": { |
| 119 |
"name": "punctuation.definition.string.begin.nushell" |
| 120 |
} |
| 121 |
}, |
| 122 |
"end": "\"", |
| 123 |
"endCaptures": { |
| 124 |
"0": { |
| 125 |
"name": "punctuation.definition.string.end.nushell" |
| 126 |
} |
| 127 |
}, |
| 128 |
"name": "string.interpolated.double.nushell", |
| 129 |
"patterns": [ |
| 130 |
{ |
| 131 |
"match": "\\\\[()]", |
| 132 |
"name": "constant.character.escape.nushell" |
| 133 |
}, |
| 134 |
{ |
| 135 |
"include": "#string-escape" |
| 136 |
}, |
| 137 |
{ |
| 138 |
"include": "#paren-expression" |
| 139 |
} |
| 140 |
] |
| 141 |
}, |
| 142 |
"string-interpolated-single": { |
| 143 |
"begin": "\\$'", |
| 144 |
"beginCaptures": { |
| 145 |
"0": { |
| 146 |
"name": "punctuation.definition.string.begin.nushell" |
| 147 |
} |
| 148 |
}, |
| 149 |
"end": "'", |
| 150 |
"endCaptures": { |
| 151 |
"0": { |
| 152 |
"name": "punctuation.definition.string.end.nushell" |
| 153 |
} |
| 154 |
}, |
| 155 |
"name": "string.interpolated.single.nushell", |
| 156 |
"patterns": [ |
| 157 |
{ |
| 158 |
"include": "#paren-expression" |
| 159 |
} |
| 160 |
] |
| 161 |
}, |
| 162 |
"control-keywords": { |
| 163 |
"comment": "Regex generated with list-to-tree (https://github.com/glcraft/list-to-tree)", |
| 164 |
"match": "(?<![0-9a-zA-Z_\\-.\\/:\\\\])(?:break|continue|else(?: if)?|for|if|loop|mut|return|try|while)(?![0-9a-zA-Z_\\-.\\/:\\\\])", |
| 165 |
"name": "keyword.control.nushell" |
| 166 |
}, |
| 167 |
"comment": { |
| 168 |
"match": "(#.*)$", |
| 169 |
"name": "comment.nushell" |
| 170 |
}, |
| 171 |
"keyword": { |
| 172 |
"match": "(?:def(?:-env)?)", |
| 173 |
"name": "keyword.other.nushell" |
| 174 |
}, |
| 175 |
"parameters": { |
| 176 |
"match": "\\b-{1,2}[\\w-]*", |
| 177 |
"name": "variable.parameter.nushell" |
| 178 |
}, |
| 179 |
"variables": { |
| 180 |
"match": "(\\$[a-zA-Z0-9_]+)((?:\\.(?:[\\w-]+|\"[\\w\\- ]+\"))*)", |
| 181 |
"captures": { |
| 182 |
"1": { |
| 183 |
"patterns": [ |
| 184 |
{ |
| 185 |
"include": "#internal-variables" |
| 186 |
}, |
| 187 |
{ |
| 188 |
"match": "\\$.+", |
| 189 |
"name": "variable.other.nushell" |
| 190 |
} |
| 191 |
] |
| 192 |
}, |
| 193 |
"2": { |
| 194 |
"name": "variable.other.nushell" |
| 195 |
} |
| 196 |
} |
| 197 |
}, |
| 198 |
"variable-fields": { |
| 199 |
"match": "(?<=\\)|\\}|\\])(?:\\.(?:[\\w-]+|\"[\\w\\- ]+\"))+", |
| 200 |
"name": "variable.other.nushell" |
| 201 |
}, |
| 202 |
"internal-variables": { |
| 203 |
"match": "\\$(?:nu|env)\\b", |
| 204 |
"name": "variable.language.nushell" |
| 205 |
}, |
| 206 |
"datetime": { |
| 207 |
"match": "\\b\\d{4}-\\d{2}-\\d{2}(?:T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?(?:\\+\\d{2}:?\\d{2}|Z)?)?\\b", |
| 208 |
"name": "constant.numeric.nushell" |
| 209 |
}, |
| 210 |
"numbers-hexa": { |
| 211 |
"match": "(?<![\\w-])0x[0-9a-fA-F]+(?![\\w.])", |
| 212 |
"name": "constant.numeric.nushell" |
| 213 |
}, |
| 214 |
"numbers": { |
| 215 |
"match": "(?<![\\w-])[-+]?(?:\\d+|\\d{1,3}(?:_\\d{3})*)(?:\\.\\d*)?(?i:ns|us|ms|sec|min|hr|day|wk|b|kb|mb|gb|tb|pt|eb|zb|kib|mib|gib|tib|pit|eib|zib)?(?:(?![\\w.])|(?=\\.\\.))", |
| 216 |
"name": "constant.numeric.nushell" |
| 217 |
}, |
| 218 |
"binary": { |
| 219 |
"begin": "\\b(0x)(\\[)", |
| 220 |
"beginCaptures": { |
| 221 |
"1": { |
| 222 |
"name": "constant.numeric.nushell" |
| 223 |
}, |
| 224 |
"2": { |
| 225 |
"name": "meta.brace.square.begin.nushell" |
| 226 |
} |
| 227 |
}, |
| 228 |
"end": "\\]", |
| 229 |
"endCaptures": { |
| 230 |
"0": { |
| 231 |
"name": "meta.brace.square.begin.nushell" |
| 232 |
} |
| 233 |
}, |
| 234 |
"name": "constant.binary.nushell", |
| 235 |
"patterns": [ |
| 236 |
{ |
| 237 |
"match": "[0-9a-fA-F]{2}", |
| 238 |
"name": "constant.numeric.nushell" |
| 239 |
} |
| 240 |
] |
| 241 |
}, |
| 242 |
"constant-keywords": { |
| 243 |
"match": "\\b(?:true|false|null)\\b", |
| 244 |
"name": "constant.language.nushell" |
| 245 |
}, |
| 246 |
"constant-value": { |
| 247 |
"patterns": [ |
| 248 |
{ |
| 249 |
"include": "#constant-keywords" |
| 250 |
}, |
| 251 |
{ |
| 252 |
"include": "#datetime" |
| 253 |
}, |
| 254 |
{ |
| 255 |
"include": "#numbers" |
| 256 |
}, |
| 257 |
{ |
| 258 |
"include": "#numbers-hexa" |
| 259 |
}, |
| 260 |
{ |
| 261 |
"include": "#binary" |
| 262 |
} |
| 263 |
] |
| 264 |
}, |
| 265 |
"ranges": { |
| 266 |
"match": "\\.\\.<?|:", |
| 267 |
"name": "keyword.control.nushell" |
| 268 |
}, |
| 269 |
"operators-word": { |
| 270 |
"match": "(?<= |\\()(?:mod|in|not-in|not|and|or|xor|bit-or|bit-and|bit-xor|bit-shl|bit-shr|starts-with|ends-with)(?= |\\)|$)", |
| 271 |
"name": "keyword.control.nushell" |
| 272 |
}, |
| 273 |
"operators-symbols": { |
| 274 |
"match": "(?<= )(?:\\+|\\-|\\*|\\/|\\/\\/|\\*\\*|!=|[<>=]=?|[!=]~|&&|\\|\\||\\||\\+\\+=?)(?= |$)", |
| 275 |
"name": "keyword.control.nushell" |
| 276 |
}, |
| 277 |
"operators": { |
| 278 |
"patterns": [ |
| 279 |
{ |
| 280 |
"include": "#operators-word" |
| 281 |
}, |
| 282 |
{ |
| 283 |
"include": "#operators-symbols" |
| 284 |
}, |
| 285 |
{ |
| 286 |
"include": "#ranges" |
| 287 |
} |
| 288 |
] |
| 289 |
}, |
| 290 |
"table": { |
| 291 |
"begin": "\\[", |
| 292 |
"beginCaptures": { |
| 293 |
"0": { |
| 294 |
"name": "meta.brace.square.begin.nushell" |
| 295 |
} |
| 296 |
}, |
| 297 |
"end": "\\]", |
| 298 |
"endCaptures": { |
| 299 |
"0": { |
| 300 |
"name": "meta.brace.square.end.nushell" |
| 301 |
} |
| 302 |
}, |
| 303 |
"name": "meta.table.nushell", |
| 304 |
"patterns": [ |
| 305 |
{ |
| 306 |
"include": "#value" |
| 307 |
}, |
| 308 |
{ |
| 309 |
"match": ",", |
| 310 |
"name": "punctuation.separator.nushell" |
| 311 |
}, |
| 312 |
{ |
| 313 |
"include": "#comment" |
| 314 |
} |
| 315 |
] |
| 316 |
}, |
| 317 |
"function-parameter-default-value": { |
| 318 |
"begin": "=\\s*", |
| 319 |
"captures": { |
| 320 |
"1": { |
| 321 |
"name": "variable.parameter.nushell" |
| 322 |
}, |
| 323 |
"2": { |
| 324 |
"name": "variable.parameter.nushell" |
| 325 |
}, |
| 326 |
"3": { |
| 327 |
"name": "keyword.operator.nushell" |
| 328 |
}, |
| 329 |
"4": { |
| 330 |
"name": "entity.name.type.nushell" |
| 331 |
} |
| 332 |
}, |
| 333 |
"end": "(?=\\])|,|$", |
| 334 |
"patterns": [ |
| 335 |
{ |
| 336 |
"include": "#value" |
| 337 |
} |
| 338 |
] |
| 339 |
}, |
| 340 |
"function-parameter-declare": { |
| 341 |
"match": "(-{0,2}[\\w-]+|\\.{3})(?:\\((-[\\w?])\\))?(?:\\s*(\\??:)\\s*(\\w+)(?:@((?:\"[^\"]+\")|(?:'[^']+')))?)?", |
| 342 |
"captures": { |
| 343 |
"1": { |
| 344 |
"name": "variable.parameter.nushell" |
| 345 |
}, |
| 346 |
"2": { |
| 347 |
"name": "variable.parameter.nushell" |
| 348 |
}, |
| 349 |
"3": { |
| 350 |
"name": "keyword.operator.nushell" |
| 351 |
}, |
| 352 |
"4": { |
| 353 |
"name": "entity.name.type.nushell" |
| 354 |
}, |
| 355 |
"5": { |
| 356 |
"name": "string.quoted.nushell" |
| 357 |
} |
| 358 |
} |
| 359 |
}, |
| 360 |
"function-parameter": { |
| 361 |
"patterns": [ |
| 362 |
{ |
| 363 |
"include": "#function-parameter-declare" |
| 364 |
}, |
| 365 |
{ |
| 366 |
"include": "#function-parameter-default-value" |
| 367 |
} |
| 368 |
] |
| 369 |
}, |
| 370 |
"function-parameters": { |
| 371 |
"begin": "\\[", |
| 372 |
"beginCaptures": { |
| 373 |
"0": { |
| 374 |
"name": "meta.brace.square.begin.nushell" |
| 375 |
} |
| 376 |
}, |
| 377 |
"end": "\\]", |
| 378 |
"endCaptures": { |
| 379 |
"0": { |
| 380 |
"name": "meta.brace.square.end.nushell" |
| 381 |
} |
| 382 |
}, |
| 383 |
"patterns": [ |
| 384 |
{ |
| 385 |
"include": "#function-parameter" |
| 386 |
}, |
| 387 |
{ |
| 388 |
"include": "#comment" |
| 389 |
} |
| 390 |
], |
| 391 |
"name": "meta.function.parameters.nushell" |
| 392 |
}, |
| 393 |
"define-function": { |
| 394 |
"match": "((?:export\\s+)?def(?:-env)?)\\s+([\\w\\-!]+|\"[\\w\\-! ]+\")", |
| 395 |
"captures": { |
| 396 |
"1": { |
| 397 |
"name": "entity.name.function.nushell" |
| 398 |
}, |
| 399 |
"2": { |
| 400 |
"name": "entity.name.type.nushell" |
| 401 |
} |
| 402 |
} |
| 403 |
}, |
| 404 |
"define-extern": { |
| 405 |
"match": "((?:export\\s+)?extern)\\s+([\\w\\-!]+|\"[\\w\\-! ]+\")", |
| 406 |
"captures": { |
| 407 |
"1": { |
| 408 |
"name": "entity.name.function.nushell" |
| 409 |
}, |
| 410 |
"2": { |
| 411 |
"name": "entity.name.type.nushell" |
| 412 |
} |
| 413 |
} |
| 414 |
}, |
| 415 |
"function-body": { |
| 416 |
"begin": "\\{", |
| 417 |
"beginCaptures": { |
| 418 |
"0": { |
| 419 |
"name": "punctuation.definition.function.begin.nushell" |
| 420 |
} |
| 421 |
}, |
| 422 |
"end": "\\}", |
| 423 |
"endCaptures": { |
| 424 |
"0": { |
| 425 |
"name": "punctuation.definition.function.end.nushell" |
| 426 |
} |
| 427 |
}, |
| 428 |
"name": "meta.function.body.nushell", |
| 429 |
"patterns": [ |
| 430 |
{ |
| 431 |
"include": "source.nushell" |
| 432 |
} |
| 433 |
] |
| 434 |
}, |
| 435 |
"function": { |
| 436 |
"begin": "((?:export\\s+)?def(?:-env)?)\\s+([\\w\\-]+|\"[\\w\\- ]+\")", |
| 437 |
"beginCaptures": { |
| 438 |
"0": { |
| 439 |
"patterns": [ |
| 440 |
{ |
| 441 |
"include": "#define-function" |
| 442 |
}, |
| 443 |
{ |
| 444 |
"include": "#define-extern" |
| 445 |
} |
| 446 |
] |
| 447 |
} |
| 448 |
}, |
| 449 |
"end": "(?<=\\})", |
| 450 |
"endCaptures": { |
| 451 |
"0": { |
| 452 |
"name": "punctuation.definition.function.end.nushell" |
| 453 |
} |
| 454 |
}, |
| 455 |
"patterns": [ |
| 456 |
{ |
| 457 |
"include": "#function-parameters" |
| 458 |
}, |
| 459 |
{ |
| 460 |
"include": "#function-body" |
| 461 |
} |
| 462 |
] |
| 463 |
}, |
| 464 |
"extern": { |
| 465 |
"begin": "((?:export\\s+)?extern)\\s+([\\w\\-]+|\"[\\w\\- ]+\")", |
| 466 |
"beginCaptures": { |
| 467 |
"0": { |
| 468 |
"patterns": [ |
| 469 |
{ |
| 470 |
"include": "#define-extern" |
| 471 |
} |
| 472 |
] |
| 473 |
} |
| 474 |
}, |
| 475 |
"end": "(?<=\\])", |
| 476 |
"endCaptures": { |
| 477 |
"0": { |
| 478 |
"name": "punctuation.definition.function.end.nushell" |
| 479 |
} |
| 480 |
}, |
| 481 |
"patterns": [ |
| 482 |
{ |
| 483 |
"include": "#function-parameters" |
| 484 |
} |
| 485 |
] |
| 486 |
}, |
| 487 |
"module": { |
| 488 |
"begin": "(module)\\s+([\\w\\-]+)\\s*\\{", |
| 489 |
"beginCaptures": { |
| 490 |
"1": { |
| 491 |
"name": "entity.name.function.nushell" |
| 492 |
}, |
| 493 |
"2": { |
| 494 |
"name": "entity.name.namespace.nushell" |
| 495 |
} |
| 496 |
}, |
| 497 |
"end": "\\}", |
| 498 |
"endCaptures": { |
| 499 |
"0": { |
| 500 |
"name": "punctuation.definition.module.end.nushell" |
| 501 |
} |
| 502 |
}, |
| 503 |
"name": "meta.module.nushell", |
| 504 |
"patterns": [ |
| 505 |
{ |
| 506 |
"include": "source.nushell" |
| 507 |
} |
| 508 |
] |
| 509 |
}, |
| 510 |
"use-module": { |
| 511 |
"patterns": [ |
| 512 |
{ |
| 513 |
"match": "^\\s*((?:export )?use)\\s+([\\w\\-]+|\"[\\w\\- ]+\"|'[\\w\\- ]+')(?:\\s+([\\w\\-]+|\"[\\w\\- ]+\"|'[\\w\\- ]+'|\\*))?\\s*;?$", |
| 514 |
"captures": { |
| 515 |
"1": { |
| 516 |
"name": "entity.name.function.nushell" |
| 517 |
}, |
| 518 |
"2": { |
| 519 |
"name": "entity.name.namespace.nushell" |
| 520 |
}, |
| 521 |
"3": { |
| 522 |
"name": "keyword.other.nushell" |
| 523 |
} |
| 524 |
} |
| 525 |
}, |
| 526 |
{ |
| 527 |
"begin": "^\\s*((?:export )?use)\\s+([\\w\\-]+|\"[\\w\\- ]+\"|'[\\w\\- ]+')\\s*\\[", |
| 528 |
"beginCaptures": { |
| 529 |
"1": { |
| 530 |
"name": "entity.name.function.nushell" |
| 531 |
}, |
| 532 |
"2": { |
| 533 |
"name": "entity.name.namespace.nushell" |
| 534 |
} |
| 535 |
}, |
| 536 |
"end": "(\\])\\s*;?\\s*$", |
| 537 |
"endCaptures": { |
| 538 |
"1": { |
| 539 |
"name": "meta.brace.square.end.nushell" |
| 540 |
} |
| 541 |
}, |
| 542 |
"patterns": [ |
| 543 |
{ |
| 544 |
"match": "([\\w\\-]+|\"[\\w\\- ]+\"|'[\\w\\- ]+'|\\*),?", |
| 545 |
"captures": { |
| 546 |
"1": { |
| 547 |
"name": "keyword.other.nushell" |
| 548 |
} |
| 549 |
} |
| 550 |
}, |
| 551 |
{ |
| 552 |
"include": "#comment" |
| 553 |
} |
| 554 |
] |
| 555 |
}, |
| 556 |
{ |
| 557 |
"match": "(?<path>(?:/|\\\\|~[\\/\\\\]|\\.\\.?[\\/\\\\])?(?:[^\\/\\\\]+[\\/\\\\])*[\\w\\- ]+(?:\\.nu)?){0}^\\s*((?:export )?use)\\s+(\"\\g<path>\"|'\\g<path>\\'|(?![\"'])\\g<path>)(?:\\s+([\\w\\-]+|\"[\\w\\- ]+\"|'[^']+'|\\*))?\\s*;?$", |
| 558 |
"captures": { |
| 559 |
"2": { |
| 560 |
"name": "entity.name.function.nushell" |
| 561 |
}, |
| 562 |
"3": { |
| 563 |
"name": "string.bare.nushell", |
| 564 |
"patterns": [ |
| 565 |
{ |
| 566 |
"match": "([\\w\\- ]+)(?:\\.nu)?(?=$|\"|')", |
| 567 |
"captures": { |
| 568 |
"1": { |
| 569 |
"name": "entity.name.namespace.nushell" |
| 570 |
} |
| 571 |
} |
| 572 |
} |
| 573 |
] |
| 574 |
}, |
| 575 |
"4": { |
| 576 |
"name": "keyword.other.nushell" |
| 577 |
} |
| 578 |
} |
| 579 |
}, |
| 580 |
{ |
| 581 |
"begin": "(?<path>(?:/|\\\\|~[\\/\\\\]|\\.\\.?[\\/\\\\])?(?:[^\\/\\\\]+[\\/\\\\])*[\\w\\- ]+(?:\\.nu)?){0}^\\s*((?:export )?use)\\s+(\"\\g<path>\"|'\\g<path>\\'|(?![\"'])\\g<path>)\\s+\\[", |
| 582 |
"beginCaptures": { |
| 583 |
"2": { |
| 584 |
"name": "entity.name.function.nushell" |
| 585 |
}, |
| 586 |
"3": { |
| 587 |
"name": "string.bare.nushell", |
| 588 |
"patterns": [ |
| 589 |
{ |
| 590 |
"match": "([\\w\\- ]+)(?:\\.nu)?(?=$|\"|')", |
| 591 |
"captures": { |
| 592 |
"1": { |
| 593 |
"name": "entity.name.namespace.nushell" |
| 594 |
} |
| 595 |
} |
| 596 |
} |
| 597 |
] |
| 598 |
} |
| 599 |
}, |
| 600 |
"end": "(\\])\\s*;?\\s*$", |
| 601 |
"endCaptures": { |
| 602 |
"1": { |
| 603 |
"name": "meta.brace.square.end.nushell" |
| 604 |
} |
| 605 |
}, |
| 606 |
"patterns": [ |
| 607 |
{ |
| 608 |
"match": "([\\w\\-]+|\"[\\w\\- ]+\"|'[\\w\\- ]+'|\\*),?", |
| 609 |
"captures": { |
| 610 |
"0": { |
| 611 |
"name": "keyword.other.nushell" |
| 612 |
} |
| 613 |
} |
| 614 |
}, |
| 615 |
{ |
| 616 |
"include": "#comment" |
| 617 |
} |
| 618 |
] |
| 619 |
}, |
| 620 |
{ |
| 621 |
"match": "^\\s*(?:export )?use\\b", |
| 622 |
"captures": { |
| 623 |
"0": { |
| 624 |
"name": "entity.name.function.nushell" |
| 625 |
} |
| 626 |
} |
| 627 |
} |
| 628 |
] |
| 629 |
}, |
| 630 |
"for-loop": { |
| 631 |
"begin": "(for)\\s+(\\$?\\w+)\\s+(in)\\s+(.+)\\s*(\\{)", |
| 632 |
"beginCaptures": { |
| 633 |
"1": { |
| 634 |
"name": "keyword.other.nushell" |
| 635 |
}, |
| 636 |
"2": { |
| 637 |
"name": "variable.other.nushell" |
| 638 |
}, |
| 639 |
"3": { |
| 640 |
"name": "keyword.other.nushell" |
| 641 |
}, |
| 642 |
"4": { |
| 643 |
"patterns": [ |
| 644 |
{ |
| 645 |
"include": "#value" |
| 646 |
} |
| 647 |
] |
| 648 |
}, |
| 649 |
"5": { |
| 650 |
"name": "punctuation.section.block.begin.bracket.curly.nushell" |
| 651 |
} |
| 652 |
}, |
| 653 |
"end": "\\}", |
| 654 |
"endCaptures": { |
| 655 |
"0": { |
| 656 |
"name": "punctuation.section.block.end.bracket.curly.nushell" |
| 657 |
} |
| 658 |
}, |
| 659 |
"name": "meta.for-loop.nushell", |
| 660 |
"patterns": [ |
| 661 |
{ |
| 662 |
"include": "source.nushell" |
| 663 |
} |
| 664 |
] |
| 665 |
}, |
| 666 |
"paren-expression": { |
| 667 |
"begin": "\\(", |
| 668 |
"beginCaptures": { |
| 669 |
"0": { |
| 670 |
"name": "meta.brace.round.begin.nushell" |
| 671 |
} |
| 672 |
}, |
| 673 |
"end": "\\)", |
| 674 |
"endCaptures": { |
| 675 |
"0": { |
| 676 |
"name": "meta.brace.round.end.nushell" |
| 677 |
} |
| 678 |
}, |
| 679 |
"name": "meta.expression.parenthesis.nushell", |
| 680 |
"patterns": [ |
| 681 |
{ |
| 682 |
"include": "#expression" |
| 683 |
} |
| 684 |
] |
| 685 |
}, |
| 686 |
"braced-expression": { |
| 687 |
"begin": "(\\{)(?:\\s*\\|([\\w, ]*)\\|)?", |
| 688 |
"beginCaptures": { |
| 689 |
"1": { |
| 690 |
"name": "punctuation.section.block.begin.bracket.curly.nushell" |
| 691 |
}, |
| 692 |
"2": { |
| 693 |
"patterns": [ |
| 694 |
{ |
| 695 |
"include": "#function-parameter" |
| 696 |
}, |
| 697 |
{ |
| 698 |
"match": ",", |
| 699 |
"name": "punctuation.separator.nushell" |
| 700 |
} |
| 701 |
] |
| 702 |
} |
| 703 |
}, |
| 704 |
"end": "\\}", |
| 705 |
"endCaptures": { |
| 706 |
"0": { |
| 707 |
"name": "punctuation.section.block.end.bracket.curly.nushell" |
| 708 |
} |
| 709 |
}, |
| 710 |
"name": "meta.expression.braced.nushell", |
| 711 |
"patterns": [ |
| 712 |
{ |
| 713 |
"begin": "((?:(?:[^$\\(\\{\\[\"'#\\s][^\\(\\{\\[\"'#\\s]*)|\\$?(?:\"[^\"]+\"|'[^']+')))\\s*(:)\\s*", |
| 714 |
"beginCaptures": { |
| 715 |
"1": { |
| 716 |
"name": "variable.other.nushell", |
| 717 |
"patterns": [ |
| 718 |
{ |
| 719 |
"include": "#paren-expression" |
| 720 |
} |
| 721 |
] |
| 722 |
}, |
| 723 |
"2": { |
| 724 |
"patterns": [ |
| 725 |
{ |
| 726 |
"include": "#operators" |
| 727 |
} |
| 728 |
] |
| 729 |
} |
| 730 |
}, |
| 731 |
"end": "(?=,|\\s|\\})", |
| 732 |
"name": "meta.record-entry.nushell", |
| 733 |
"patterns": [ |
| 734 |
{ |
| 735 |
"include": "#value" |
| 736 |
} |
| 737 |
] |
| 738 |
}, |
| 739 |
{ |
| 740 |
"include": "source.nushell" |
| 741 |
} |
| 742 |
] |
| 743 |
}, |
| 744 |
"define-variable": { |
| 745 |
"match": "(let(?:-env)?|mut|const)\\s+(\\w+)\\s*(=)", |
| 746 |
"captures": { |
| 747 |
"1": { |
| 748 |
"name": "keyword.other.nushell" |
| 749 |
}, |
| 750 |
"2": { |
| 751 |
"name": "variable.other.nushell" |
| 752 |
}, |
| 753 |
"3": { |
| 754 |
"patterns": [ |
| 755 |
{ |
| 756 |
"include": "#operators" |
| 757 |
} |
| 758 |
] |
| 759 |
} |
| 760 |
} |
| 761 |
}, |
| 762 |
"define-alias": { |
| 763 |
"match": "((?:export )?alias)\\s+([\\w\\-!]+)\\s*(=)", |
| 764 |
"captures": { |
| 765 |
"1": { |
| 766 |
"name": "entity.name.function.nushell" |
| 767 |
}, |
| 768 |
"2": { |
| 769 |
"name": "entity.name.type.nushell" |
| 770 |
}, |
| 771 |
"3": { |
| 772 |
"patterns": [ |
| 773 |
{ |
| 774 |
"include": "#operators" |
| 775 |
} |
| 776 |
] |
| 777 |
} |
| 778 |
} |
| 779 |
}, |
| 780 |
"pre-command": { |
| 781 |
"begin": "(\\w+)(=)", |
| 782 |
"beginCaptures": { |
| 783 |
"1": { |
| 784 |
"name": "variable.other.nushell" |
| 785 |
}, |
| 786 |
"2": { |
| 787 |
"patterns": [ |
| 788 |
{ |
| 789 |
"include": "#operators" |
| 790 |
} |
| 791 |
] |
| 792 |
} |
| 793 |
}, |
| 794 |
"end": "(?=\\s+)", |
| 795 |
"patterns": [ |
| 796 |
{ |
| 797 |
"include": "#value" |
| 798 |
} |
| 799 |
] |
| 800 |
}, |
| 801 |
"command": { |
| 802 |
"begin": "(?<!\\w)(?:(\\^)|(?![0-9]|\\$))([\\w.!]+(?:(?: (?!-)[\\w\\-.!]+(?:(?= |\\))|$)|[\\w\\-.!]+))*|(?<=\\^)\\$?(?:\"[^\"]+\"|'[^']+'))", |
| 803 |
"beginCaptures": { |
| 804 |
"1": { |
| 805 |
"name": "keyword.operator.nushell" |
| 806 |
}, |
| 807 |
"2": { |
| 808 |
"patterns": [ |
| 809 |
{ |
| 810 |
"include": "#control-keywords" |
| 811 |
}, |
| 812 |
{ |
| 813 |
"match": "(?:ansi|char) \\w+", |
| 814 |
"captures": { |
| 815 |
"0": { |
| 816 |
"name": "keyword.other.builtin.nushell" |
| 817 |
} |
| 818 |
} |
| 819 |
}, |
| 820 |
{ |
| 821 |
"comment": "Regex generated with list-to-tree (https://github.com/glcraft/list-to-tree)", |
| 822 |
"match": "(a(?:l(?:ias|l)|n(?:si(?: (?:gradient|link|strip))?|y)|ppend|st)|b(?:its(?: (?:and|not|or|ro(?:l|r)|sh(?:l|r)|xor))?|reak|ytes(?: (?:a(?:dd|t)|build|collect|ends-with|index-of|length|re(?:move|place|verse)|starts-with))?)|c(?:al|d|har|lear|o(?:l(?:lect|umns)|m(?:mandline|p(?:act|lete))|n(?:fig(?: (?:env|nu|reset))?|st|tinue))|p|ustom-value (?:generate(?:2)?|update))|d(?:ate(?: (?:format|humanize|list-timezone|now|to-(?:record|t(?:able|imezone))))?|e(?:bug|code(?: (?:base64|hex))?|f(?:-env|ault)?|scribe|tect columns)|fr (?:a(?:gg(?:-groups)?|ll-(?:false|true)|ppend|rg-(?:m(?:ax|in)|sort|true|unique|where)|s(?:-date(?:time)?)?)|c(?:ache|o(?:l(?:lect|umns)?|n(?:cat(?:-str|enate)|tains)|unt(?:-null)?)|umulative)|d(?:atepart|rop(?:-(?:duplicates|nulls))?|types|ummies)|exp(?:lode|r-not)|f(?:etch|i(?:l(?:l-n(?:an|ull)|ter(?:-with)?)|rst)|latten)|g(?:et(?:-(?:day|hour|m(?:inute|onth)|nanosecond|ordinal|second|week(?:day)?|year))?|roup-by)|i(?:mplode|nto-(?:df|lazy|nu)|s-(?:duplicated|in|n(?:ot-null|ull)|unique))|join|l(?:ast|it|owercase|s)|m(?:ax|e(?:an|dian|lt)|in)|n(?:-unique|ot)|o(?:pen|therwise)|qu(?:antile|ery)|r(?:e(?:name|place(?:-all)?|verse)|olling)|s(?:ample|e(?:lect|t(?:-with-idx)?)|h(?:ape|ift)|lice|ort-by|t(?:d|r(?:-(?:lengths|slice)|ftime))|um(?:mary)?)|t(?:ake|o-(?:a(?:rrow|vro)|csv|jsonl|parquet))|u(?:nique|ppercase)|va(?:lue-counts|r)|w(?:hen|ith-column))|o|rop(?: (?:column|nth))?|u)|e(?:ach(?: while)?|cho|moji|n(?:code(?: (?:base64|hex))?|umerate)|rror make|very|x(?:ec|it|p(?:l(?:ain|ore)|ort(?: (?:alias|const|def(?:-env)?|extern(?:-wrapped)?|module|use)|-env)?)|tern(?:-wrapped)?))|f(?:i(?:l(?:e|l|ter)|nd|rst)|latten|mt|or(?:mat(?: (?:d(?:ate|uration)|filesize))?)?|rom(?: (?:csv|eml|i(?:cs|ni)|json|nuon|ods|parquet|ssv|t(?:oml|sv)|url|vcf|x(?:lsx|ml)|y(?:aml|ml)))?)|g(?:et|lob|r(?:id|oup(?:-by)?)|stat)|h(?:ash(?: (?:md5|sha256))?|e(?:aders|lp(?: (?:aliases|commands|externs|modules|operators))?)|i(?:de(?:-env)?|ghlight|st(?:o(?:gram|ry(?: session)?))?)|ttp(?: (?:delete|get|head|options|p(?:atch|ost|ut)))?)|i(?:f|gnore|n(?:c|put(?: list(?:en)?)?|s(?:ert|pect)|to(?: (?:b(?:i(?:nary|ts)|ool)|d(?:atetime|ecimal|uration)|f(?:ilesize|loat)|int|record|s(?:qlite|tring)))?)|s-(?:admin|empty)|tems)|j(?:oin|son path)|k(?:eybindings(?: (?:default|list(?:en)?))?|ill)|l(?:a(?:st|zy make)|e(?:ngth|t(?:-env)?)|ines|o(?:ad-env|op)|s)|m(?:at(?:ch|h(?: (?:a(?:bs|rc(?:cos(?:h)?|sin(?:h)?|tan(?:h)?)|vg)|c(?:eil|os(?:h)?)|exp|floor|l(?:n|og)|m(?:ax|edian|in|ode)|product|round|s(?:in(?:h)?|qrt|tddev|um)|tan(?:h)?|variance))?)|e(?:rge|tadata)|kdir|o(?:dule|ve)|ut|v)|nu(?:-(?:check|example-(?:1|2|3)|highlight)|_plugin_explore)|o(?:pen|verlay(?: (?:hide|list|new|use))?)|p(?:a(?:r(?:-each|se)|th(?: (?:basename|dirname|ex(?:ists|pand)|join|parse|relative-to|split|type))?)|eriodic-table|lot|net|ort|r(?:epend|int|ofile)|s)|query(?: (?:db|json|web|xml))?|r(?:an(?:dom(?: (?:bool|chars|d(?:ecimal|ice)|float|integer|uuid))?|ge)|e(?:duce|g(?:ex|ist(?:er|ry query))|ject|name|turn|verse)|m|o(?:ll(?: (?:down|left|right|up))?|tate)|un-external)|s(?:ave|c(?:hema|ope(?: (?:aliases|commands|e(?:ngine-stats|xterns)|modules|variables))?)|e(?:lect|q(?: (?:char|date))?)|huffle|ize|kip(?: (?:until|while))?|leep|o(?:rt(?:-by)?|urce(?:-env)?)|plit(?: (?:c(?:hars|olumn)|list|row|words)|-by)?|t(?:art|r(?: (?:c(?:a(?:mel-case|pitalize)|ontains)|d(?:istance|owncase)|e(?:nds-with|xpand)|index-of|join|kebab-case|length|pascal-case|re(?:place|verse)|s(?:creaming-snake-case|imilarity|nake-case|tarts-with|ubstring)|t(?:itle-case|rim)|upcase))?)|ys)|t(?:a(?:ble|ke(?: (?:until|while))?)|erm size|imeit|o(?: (?:csv|html|json|md|nuon|t(?:ext|oml|sv)|xml|yaml)|uch)?|r(?:anspose|y)|utor)|u(?:cp|niq(?:-by)?|p(?:date(?: cells)?|sert)|rl(?: (?:build-query|encode|join|parse))?|se)|v(?:alues|ersion|iew(?: (?:files|s(?:ource|pan)))?)|w(?:atch|h(?:ere|i(?:ch|le))|i(?:ndow|th-env)|rap)|xyplot|zip)(?![\\w-])( (.*))?", |
| 823 |
"captures": { |
| 824 |
"1": { |
| 825 |
"name": "keyword.other.builtin.nushell" |
| 826 |
}, |
| 827 |
"2": { |
| 828 |
"patterns": [ |
| 829 |
{ |
| 830 |
"include": "#value" |
| 831 |
} |
| 832 |
] |
| 833 |
} |
| 834 |
} |
| 835 |
}, |
| 836 |
{ |
| 837 |
"match": "(?<=\\^)(?:\\$(\"[^\"]+\"|'[^']+')|\"[^\"]+\"|'[^']+')", |
| 838 |
"name": "entity.name.type.external.nushell", |
| 839 |
"captures": { |
| 840 |
"1": { |
| 841 |
"patterns": [ |
| 842 |
{ |
| 843 |
"include": "#paren-expression" |
| 844 |
} |
| 845 |
] |
| 846 |
} |
| 847 |
} |
| 848 |
}, |
| 849 |
{ |
| 850 |
"match": "([\\w.]+(?:-[\\w.!]+)*)(?: (.*))?", |
| 851 |
"captures": { |
| 852 |
"1": { |
| 853 |
"name": "entity.name.type.external.nushell" |
| 854 |
}, |
| 855 |
"2": { |
| 856 |
"patterns": [ |
| 857 |
{ |
| 858 |
"include": "#value" |
| 859 |
} |
| 860 |
] |
| 861 |
} |
| 862 |
} |
| 863 |
}, |
| 864 |
{ |
| 865 |
"include": "#value" |
| 866 |
} |
| 867 |
] |
| 868 |
} |
| 869 |
}, |
| 870 |
"end": "(?=\\||\\)|\\}|;)|$", |
| 871 |
"name": "meta.command.nushell", |
| 872 |
"patterns": [ |
| 873 |
{ |
| 874 |
"include": "#value" |
| 875 |
} |
| 876 |
] |
| 877 |
}, |
| 878 |
"expression": { |
| 879 |
"patterns": [ |
| 880 |
{ |
| 881 |
"include": "#pre-command" |
| 882 |
}, |
| 883 |
{ |
| 884 |
"include": "#for-loop" |
| 885 |
}, |
| 886 |
{ |
| 887 |
"include": "#operators" |
| 888 |
}, |
| 889 |
{ |
| 890 |
"include": "#control-keywords" |
| 891 |
}, |
| 892 |
{ |
| 893 |
"include": "#constant-value" |
| 894 |
}, |
| 895 |
{ |
| 896 |
"include": "#command" |
| 897 |
}, |
| 898 |
{ |
| 899 |
"include": "#value" |
| 900 |
} |
| 901 |
] |
| 902 |
}, |
| 903 |
"value": { |
| 904 |
"patterns": [ |
| 905 |
{ |
| 906 |
"include": "#variables" |
| 907 |
}, |
| 908 |
{ |
| 909 |
"include": "#variable-fields" |
| 910 |
}, |
| 911 |
{ |
| 912 |
"include": "#control-keywords" |
| 913 |
}, |
| 914 |
{ |
| 915 |
"include": "#constant-value" |
| 916 |
}, |
| 917 |
{ |
| 918 |
"include": "#table" |
| 919 |
}, |
| 920 |
{ |
| 921 |
"include": "#parameters" |
| 922 |
}, |
| 923 |
{ |
| 924 |
"include": "#operators" |
| 925 |
}, |
| 926 |
{ |
| 927 |
"include": "#paren-expression" |
| 928 |
}, |
| 929 |
{ |
| 930 |
"include": "#braced-expression" |
| 931 |
}, |
| 932 |
{ |
| 933 |
"include": "#string" |
| 934 |
}, |
| 935 |
{ |
| 936 |
"include": "#comment" |
| 937 |
} |
| 938 |
] |
| 939 |
} |
| 940 |
} |
| 941 |
} |
| 942 |
|