Repository navigation
Commit 7b79f6d
Added support for Shell script language. (#2058)
## What
Adds support for some next gen scopes to `shellscript` programming
language.
This is something I did recently while working on some bash scripts, but
haven't had time to finish it off yet.
## Checklist
- [x] Recorded tests for the new language
- [x] Used `"change"` / `"clear"` instead of` "take"` for selection
tests to make recorded tests easier to read
- [x] Added a few specific tests that use `"chuck"` instead of
`"change"` to test removal behaviour when it's interesting, especially:
- [x] `"chuck arg"` with single argument in list
- [x] `"chuck arg"` with multiple arguments in list
- [x] `"chuck item"` with single argument in list
- [x] `"chuck item"` with multiple arguments in list
- [x] Added `@textFragment` captures. Usually you want to put these on
comment and string nodes. This enables `"take round"` to work within
comments and strings.
- [ ] Added a test for `"change round"` inside a string, eg `"hello
(there)"`
- [-] Supported` "type"` both for type annotations (eg `foo: string`)
and declarations (eg `interface Foo {}`) (and added tests for this
behaviour 😊)
- [ ] Supported` "item"` both for map pairs and list entries (with tests
of course)
## Scope Support
Legend: ✓ Supported, ✗ Not supported, _ Not applicable
| Supported | Tested | Term | Capture | Definition | Comment |
| --------- | ------- | ---------------- | -----------------------------
| ------------------------------------------------------------------- |
------- |
| ✓ | ✓ | `list` | `@list` | List type equivalent | - |
| ✓ | ✓ | `inside list` | `@list.interior` | Inside of a
list | - |
| _ | _ | `map` | `@map` | Dictionary type equivalent | - |
| _ | _ | `inside map` | `@map.interior` | Inside of a dictionary | - |
| _ | _ | `key` | `@collectionKey` | Dictionary key equivalent | - |
| ✓ | ✓ | `funk` | `@namedFunction` | A named function
declaration | - |
| ✓ | ✓ | `inside funk` | `@namedFunction.interior` | The
inside of a lambda declaration | - |
| ✓ | ✓ | `funk name` | `@functionName` | Name of declared
function | - |
| _ | _ | `lambda` | `@anonymousFunction` | A lambda declaration | - |
| _ | _ | `inside lambda` | `@anonymousFunction.interior` | The inside
of a lambda declaration | - |
| ✓ | ✓ | `name` | `@name` | Variable name | - |
| ✓ | ✓ | `value` | `@value` | Right-hand-side value of an
assignment | - |
| _ | _ | `value` | `@value` | Value returned from a function | - |
| | | `value` | `@value` | Value of a key-value pair | - |
| ✓ | ✓ | `state` | `@statement` | Any single coded
statement | - |
| ✓ | ✓ | `if state` | `@ifStatement` | An if conditional
block | - |
| ✓ | ✓ | `condition` | `@condition` | Condition of an if
block | - |
| ✓ | | `condition` | `@condition` | Condition of a while loop | -
|
| ✓ | | `condition` | `@condition` | Condition of a do while style
loop | - |
| ✓ | | `condition` | `@condition` | Condition of a for loop | - |
| ✓ | | `condition` | `@condition` | Condition of a switch case |
- |
| _ | _ | `condition` | `@condition` | Condition of a ternary expression
| - |
| ✓ | ✓ | `branch` | `@branch` | The resulting code
associated with af conditional expression | - |
| ✓ | ✓ | `inside branch` | `@branch.interior` | The
statements associated with the body of a conditional expression | - |
| ✓ | ✓ | `comment` | `@comment` | Code comment | - |
| _ | _ | `comment` | `@comment` | Multi-line code comment | - |
| | | `inside comment` | `@comment.interior` | The inside of a code
comment | - |
| ✓ | ✓ | `string` | `@string` | Single line strings | - |
| _ | _ | `string` | `@string` | Multi-line strings | |
| ✓ | ✓ | - | `@textFragment` | Used to capture string-type
nodes (strings and comments) | - |
| ✓ | ✓ | `call` | `@functionCall` | A function call (not a
function definition) | - |
| ✓ | ✓ | `callee` | `@functionCallee` | Name of the
function being called | - |
| _ | _ | `arg` | `@argumentOrParameter` | Arguments to function
definition | - |
| ✓ | ✓ | `arg` | `@argumentOrParameter` | Arguments to
function call | - |
| ✓ | ✓ | `arg` | `@argumentOrParameter` | Interpolated
variables in strings | - |
| _ | _ | `class` | `@class` | Class or structure declaration | - |
| _ | _ | `inside class` | `@class.interior` | The inside of a class
declaration | - |
| _ | _ | `class name` | `@className` | Name of class or structure
declaration | - |
| _ | _ | `type` | `@type` | Type declarations | - |
| ✓ | ✓ | `regex` | `@regex` | Regular expression | - |
---------
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: Andreas Arvidsson <andreas.arvidsson87@gmail.com>1 parent 4a5c27f commit 7b79f6d
155 files changed
Lines changed: 7885 additions & 94 deletions
File tree
- packages
- app-web-docs/src/docs
- contributing/private-scopes
- fixtures
- user
- languages
- fixtures
- scopes
- fixtures
- lib-common/src
- references
- scopeSupportFacets
- lib-engine/src/languages/TreeSitterQuery
- resources
- fixtures
- recorded/languages/shellscript
- scopes/shellscript
- argument
- branch
- condition
- interior
- namedFunction
- name
- statement
- value
- playground
- queries
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4868 | 4868 | | |
4869 | 4869 | | |
4870 | 4870 | | |
| 4871 | + | |
| 4872 | + | |
| 4873 | + | |
| 4874 | + | |
| 4875 | + | |
| 4876 | + | |
| 4877 | + | |
| 4878 | + | |
| 4879 | + | |
| 4880 | + | |
| 4881 | + | |
| 4882 | + | |
| 4883 | + | |
| 4884 | + | |
| 4885 | + | |
| 4886 | + | |
| 4887 | + | |
| 4888 | + | |
| 4889 | + | |
| 4890 | + | |
| 4891 | + | |
| 4892 | + | |
| 4893 | + | |
| 4894 | + | |
| 4895 | + | |
| 4896 | + | |
| 4897 | + | |
| 4898 | + | |
| 4899 | + | |
| 4900 | + | |
| 4901 | + | |
| 4902 | + | |
| 4903 | + | |
| 4904 | + | |
| 4905 | + | |
| 4906 | + | |
| 4907 | + | |
| 4908 | + | |
| 4909 | + | |
| 4910 | + | |
| 4911 | + | |
| 4912 | + | |
| 4913 | + | |
| 4914 | + | |
| 4915 | + | |
| 4916 | + | |
| 4917 | + | |
| 4918 | + | |
| 4919 | + | |
| 4920 | + | |
| 4921 | + | |
| 4922 | + | |
| 4923 | + | |
| 4924 | + | |
| 4925 | + | |
| 4926 | + | |
| 4927 | + | |
| 4928 | + | |
| 4929 | + | |
| 4930 | + | |
| 4931 | + | |
| 4932 | + | |
| 4933 | + | |
| 4934 | + | |
| 4935 | + | |
| 4936 | + | |
| 4937 | + | |
| 4938 | + | |
| 4939 | + | |
| 4940 | + | |
| 4941 | + | |
| 4942 | + | |
| 4943 | + | |
| 4944 | + | |
| 4945 | + | |
| 4946 | + | |
| 4947 | + | |
| 4948 | + | |
| 4949 | + | |
| 4950 | + | |
| 4951 | + | |
| 4952 | + | |
| 4953 | + | |
| 4954 | + | |
| 4955 | + | |
| 4956 | + | |
| 4957 | + | |
| 4958 | + | |
| 4959 | + | |
| 4960 | + | |
| 4961 | + | |
| 4962 | + | |
| 4963 | + | |
| 4964 | + | |
| 4965 | + | |
| 4966 | + | |
| 4967 | + | |
| 4968 | + | |
| 4969 | + | |
| 4970 | + | |
| 4971 | + | |
| 4972 | + | |
| 4973 | + | |
| 4974 | + | |
| 4975 | + | |
| 4976 | + | |
| 4977 | + | |
| 4978 | + | |
| 4979 | + | |
| 4980 | + | |
| 4981 | + | |
| 4982 | + | |
| 4983 | + | |
| 4984 | + | |
| 4985 | + | |
| 4986 | + | |
| 4987 | + | |
| 4988 | + | |
| 4989 | + | |
| 4990 | + | |
| 4991 | + | |
| 4992 | + | |
| 4993 | + | |
| 4994 | + | |
| 4995 | + | |
| 4996 | + | |
| 4997 | + | |
| 4998 | + | |
| 4999 | + | |
| 5000 | + | |
| 5001 | + | |
| 5002 | + | |
| 5003 | + | |
| 5004 | + | |
| 5005 | + | |
| 5006 | + | |
| 5007 | + | |
| 5008 | + | |
| 5009 | + | |
| 5010 | + | |
| 5011 | + | |
| 5012 | + | |
| 5013 | + | |
| 5014 | + | |
| 5015 | + | |
| 5016 | + | |
| 5017 | + | |
| 5018 | + | |
| 5019 | + | |
| 5020 | + | |
| 5021 | + | |
| 5022 | + | |
| 5023 | + | |
| 5024 | + | |
| 5025 | + | |
| 5026 | + | |
| 5027 | + | |
| 5028 | + | |
| 5029 | + | |
| 5030 | + | |
| 5031 | + | |
| 5032 | + | |
| 5033 | + | |
| 5034 | + | |
| 5035 | + | |
| 5036 | + | |
| 5037 | + | |
| 5038 | + | |
| 5039 | + | |
| 5040 | + | |
| 5041 | + | |
| 5042 | + | |
| 5043 | + | |
| 5044 | + | |
| 5045 | + | |
| 5046 | + | |
| 5047 | + | |
| 5048 | + | |
| 5049 | + | |
| 5050 | + | |
4871 | 5051 | | |
4872 | 5052 | | |
4873 | 5053 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
594 | 594 | | |
595 | 595 | | |
596 | 596 | | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
597 | 631 | | |
598 | 632 | | |
599 | 633 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1360 | 1360 | | |
1361 | 1361 | | |
1362 | 1362 | | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
1363 | 1414 | | |
1364 | 1415 | | |
1365 | 1416 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
295 | 295 | | |
296 | 296 | | |
297 | 297 | | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
298 | 302 | | |
299 | 303 | | |
300 | 304 | | |
| |||
357 | 361 | | |
358 | 362 | | |
359 | 363 | | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
360 | 368 | | |
361 | 369 | | |
362 | 370 | | |
| |||
429 | 437 | | |
430 | 438 | | |
431 | 439 | | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
432 | 446 | | |
433 | 447 | | |
434 | 448 | | |
| |||
497 | 511 | | |
498 | 512 | | |
499 | 513 | | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
500 | 518 | | |
501 | 519 | | |
502 | 520 | | |
| |||
757 | 775 | | |
758 | 776 | | |
759 | 777 | | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
760 | 782 | | |
761 | 783 | | |
762 | 784 | | |
| |||
837 | 859 | | |
838 | 860 | | |
839 | 861 | | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
840 | 866 | | |
841 | 867 | | |
842 | 868 | | |
| |||
943 | 969 | | |
944 | 970 | | |
945 | 971 | | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
946 | 978 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
92 | 96 | | |
93 | 97 | | |
94 | 98 | | |
| |||
177 | 181 | | |
178 | 182 | | |
179 | 183 | | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
180 | 188 | | |
181 | 189 | | |
182 | 190 | | |
| |||
0 commit comments