mirror of
https://github.com/sharkdp/bat.git
synced 2025-09-01 10:52:24 +01:00
Compare commits
396 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
6a6041c72c | ||
|
0d93abde67 | ||
|
1cc39a790f | ||
|
2d93da1869 | ||
|
9ad147278f | ||
|
4e36a56014 | ||
|
312c8ef01f | ||
|
f3f8194932 | ||
|
6ce26c43c9 | ||
|
486510395b | ||
|
2ae4ffcdfa | ||
|
f5a7f86a64 | ||
|
0fa99518ce | ||
|
a565662cf3 | ||
|
af44f0b3ff | ||
|
5ae1957c0e | ||
|
36be8d5929 | ||
|
a05c8ee1a8 | ||
|
eb4b1eb28f | ||
|
9287cf6b0b | ||
|
76aa138230 | ||
|
59a8f58be7 | ||
|
d3956be616 | ||
|
53fb0baa06 | ||
|
c2232d457f | ||
|
77f51f0ee3 | ||
|
743c4ccb17 | ||
|
5b37438f08 | ||
|
3f7bff90ba | ||
|
0c19d3e51a | ||
|
e73c3d2378 | ||
|
31ca212f86 | ||
|
68528983d7 | ||
|
f89869b5b2 | ||
|
d4744dbed5 | ||
|
abbccc91ed | ||
|
080c5f3de4 | ||
|
079f6be88c | ||
|
c522ba78ed | ||
|
392bff6666 | ||
|
6dc621ec18 | ||
|
3358b075fb | ||
|
a02713dc15 | ||
|
ee1f5a9e89 | ||
|
84a15f0b6e | ||
|
a3ea798246 | ||
|
63ad53817d | ||
|
6d0eb0749e | ||
|
36c1ea4599 | ||
|
e250da8aaa | ||
|
7fceb4878f | ||
|
29711c178a | ||
|
8072d5a3e3 | ||
|
a5234105e5 | ||
|
4236fa97cb | ||
|
f5e3d9f010 | ||
|
6313e9ef2a | ||
|
ce89fb2751 | ||
|
3338699257 | ||
|
747b15436a | ||
|
206bf5b8d6 | ||
|
9a2979df5f | ||
|
b8e79a2160 | ||
|
715b0d8bf5 | ||
|
0eb4aaac1e | ||
|
bc86c29185 | ||
|
d2175d6382 | ||
|
b3aefd2d41 | ||
|
f7eb55aa01 | ||
|
5e63d67960 | ||
|
6fd78ea3f6 | ||
|
b12503a46a | ||
|
ea2faf45e4 | ||
|
1822c981da | ||
|
5519f9c716 | ||
|
dd0925a946 | ||
|
d7671fa8e3 | ||
|
e79b07bf5e | ||
|
619cf6e6d6 | ||
|
d6ed5e6746 | ||
|
59d4cfb75c | ||
|
194e7bbcd1 | ||
|
5d92a7c591 | ||
|
7fbe090525 | ||
|
eaf64df4c6 | ||
|
a1558fb6bf | ||
|
18e999c92a | ||
|
d5f737f402 | ||
|
7fe4fdf33d | ||
|
0b63ad5e8b | ||
|
4081ace4b9 | ||
|
dde770aa21 | ||
|
6eb2cc9cac | ||
|
f28d9db3d0 | ||
|
deb80af449 | ||
|
dc0acbbb90 | ||
|
92ba42a602 | ||
|
d5e61d2316 | ||
|
ed3246c423 | ||
|
2339d78bf4 | ||
|
3a3cd0acba | ||
|
ce4ddc0911 | ||
|
aed4ea144f | ||
|
eea061c1d9 | ||
|
10288e309e | ||
|
ebdb00d4fc | ||
|
6fc7ebf37a | ||
|
8f6a0cd9e2 | ||
|
994c21a5e1 | ||
|
554374667e | ||
|
043f3381b0 | ||
|
d04a83de7b | ||
|
b622a4d890 | ||
|
b551d28a2f | ||
|
e6caa04209 | ||
|
adadedeab1 | ||
|
a6cf5235aa | ||
|
1477338106 | ||
|
418fce5683 | ||
|
7a15ba3796 | ||
|
0f002a5b06 | ||
|
5344a32d34 | ||
|
c9645693a4 | ||
|
f607263bdc | ||
|
f309d2fbd2 | ||
|
47283f226a | ||
|
aefc8fd824 | ||
|
405a80f3ee | ||
|
ad98d35a48 | ||
|
b69ab219d7 | ||
|
dc8225f682 | ||
|
9d9b266f54 | ||
|
b9d01c1a61 | ||
|
122cae7902 | ||
|
44a332c1c4 | ||
|
5143f3ad43 | ||
|
a6dc25a216 | ||
|
f04d2a9d6a | ||
|
eb3b3b9f8d | ||
|
0994f3783f | ||
|
974dec38e3 | ||
|
a0c363647f | ||
|
d989224a8a | ||
|
82f439e715 | ||
|
b034879eae | ||
|
9ed9a6fc3d | ||
|
e84b702309 | ||
|
6226eba52a | ||
|
9e0ea06435 | ||
|
863d9cacd0 | ||
|
4baa346aae | ||
|
7956485e37 | ||
|
372e42f350 | ||
|
9124271eaf | ||
|
156dec2737 | ||
|
27f046ec03 | ||
|
74ae3dee91 | ||
|
87978e7755 | ||
|
d935ea1cda | ||
|
9602195910 | ||
|
8ca852c728 | ||
|
df067f7d1f | ||
|
a8a81e99d2 | ||
|
65e7c531de | ||
|
7c41bd72da | ||
|
355a82db54 | ||
|
b3e17bde82 | ||
|
4b38e7b1d7 | ||
|
43afae34be | ||
|
27fa55d274 | ||
|
19c3e82abf | ||
|
f1c0fd7343 | ||
|
12dfbdc400 | ||
|
c86a179412 | ||
|
0748783404 | ||
|
b3247d9364 | ||
|
ba8a694314 | ||
|
b146958ecb | ||
|
ff70a80741 | ||
|
ecdb17148d | ||
|
11bd523f7e | ||
|
01fbedc246 | ||
|
05e4e1f2f2 | ||
|
20223ad77c | ||
|
51edacb5eb | ||
|
5197ef9048 | ||
|
19678527e5 | ||
|
5d319dee94 | ||
|
15c701b196 | ||
|
d8339808a1 | ||
|
3b263f0917 | ||
|
43e1a11ad8 | ||
|
ed09f90e5e | ||
|
cbd96237fd | ||
|
f5c1cb2dff | ||
|
5eb93a6eae | ||
|
25fa577cd0 | ||
|
deddc81426 | ||
|
133b06e945 | ||
|
699f1e65cc | ||
|
9ef87dab27 | ||
|
5125e9c941 | ||
|
6c62ed5608 | ||
|
bf78288e9e | ||
|
f8498b260b | ||
|
79f08588c6 | ||
|
2d92a4dbb3 | ||
|
f508ddf66d | ||
|
02218c916c | ||
|
89217e0d58 | ||
|
cb4973987b | ||
|
905902d811 | ||
|
c83e382eac | ||
|
f6975e2acd | ||
|
d8b813c0bf | ||
|
5236ed135e | ||
|
47d955a2ab | ||
|
bd797c75a4 | ||
|
05c11964fc | ||
|
8ecd23eab4 | ||
|
1ef0206f24 | ||
|
6694aa369e | ||
|
0331d28ee4 | ||
|
51c7eb7ac1 | ||
|
5516bcb839 | ||
|
056b966501 | ||
|
28eca6a2be | ||
|
b7fd55242e | ||
|
8161955cc7 | ||
|
3b020fd95a | ||
|
697d106bd4 | ||
|
50e1c6074f | ||
|
a610987ef7 | ||
|
a7fd9f4b1b | ||
|
5f5b77cdda | ||
|
83808a63be | ||
|
6d5ff671e7 | ||
|
ffdf349a96 | ||
|
f3d53b79a2 | ||
|
6acec2c074 | ||
|
1bac3750df | ||
|
b040efff79 | ||
|
a81009607a | ||
|
c0e09662b4 | ||
|
ccf4563573 | ||
|
fb1ab09e3e | ||
|
f464b1ba39 | ||
|
2ea6348b85 | ||
|
6e536ab06d | ||
|
7537e309d8 | ||
|
84e2a2e5d1 | ||
|
f6fc826dc6 | ||
|
375d55aa5d | ||
|
6ef2bb3283 | ||
|
fc0794a83d | ||
|
589df6792f | ||
|
945bba777b | ||
|
64763eafbe | ||
|
3da4651569 | ||
|
311ed2feca | ||
|
33c11d64f0 | ||
|
a4b674902f | ||
|
3fa09dbe2e | ||
|
bf2b2df9c9 | ||
|
3617c98cf5 | ||
|
774d36c989 | ||
|
6abd61865f | ||
|
3c59b98dc8 | ||
|
21338ed789 | ||
|
dc8ab0b5ce | ||
|
ddb39ef2f6 | ||
|
355e62efe9 | ||
|
fddd11a205 | ||
|
8b37e62cf3 | ||
|
4296d47dcb | ||
|
42f1ef019a | ||
|
fe8e526292 | ||
|
0e9d612173 | ||
|
06c601bc7c | ||
|
229fbc1a18 | ||
|
e05f5010da | ||
|
073b9968c0 | ||
|
d3aa17ae77 | ||
|
4187eed12b | ||
|
12ecb325c9 | ||
|
90e48e9b61 | ||
|
35f31270f3 | ||
|
2a71852070 | ||
|
c8dd32802d | ||
|
71f04dc0e8 | ||
|
49f8bbfee4 | ||
|
f4217eba73 | ||
|
14900f6ed8 | ||
|
c18afcb01a | ||
|
63043d4a60 | ||
|
76034880ae | ||
|
768189859a | ||
|
6e5a2a5c51 | ||
|
9935c4984c | ||
|
a0a5e30c39 | ||
|
4126bbeead | ||
|
a5b79295d7 | ||
|
e917784932 | ||
|
f46b90d28d | ||
|
64cbfbed47 | ||
|
1ced35ec76 | ||
|
16d346773b | ||
|
b02120cf66 | ||
|
702b5caf2d | ||
|
d395f64f58 | ||
|
c9627040cc | ||
|
b1f69434f9 | ||
|
bcca56e3b1 | ||
|
2f98610929 | ||
|
89539ff247 | ||
|
aa74d19940 | ||
|
cf7d9ef962 | ||
|
425a0f90e9 | ||
|
a27814db8e | ||
|
9702f5256c | ||
|
23fd11e806 | ||
|
304ee1489c | ||
|
07d4179274 | ||
|
1439dde265 | ||
|
bef0bf1654 | ||
|
8435cad602 | ||
|
52c11fe23d | ||
|
6fc9641f6a | ||
|
8b6341458b | ||
|
8b787b4f70 | ||
|
ef5154d5b3 | ||
|
7c49919297 | ||
|
395a169104 | ||
|
93f710bdff | ||
|
170badfdd1 | ||
|
978b9adc56 | ||
|
3aea51455b | ||
|
f827ed338b | ||
|
73dab51ad1 | ||
|
9328007d05 | ||
|
8d173cd960 | ||
|
fb0f12a221 | ||
|
9866408b72 | ||
|
aaac56d895 | ||
|
516da7719f | ||
|
d4df0b4405 | ||
|
bfa9c3bef6 | ||
|
2904f24ea8 | ||
|
91a347bf6d | ||
|
e219c8fc03 | ||
|
9eb26b702c | ||
|
c933be926d | ||
|
fc88040b31 | ||
|
5db3c93057 | ||
|
aa442b5795 | ||
|
09711cd6f9 | ||
|
b16cacc758 | ||
|
51451a9636 | ||
|
fbc03da997 | ||
|
1a610dbdd2 | ||
|
a30e3c9066 | ||
|
613b41e357 | ||
|
d405aa98d5 | ||
|
285b1556a9 | ||
|
8321cc661c | ||
|
848ceb6f10 | ||
|
3559079de0 | ||
|
b3ab843954 | ||
|
867cf63dd9 | ||
|
0b44aa6f68 | ||
|
aa09a9dc04 | ||
|
7c4edacb2b | ||
|
782ede5db5 | ||
|
1537733e6b | ||
|
ba0d43672b | ||
|
4384d25c79 | ||
|
b6e3786529 | ||
|
6fff01397d | ||
|
0cd52e5be1 | ||
|
c14dd34dca | ||
|
e04fbd1992 | ||
|
d89fa3ebc2 | ||
|
db57454f3f | ||
|
8f93844427 | ||
|
52f84b063c | ||
|
2e7f2b6c07 | ||
|
35347c2310 | ||
|
b489fc75c9 | ||
|
fc24cb2a77 | ||
|
2540311cdf | ||
|
3880888286 | ||
|
5a806c2149 | ||
|
8a926d511a | ||
|
8885285b10 | ||
|
d1f0181947 | ||
|
b147443c32 |
1
.github/FUNDING.yml
vendored
Normal file
1
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
github: [sharkdp, keith-hall, Enselic]
|
26
.github/ISSUE_TEMPLATE/bug_report.md
vendored
26
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -9,11 +9,6 @@ assignees: ''
|
|||||||
|
|
||||||
<!-- Hey there, thank you for creating an issue! -->
|
<!-- Hey there, thank you for creating an issue! -->
|
||||||
|
|
||||||
**What version of `bat` are you using?**
|
|
||||||
|
|
||||||
<!-- Output of `bat --version` -->
|
|
||||||
|
|
||||||
|
|
||||||
**Describe the bug you encountered:**
|
**Describe the bug you encountered:**
|
||||||
|
|
||||||
...
|
...
|
||||||
@@ -29,19 +24,24 @@ assignees: ''
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
**Environment**
|
**bat version and environment**
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
In order to reproduce your issue, please add some information about the environment
|
In order to reproduce your issue, please add some information about the environment
|
||||||
in which you're running bat.
|
in which you're running bat. To do this, run the full `bat` command that demonstrates
|
||||||
|
the bug, and attach the `--diagnostic` option:
|
||||||
|
|
||||||
Linux and MacOS:
|
bat [other options and arguments…] --diagnostic
|
||||||
Please run the script at
|
|
||||||
|
Finally, paste the Markdown output here. Please make sure that it does not reveal any
|
||||||
|
personal information.
|
||||||
|
|
||||||
|
|
||||||
|
If you are running bat 0.17.1 or older (where --diagnostic is not available), please
|
||||||
|
run the script at
|
||||||
|
|
||||||
https://github.com/sharkdp/bat/blob/master/diagnostics/info.sh
|
https://github.com/sharkdp/bat/blob/master/diagnostics/info.sh
|
||||||
|
|
||||||
(click "Raw" to get the actual source code) and paste the Markdown output here.
|
(click "Raw" to get the actual source code) and paste the Markdown output here. If you
|
||||||
|
are on Windows, please let us know your bat version and your Windows version.
|
||||||
Windows:
|
|
||||||
Please add your Windows Version (e.g. "Windows 10 1908")
|
|
||||||
-->
|
-->
|
||||||
|
1
.github/ISSUE_TEMPLATE/config.yml
vendored
1
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -1,2 +1 @@
|
|||||||
blank_issues_enabled: true
|
blank_issues_enabled: true
|
||||||
|
|
||||||
|
1
.github/ISSUE_TEMPLATE/feature_request.md
vendored
1
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@@ -7,4 +7,3 @@ assignees: ''
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
1
.github/ISSUE_TEMPLATE/question.md
vendored
1
.github/ISSUE_TEMPLATE/question.md
vendored
@@ -7,4 +7,3 @@ assignees: ''
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
18
.github/dependabot.yml
vendored
Normal file
18
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: cargo
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: monthly
|
||||||
|
time: "04:00"
|
||||||
|
timezone: Europe/Berlin
|
||||||
|
ignore:
|
||||||
|
- dependency-name: git2
|
||||||
|
versions:
|
||||||
|
- 0.13.17
|
||||||
|
- package-ecosystem: gitsubmodule
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: monthly
|
||||||
|
time: "04:00"
|
||||||
|
timezone: Europe/Berlin
|
118
.github/workflows/CICD.yml
vendored
118
.github/workflows/CICD.yml
vendored
@@ -1,7 +1,7 @@
|
|||||||
name: CICD
|
name: CICD
|
||||||
|
|
||||||
env:
|
env:
|
||||||
MIN_SUPPORTED_RUST_VERSION: "1.42.0"
|
MIN_SUPPORTED_RUST_VERSION: "1.51.0"
|
||||||
CICD_INTERMEDIATES_DIR: "_cicd-intermediates"
|
CICD_INTERMEDIATES_DIR: "_cicd-intermediates"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
@@ -14,12 +14,35 @@ on:
|
|||||||
- '*'
|
- '*'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
ensure_cargo_fmt:
|
||||||
|
name: Ensure 'cargo fmt' has been run
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
default: true
|
||||||
|
profile: minimal
|
||||||
|
components: rustfmt
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- run: cargo fmt -- --check
|
||||||
|
|
||||||
|
license_checks:
|
||||||
|
name: License checks
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
submodules: true # we especially want to perform license checks on submodules
|
||||||
|
- run: tests/scripts/license-checks.sh
|
||||||
|
|
||||||
min_version:
|
min_version:
|
||||||
name: Minimum supported rust version
|
name: Minimum supported rust version
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- name: Git checkout
|
- name: Checkout source code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Install rust toolchain (v${{ env.MIN_SUPPORTED_RUST_VERSION }})
|
- name: Install rust toolchain (v${{ env.MIN_SUPPORTED_RUST_VERSION }})
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
@@ -31,17 +54,16 @@ jobs:
|
|||||||
uses: actions-rs/cargo@v1
|
uses: actions-rs/cargo@v1
|
||||||
with:
|
with:
|
||||||
command: clippy
|
command: clippy
|
||||||
# clippy::match_bool is allowed by default from Rust 1.45.0, see
|
args: --locked --all-targets --all-features
|
||||||
# https://github.com/rust-lang/rust-clippy/commit/e1d13c34b0beaea9a5fbf13687672ef85e779d9f
|
|
||||||
args: --all-targets --all-features -- --allow clippy::match_bool
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
uses: actions-rs/cargo@v1
|
uses: actions-rs/cargo@v1
|
||||||
with:
|
with:
|
||||||
command: test
|
command: test
|
||||||
|
args: --locked
|
||||||
|
|
||||||
test_with_new_syntaxes_and_themes:
|
test_with_new_syntaxes_and_themes:
|
||||||
name: Run tests with updated syntaxes and themes
|
name: Run tests with updated syntaxes and themes
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- name: Git checkout
|
- name: Git checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
@@ -69,37 +91,59 @@ jobs:
|
|||||||
uses: actions-rs/cargo@v1
|
uses: actions-rs/cargo@v1
|
||||||
with:
|
with:
|
||||||
command: test
|
command: test
|
||||||
args: --release
|
args: --locked --release
|
||||||
- name: Run ignored-by-default unit tests with new syntaxes and themes
|
- name: Run ignored-by-default unit tests with new syntaxes and themes
|
||||||
uses: actions-rs/cargo@v1
|
uses: actions-rs/cargo@v1
|
||||||
with:
|
with:
|
||||||
command: test
|
command: test
|
||||||
args: --release -- --ignored
|
args: --locked --release -- --ignored
|
||||||
- name: Syntax highlighting regression test
|
- name: Syntax highlighting regression test
|
||||||
run: tests/syntax-tests/regression_test.sh
|
run: tests/syntax-tests/regression_test.sh
|
||||||
- name: List of languages
|
- name: List of languages
|
||||||
run: bat --list-languages
|
run: bat --list-languages
|
||||||
- name: List of themes
|
- name: List of themes
|
||||||
run: bat --list-themes
|
run: bat --list-themes
|
||||||
|
- name: Test custom assets
|
||||||
|
run: tests/syntax-tests/test_custom_assets.sh
|
||||||
|
|
||||||
|
documentation:
|
||||||
|
name: Documentation
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
- name: Git checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install Rust toolchain
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
default: true
|
||||||
|
profile: minimal
|
||||||
|
- name: Check documentation
|
||||||
|
env:
|
||||||
|
RUSTDOCFLAGS: -D warnings
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: doc
|
||||||
|
args: --locked --no-deps --document-private-items --all-features
|
||||||
|
|
||||||
build:
|
build:
|
||||||
name: ${{ matrix.job.os }} (${{ matrix.job.target }})
|
name: ${{ matrix.job.target }} (${{ matrix.job.os }})
|
||||||
runs-on: ${{ matrix.job.os }}
|
runs-on: ${{ matrix.job.os }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
job:
|
job:
|
||||||
- { os: ubuntu-18.04 , target: arm-unknown-linux-gnueabihf , use-cross: true }
|
- { target: aarch64-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true }
|
||||||
- { os: ubuntu-18.04 , target: aarch64-unknown-linux-gnu , use-cross: true }
|
- { target: arm-unknown-linux-gnueabihf , os: ubuntu-20.04, use-cross: true }
|
||||||
- { os: ubuntu-18.04 , target: i686-unknown-linux-gnu , use-cross: true }
|
- { target: arm-unknown-linux-musleabihf, os: ubuntu-20.04, use-cross: true }
|
||||||
- { os: ubuntu-18.04 , target: i686-unknown-linux-musl , use-cross: true }
|
- { target: i686-pc-windows-msvc , os: windows-2019 }
|
||||||
- { os: ubuntu-18.04 , target: x86_64-unknown-linux-gnu }
|
- { target: i686-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true }
|
||||||
- { os: ubuntu-18.04 , target: x86_64-unknown-linux-musl , use-cross: true }
|
- { target: i686-unknown-linux-musl , os: ubuntu-20.04, use-cross: true }
|
||||||
- { os: macos-10.15 , target: x86_64-apple-darwin }
|
- { target: x86_64-apple-darwin , os: macos-10.15 }
|
||||||
# - { os: windows-2019 , target: i686-pc-windows-gnu } ## disabled; error: linker `i686-w64-mingw32-gcc` not found
|
- { target: x86_64-pc-windows-gnu , os: windows-2019 }
|
||||||
- { os: windows-2019 , target: i686-pc-windows-msvc }
|
- { target: x86_64-pc-windows-msvc , os: windows-2019 }
|
||||||
- { os: windows-2019 , target: x86_64-pc-windows-gnu }
|
- { target: x86_64-unknown-linux-gnu , os: ubuntu-20.04 }
|
||||||
- { os: windows-2019 , target: x86_64-pc-windows-msvc }
|
- { target: x86_64-unknown-linux-musl , os: ubuntu-20.04, use-cross: true }
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout source code
|
- name: Checkout source code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
@@ -108,14 +152,14 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
case ${{ matrix.job.target }} in
|
case ${{ matrix.job.target }} in
|
||||||
arm-unknown-linux-gnueabihf) sudo apt-get -y update ; sudo apt-get -y install gcc-arm-linux-gnueabihf ;;
|
arm-unknown-linux-*) sudo apt-get -y update ; sudo apt-get -y install gcc-arm-linux-gnueabihf ;;
|
||||||
aarch64-unknown-linux-gnu) sudo apt-get -y update ; sudo apt-get -y install gcc-aarch64-linux-gnu ;;
|
aarch64-unknown-linux-gnu) sudo apt-get -y update ; sudo apt-get -y install gcc-aarch64-linux-gnu ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
- name: Extract crate information
|
- name: Extract crate information
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
echo "PROJECT_NAME=$(sed -n 's/^name = "\(.*\)"/\1/p' Cargo.toml)" >> $GITHUB_ENV
|
echo "PROJECT_NAME=$(sed -n 's/^name = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> $GITHUB_ENV
|
||||||
echo "PROJECT_VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> $GITHUB_ENV
|
echo "PROJECT_VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> $GITHUB_ENV
|
||||||
echo "PROJECT_MAINTAINER=$(sed -n 's/^authors = \["\(.*\)"\]/\1/p' Cargo.toml)" >> $GITHUB_ENV
|
echo "PROJECT_MAINTAINER=$(sed -n 's/^authors = \["\(.*\)"\]/\1/p' Cargo.toml)" >> $GITHUB_ENV
|
||||||
echo "PROJECT_HOMEPAGE=$(sed -n 's/^homepage = "\(.*\)"/\1/p' Cargo.toml)" >> $GITHUB_ENV
|
echo "PROJECT_HOMEPAGE=$(sed -n 's/^homepage = "\(.*\)"/\1/p' Cargo.toml)" >> $GITHUB_ENV
|
||||||
@@ -143,7 +187,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
use-cross: ${{ matrix.job.use-cross }}
|
use-cross: ${{ matrix.job.use-cross }}
|
||||||
command: build
|
command: build
|
||||||
args: --release --target=${{ matrix.job.target }}
|
args: --locked --release --target=${{ matrix.job.target }}
|
||||||
|
|
||||||
- name: Strip debug information from executable
|
- name: Strip debug information from executable
|
||||||
id: strip
|
id: strip
|
||||||
@@ -158,7 +202,7 @@ jobs:
|
|||||||
# Figure out what strip tool to use if any
|
# Figure out what strip tool to use if any
|
||||||
STRIP="strip"
|
STRIP="strip"
|
||||||
case ${{ matrix.job.target }} in
|
case ${{ matrix.job.target }} in
|
||||||
arm-unknown-linux-gnueabihf) STRIP="arm-linux-gnueabihf-strip" ;;
|
arm-unknown-linux-*) STRIP="arm-linux-gnueabihf-strip" ;;
|
||||||
aarch64-unknown-linux-gnu) STRIP="aarch64-linux-gnu-strip" ;;
|
aarch64-unknown-linux-gnu) STRIP="aarch64-linux-gnu-strip" ;;
|
||||||
*-pc-windows-msvc) STRIP="" ;;
|
*-pc-windows-msvc) STRIP="" ;;
|
||||||
esac;
|
esac;
|
||||||
@@ -195,49 +239,56 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
use-cross: ${{ matrix.job.use-cross }}
|
use-cross: ${{ matrix.job.use-cross }}
|
||||||
command: test
|
command: test
|
||||||
args: --target=${{ matrix.job.target }} ${{ steps.test-options.outputs.CARGO_TEST_OPTIONS}}
|
args: --locked --target=${{ matrix.job.target }} ${{ steps.test-options.outputs.CARGO_TEST_OPTIONS}}
|
||||||
|
|
||||||
- name: Run bat
|
- name: Run bat
|
||||||
uses: actions-rs/cargo@v1
|
uses: actions-rs/cargo@v1
|
||||||
with:
|
with:
|
||||||
use-cross: ${{ matrix.job.use-cross }}
|
use-cross: ${{ matrix.job.use-cross }}
|
||||||
command: run
|
command: run
|
||||||
args: --target=${{ matrix.job.target }} -- --paging=never --color=always --theme=ansi Cargo.toml src/config.rs
|
args: --locked --target=${{ matrix.job.target }} -- --paging=never --color=always --theme=ansi Cargo.toml src/config.rs
|
||||||
|
|
||||||
- name: Show diagnostics (bat --diagnostic)
|
- name: Show diagnostics (bat --diagnostic)
|
||||||
uses: actions-rs/cargo@v1
|
uses: actions-rs/cargo@v1
|
||||||
with:
|
with:
|
||||||
use-cross: ${{ matrix.job.use-cross }}
|
use-cross: ${{ matrix.job.use-cross }}
|
||||||
command: run
|
command: run
|
||||||
args: --target=${{ matrix.job.target }} -- --paging=never --color=always --theme=ansi Cargo.toml src/config.rs --diagnostic
|
args: --locked --target=${{ matrix.job.target }} -- --paging=never --color=always --theme=ansi Cargo.toml src/config.rs --diagnostic
|
||||||
|
|
||||||
- name: "Feature check: regex-onig"
|
- name: "Feature check: regex-onig"
|
||||||
uses: actions-rs/cargo@v1
|
uses: actions-rs/cargo@v1
|
||||||
with:
|
with:
|
||||||
use-cross: ${{ matrix.job.use-cross }}
|
use-cross: ${{ matrix.job.use-cross }}
|
||||||
command: check
|
command: check
|
||||||
args: --target=${{ matrix.job.target }} --verbose --lib --no-default-features --features regex-onig
|
args: --locked --target=${{ matrix.job.target }} --verbose --lib --no-default-features --features regex-onig
|
||||||
|
|
||||||
- name: "Feature check: regex-onig,git"
|
- name: "Feature check: regex-onig,git"
|
||||||
uses: actions-rs/cargo@v1
|
uses: actions-rs/cargo@v1
|
||||||
with:
|
with:
|
||||||
use-cross: ${{ matrix.job.use-cross }}
|
use-cross: ${{ matrix.job.use-cross }}
|
||||||
command: check
|
command: check
|
||||||
args: --target=${{ matrix.job.target }} --verbose --lib --no-default-features --features regex-onig,git
|
args: --locked --target=${{ matrix.job.target }} --verbose --lib --no-default-features --features regex-onig,git
|
||||||
|
|
||||||
- name: "Feature check: regex-onig,paging"
|
- name: "Feature check: regex-onig,paging"
|
||||||
uses: actions-rs/cargo@v1
|
uses: actions-rs/cargo@v1
|
||||||
with:
|
with:
|
||||||
use-cross: ${{ matrix.job.use-cross }}
|
use-cross: ${{ matrix.job.use-cross }}
|
||||||
command: check
|
command: check
|
||||||
args: --target=${{ matrix.job.target }} --verbose --lib --no-default-features --features regex-onig,paging
|
args: --locked --target=${{ matrix.job.target }} --verbose --lib --no-default-features --features regex-onig,paging
|
||||||
|
|
||||||
- name: "Feature check: regex-onig,git,paging"
|
- name: "Feature check: regex-onig,git,paging"
|
||||||
uses: actions-rs/cargo@v1
|
uses: actions-rs/cargo@v1
|
||||||
with:
|
with:
|
||||||
use-cross: ${{ matrix.job.use-cross }}
|
use-cross: ${{ matrix.job.use-cross }}
|
||||||
command: check
|
command: check
|
||||||
args: --target=${{ matrix.job.target }} --verbose --lib --no-default-features --features regex-onig,git,paging
|
args: --locked --target=${{ matrix.job.target }} --verbose --lib --no-default-features --features regex-onig,git,paging
|
||||||
|
|
||||||
|
- name: "Feature check: minimal-application"
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
use-cross: ${{ matrix.job.use-cross }}
|
||||||
|
command: check
|
||||||
|
args: --locked --target=${{ matrix.job.target }} --verbose --no-default-features --features minimal-application
|
||||||
|
|
||||||
- name: Create tarball
|
- name: Create tarball
|
||||||
id: package
|
id: package
|
||||||
@@ -263,7 +314,9 @@ jobs:
|
|||||||
cp "README.md" "LICENSE-MIT" "LICENSE-APACHE" "CHANGELOG.md" "$ARCHIVE_DIR"
|
cp "README.md" "LICENSE-MIT" "LICENSE-APACHE" "CHANGELOG.md" "$ARCHIVE_DIR"
|
||||||
|
|
||||||
# Autocompletion files
|
# Autocompletion files
|
||||||
|
cp 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/completions/bat.bash "$ARCHIVE_DIR/autocomplete/${{ env.PROJECT_NAME }}.bash"
|
||||||
cp 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/completions/bat.fish "$ARCHIVE_DIR/autocomplete/${{ env.PROJECT_NAME }}.fish"
|
cp 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/completions/bat.fish "$ARCHIVE_DIR/autocomplete/${{ env.PROJECT_NAME }}.fish"
|
||||||
|
cp 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/completions/_bat.ps1 "$ARCHIVE_DIR/autocomplete/_${{ env.PROJECT_NAME }}.ps1"
|
||||||
cp 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/completions/bat.zsh "$ARCHIVE_DIR/autocomplete/${{ env.PROJECT_NAME }}.zsh"
|
cp 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/completions/bat.zsh "$ARCHIVE_DIR/autocomplete/${{ env.PROJECT_NAME }}.zsh"
|
||||||
|
|
||||||
# base compressed package
|
# base compressed package
|
||||||
@@ -312,6 +365,7 @@ jobs:
|
|||||||
gzip -n --best "${DPKG_DIR}/usr/share/man/man1/${{ env.PROJECT_NAME }}.1"
|
gzip -n --best "${DPKG_DIR}/usr/share/man/man1/${{ env.PROJECT_NAME }}.1"
|
||||||
|
|
||||||
# Autocompletion files
|
# Autocompletion files
|
||||||
|
install -Dm644 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/completions/bat.bash "${DPKG_DIR}/usr/share/bash-completion/completions/${{ env.PROJECT_NAME }}"
|
||||||
install -Dm644 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/completions/bat.fish "${DPKG_DIR}/usr/share/fish/vendor_completions.d/${{ env.PROJECT_NAME }}.fish"
|
install -Dm644 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/completions/bat.fish "${DPKG_DIR}/usr/share/fish/vendor_completions.d/${{ env.PROJECT_NAME }}.fish"
|
||||||
install -Dm644 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/completions/bat.zsh "${DPKG_DIR}/usr/share/zsh/vendor-completions/_${{ env.PROJECT_NAME }}"
|
install -Dm644 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/completions/bat.zsh "${DPKG_DIR}/usr/share/zsh/vendor-completions/_${{ env.PROJECT_NAME }}"
|
||||||
|
|
||||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,6 +2,7 @@
|
|||||||
**/*.rs.bk
|
**/*.rs.bk
|
||||||
|
|
||||||
# Generated files
|
# Generated files
|
||||||
|
/assets/completions/bat.bash
|
||||||
/assets/completions/bat.fish
|
/assets/completions/bat.fish
|
||||||
/assets/completions/bat.zsh
|
/assets/completions/bat.zsh
|
||||||
/assets/manual/bat.1
|
/assets/manual/bat.1
|
||||||
|
46
.gitmodules
vendored
46
.gitmodules
vendored
@@ -61,18 +61,12 @@
|
|||||||
[submodule "assets/syntaxes/Puppet"]
|
[submodule "assets/syntaxes/Puppet"]
|
||||||
path = assets/syntaxes/02_Extra/Puppet
|
path = assets/syntaxes/02_Extra/Puppet
|
||||||
url = https://github.com/russCloak/SublimePuppet
|
url = https://github.com/russCloak/SublimePuppet
|
||||||
[submodule "assets/syntaxes/CSV"]
|
|
||||||
path = assets/syntaxes/02_Extra/CSV
|
|
||||||
url = https://github.com/wadetb/Sublime-Text-Advanced-CSV
|
|
||||||
[submodule "assets/themes/onehalf"]
|
[submodule "assets/themes/onehalf"]
|
||||||
path = assets/themes/onehalf
|
path = assets/themes/onehalf
|
||||||
url = https://github.com/sonph/onehalf
|
url = https://github.com/sonph/onehalf
|
||||||
[submodule "assets/syntaxes/JavaScript (Babel)"]
|
[submodule "assets/syntaxes/JavaScript (Babel)"]
|
||||||
path = assets/syntaxes/02_Extra/JavaScript (Babel)
|
path = assets/syntaxes/02_Extra/JavaScript (Babel)
|
||||||
url = https://github.com/babel/babel-sublime
|
url = https://github.com/babel/babel-sublime
|
||||||
[submodule "assets/syntaxes/Dart"]
|
|
||||||
path = assets/syntaxes/02_Extra/Dart
|
|
||||||
url = https://github.com/guillermooo/dart-sublime-bundle
|
|
||||||
[submodule "assets/syntaxes/FSharp"]
|
[submodule "assets/syntaxes/FSharp"]
|
||||||
path = assets/syntaxes/02_Extra/FSharp
|
path = assets/syntaxes/02_Extra/FSharp
|
||||||
url = https://github.com/hoest/sublimetext-fsharp
|
url = https://github.com/hoest/sublimetext-fsharp
|
||||||
@@ -97,10 +91,6 @@
|
|||||||
[submodule "assets/syntaxes/Assembly (ARM)"]
|
[submodule "assets/syntaxes/Assembly (ARM)"]
|
||||||
path = assets/syntaxes/02_Extra/Assembly (ARM)
|
path = assets/syntaxes/02_Extra/Assembly (ARM)
|
||||||
url = https://github.com/tvi/Sublime-ARM-Assembly
|
url = https://github.com/tvi/Sublime-ARM-Assembly
|
||||||
[submodule "assets/syntaxes/syslog-syntax"]
|
|
||||||
path = assets/syntaxes/02_Extra/Syslog
|
|
||||||
url = https://github.com/caos21/syslog-syntax.git
|
|
||||||
branch = master
|
|
||||||
[submodule "assets/syntaxes/protobuf-syntax-highlighting"]
|
[submodule "assets/syntaxes/protobuf-syntax-highlighting"]
|
||||||
path = assets/syntaxes/02_Extra/Protobuf
|
path = assets/syntaxes/02_Extra/Protobuf
|
||||||
url = https://github.com/VcamX/protobuf-syntax-highlighting.git
|
url = https://github.com/VcamX/protobuf-syntax-highlighting.git
|
||||||
@@ -120,9 +110,6 @@
|
|||||||
[submodule "assets/syntaxes/Org mode"]
|
[submodule "assets/syntaxes/Org mode"]
|
||||||
path = assets/syntaxes/02_Extra/Org mode
|
path = assets/syntaxes/02_Extra/Org mode
|
||||||
url = https://github.com/jezcope/Org.tmbundle.git
|
url = https://github.com/jezcope/Org.tmbundle.git
|
||||||
[submodule "assets/syntaxes/requirementstxt"]
|
|
||||||
path = assets/syntaxes/02_Extra/requirementstxt
|
|
||||||
url = https://github.com/wuub/requirementstxt
|
|
||||||
[submodule "assets/syntaxes/DotENV"]
|
[submodule "assets/syntaxes/DotENV"]
|
||||||
path = assets/syntaxes/02_Extra/DotENV
|
path = assets/syntaxes/02_Extra/DotENV
|
||||||
url = https://github.com/zaynali53/DotENV
|
url = https://github.com/zaynali53/DotENV
|
||||||
@@ -210,9 +197,42 @@
|
|||||||
[submodule "assets/syntaxes/02_Extra/Lean"]
|
[submodule "assets/syntaxes/02_Extra/Lean"]
|
||||||
path = assets/syntaxes/02_Extra/Lean
|
path = assets/syntaxes/02_Extra/Lean
|
||||||
url = https://github.com/leanprover/vscode-lean.git
|
url = https://github.com/leanprover/vscode-lean.git
|
||||||
|
[submodule "assets/syntaxes/02_Extra/LiveScript"]
|
||||||
|
path = assets/syntaxes/02_Extra/LiveScript
|
||||||
|
url = https://github.com/paulmillr/LiveScript.tmbundle
|
||||||
[submodule "assets/syntaxes/02_Extra/Zig"]
|
[submodule "assets/syntaxes/02_Extra/Zig"]
|
||||||
path = assets/syntaxes/02_Extra/Zig
|
path = assets/syntaxes/02_Extra/Zig
|
||||||
url = https://github.com/ziglang/sublime-zig-language.git
|
url = https://github.com/ziglang/sublime-zig-language.git
|
||||||
[submodule "assets/syntaxes/02_Extra/gnuplot"]
|
[submodule "assets/syntaxes/02_Extra/gnuplot"]
|
||||||
path = assets/syntaxes/02_Extra/gnuplot
|
path = assets/syntaxes/02_Extra/gnuplot
|
||||||
url = https://github.com/hesstobi/sublime_gnuplot
|
url = https://github.com/hesstobi/sublime_gnuplot
|
||||||
|
[submodule "assets/syntaxes/02_Extra/SystemVerilog"]
|
||||||
|
path = assets/syntaxes/02_Extra/SystemVerilog
|
||||||
|
url = https://github.com/TheClams/SystemVerilog.git
|
||||||
|
[submodule "assets/themes/visual-studio-dark-plus"]
|
||||||
|
path = assets/themes/visual-studio-dark-plus
|
||||||
|
url = https://github.com/vidann1/visual-studio-dark-plus.git
|
||||||
|
[submodule "assets/syntaxes/02_Extra/SublimeEthereum"]
|
||||||
|
path = assets/syntaxes/02_Extra/SublimeEthereum
|
||||||
|
url = https://github.com/davidhq/SublimeEthereum.git
|
||||||
|
[submodule "assets/syntaxes/02_Extra/Groff"]
|
||||||
|
path = assets/syntaxes/02_Extra/Groff
|
||||||
|
url = https://github.com/carsonoid/sublime_man_page_support
|
||||||
|
[submodule "assets/syntaxes/02_Extra/http-request-response"]
|
||||||
|
path = assets/syntaxes/02_Extra/http-request-response
|
||||||
|
url = https://github.com/keith-hall/http-request-response-syntax.git
|
||||||
|
[submodule "assets/syntaxes/02_Extra/LLVM"]
|
||||||
|
path = assets/syntaxes/02_Extra/LLVM
|
||||||
|
url = https://github.com/ioncodes/LLVM.tmBundle
|
||||||
|
[submodule "assets/syntaxes/02_Extra/Slim"]
|
||||||
|
path = assets/syntaxes/02_Extra/Slim
|
||||||
|
url = https://github.com/slim-template/ruby-slim.tmbundle.git
|
||||||
|
[submodule "assets/syntaxes/02_Extra/Racket"]
|
||||||
|
path = assets/syntaxes/02_Extra/Racket
|
||||||
|
url = https://github.com/follesoe/sublime-racket.git
|
||||||
|
[submodule "assets/syntaxes/02_Extra/MediaWiki"]
|
||||||
|
path = assets/syntaxes/02_Extra/MediaWiki
|
||||||
|
url = https://github.com/tosher/Mediawiker.git
|
||||||
|
[submodule "assets/syntaxes/02_Extra/Dart"]
|
||||||
|
path = assets/syntaxes/02_Extra/Dart
|
||||||
|
url = https://github.com/elMuso/Dartlight.git
|
||||||
|
135
CHANGELOG.md
135
CHANGELOG.md
@@ -1,5 +1,138 @@
|
|||||||
# unreleased
|
# unreleased
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- New style component `header-filesize` to show size of the displayed file in the header. See #1988 (@mdibaiee)
|
||||||
|
|
||||||
|
## Bugfixes
|
||||||
|
|
||||||
|
## Other
|
||||||
|
|
||||||
|
## Syntaxes
|
||||||
|
|
||||||
|
- `GraphQL`: Add support for interfaces implementing interfaces and consider ampersand an operator. See #2000
|
||||||
|
- Associate `_vimrc` and `_gvimrc` files with the `VimL` syntax. See #2002
|
||||||
|
- Associate `poetry.lock` files with the `TOML` syntax. See #2049
|
||||||
|
- Associate `.mesh`, `.task`, `.rgen`, `.rint`, `.rahit`, `.rchit`, `.rmiss`, and `.rcall` with the `GLSL` syntax. See #2050
|
||||||
|
|
||||||
|
## Themes
|
||||||
|
|
||||||
|
## `bat` as a library
|
||||||
|
|
||||||
|
- Exposed `get_syntax_set` and `get_theme` methods on `HighlightingAssets`. See #2030 (@dandavison)
|
||||||
|
|
||||||
|
# v0.19.0
|
||||||
|
|
||||||
|
## Performance
|
||||||
|
|
||||||
|
- Reduce startup time in loop-through mode (e.g. when redirecting output) by 90%. See #1747 (@Enselic)
|
||||||
|
- Load themes lazily to make bat start 25% faster when disregarding syntax load time. See #1969 (@Enselic)
|
||||||
|
- Python syntax highlighting no longer suffers from abysmal performance in specific scenarios. See #1688 (@keith-hall)
|
||||||
|
- Fix for poor performance when ANSI escape sequences are piped to `bat`, see #1596 (@eth-p)
|
||||||
|
- Fix for incorrect handling of ANSI escape sequences when using `--wrap=never`, see #1596 (@eth-p)
|
||||||
|
- Load custom assets as fast as integrated assets, see #1753 (@Enselic)
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Support for `x:-delta` (minus) syntax in line ranges (e.g. `20:-10`). See #1901 (@bojan88)
|
||||||
|
- Support for `--ignored-suffix` argument. See #1892 (@bojan88)
|
||||||
|
- `$BAT_CONFIG_DIR` is now a recognized environment variable. It has precedence over `$XDG_CONFIG_HOME`, see #1727 (@billrisher)
|
||||||
|
- Support for `x:+delta` syntax in line ranges (e.g. `20:+10`). See #1810 (@bojan88)
|
||||||
|
- Add new `--acknowledgements` option that gives credit to theme and syntax definition authors. See #1971 (@Enselic)
|
||||||
|
- Include git hash in `bat -V` and `bat --version` output if present. See #1921 (@Enselic)
|
||||||
|
|
||||||
|
## Bugfixes
|
||||||
|
|
||||||
|
- First line not shown in diff context. See #1891 (@divagant-martian)
|
||||||
|
- Do not ignore syntaxes that handle file names with a `*.conf` extension. See #1703 (@cbolgiano)
|
||||||
|
|
||||||
|
## Other
|
||||||
|
|
||||||
|
- Add PowerShell completion, see #1826 (@rashil2000)
|
||||||
|
- Minimum supported Rust version (MSRV) bumped to 1.51, see #1994 (@mdibaiee)
|
||||||
|
|
||||||
|
## Syntaxes
|
||||||
|
|
||||||
|
- Groff, see #1685 (@scop)
|
||||||
|
- HTTP Requests and Responses, see #1748 (@keith-hall)
|
||||||
|
- LLVM, see #1777 (@ioncodes)
|
||||||
|
- Highlight for `vimrc` and `gvimrc` files, see #1763 (@SuperSandro2000)
|
||||||
|
- Syslog highlighting improvements, see #1793 (@scop)
|
||||||
|
- Added support for `slim` syntax, see #1693 (@mfinelli)
|
||||||
|
- Racket, see #1884 (@jubnzv)
|
||||||
|
- LiveScript, see #1915 (@Enselic)
|
||||||
|
- MediaWiki, see #1925 (@sorairolake)
|
||||||
|
- The `requirements.txt` syntax has been removed due to incompatible license requirements.
|
||||||
|
- Dart, new highlighter, see #1959 (@Ersikan)
|
||||||
|
- SCSS and Sass syntaxes updated, see #1766 (@Enselic)
|
||||||
|
- PowerShell syntax updated, see #1935 (@Enselic)
|
||||||
|
- TypeScript syntax updated, see #1834 (@Enselic)
|
||||||
|
|
||||||
|
## `bat` as a library
|
||||||
|
|
||||||
|
- Deprecate `HighlightingAssets::syntaxes()` and `HighlightingAssets::syntax_for_file_name()`. Use `HighlightingAssets::get_syntaxes()` and `HighlightingAssets::get_syntax_for_path()` instead. They return a `Result` which is needed for upcoming lazy-loading work to improve startup performance. They also return which `SyntaxSet` the returned `SyntaxReference` belongs to. See #1747, #1755, #1776, #1862 (@Enselic)
|
||||||
|
- Remove `HighlightingAssets::from_files` and `HighlightingAssets::save_to_cache`. Instead of calling the former and then the latter you now make a single call to `bat::assets::build`. See #1802, #1971 (@Enselic)
|
||||||
|
- Replace the `error::Error(error::ErrorKind, _)` struct and enum with an `error::Error` enum. `Error(ErrorKind::UnknownSyntax, _)` becomes `Error::UnknownSyntax`, etc. Also remove the `error::ResultExt` trait. These changes stem from replacing `error-chain` with `thiserror`. See #1820 (@Enselic)
|
||||||
|
- Add new `MappingTarget` enum variant `MapExtensionToUnknown`. Refer to its documentation for more information. Also mark `MappingTarget` as `#[non_exhaustive]` since more enum variants might be added in the future. See #1703 (@cbolgiano), #2012 (@Enselic)
|
||||||
|
|
||||||
|
|
||||||
|
# v0.18.3
|
||||||
|
|
||||||
|
## Bugfixes
|
||||||
|
|
||||||
|
- Bump `git2` dependency to fix build with Rust 1.54, see #1761
|
||||||
|
|
||||||
|
|
||||||
|
# v0.18.2
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Ignore known backup/template filename suffixes when selecting the syntax, see #1687 (@scop)
|
||||||
|
|
||||||
|
## Bugfixes
|
||||||
|
|
||||||
|
- Fix for a security vulnerability on Windows. Prior to this release, `bat` would execute programs called `less`/`less.exe` from the current working directory (instead of the one from `PATH`) with priority. An attacker might be able to use this by placing a malicious program in a shared directory where the user would execute `bat`. `bat` users on Windows are advised to upgrade to this version. See #1724 and #1472 (@Ry0taK).
|
||||||
|
|
||||||
|
## Other
|
||||||
|
|
||||||
|
- Add bash completion, see #1678 (@scop)
|
||||||
|
- Fix Clippy lints, see #1661 (@mohamed-abdelnour)
|
||||||
|
- Add syntax highlighting test files, see #1213 and #1668 (@mohamed-abdelnour)
|
||||||
|
|
||||||
|
## Syntaxes
|
||||||
|
|
||||||
|
- Upgraded Julia syntax to fix a highlighting bug, see #1692
|
||||||
|
- Added support for `dash` syntax, see #1654 (@mohamed-abdelnour)
|
||||||
|
- Added support for `XAML` syntax, see #1590 and #1655 (@mohamed-abdelnour)
|
||||||
|
- Apply `DotENV` syntax also for `.env.default` and `.env.defaults` files, see #1669
|
||||||
|
|
||||||
|
|
||||||
|
# v0.18.1
|
||||||
|
|
||||||
|
## Bugfixes
|
||||||
|
|
||||||
|
- Mouse support and screen clearing broken for `less` versions with minor version number (581.2), see #1629 and #1639 (@aswild)
|
||||||
|
|
||||||
|
## Other
|
||||||
|
|
||||||
|
- `Input::ordinary_file` and `Input::with_name` now accept `Path` rather than `OsStr` see #1571 (@matklad)
|
||||||
|
- The `LESS` environment variable is now included in `bat --diagnostic`, see #1589 (@Enselic)
|
||||||
|
- Increased min. required Rust version to 1.45
|
||||||
|
|
||||||
|
## Syntaxes
|
||||||
|
|
||||||
|
- Improved the Syslog syntax highlighting, see #1606 (@keith-hall)
|
||||||
|
- Replaced "Advanced CSV" with a custom CSV syntax definition written especially for `bat`; see #1574 (@keith-hall)
|
||||||
|
- Added SystemVerilog file syntax, see #1580 (@SeanMcLoughlin)
|
||||||
|
- Added Solidity and Vyper syntax, see #1602 (@Ersikan)
|
||||||
|
|
||||||
|
## New themes
|
||||||
|
|
||||||
|
- Dark+ VS Code theme, see #1588 and #1598 (@PatriotRossii)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# v0.18.0
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
@@ -489,7 +622,7 @@ You can see the API documentation here: https://docs.rs/bat/
|
|||||||
|
|
||||||
- Added `BAT_CONFIG_PATH` environment variable to set a non-default path for `bat`s configuration file, see #375 (@deg4uss3r)
|
- Added `BAT_CONFIG_PATH` environment variable to set a non-default path for `bat`s configuration file, see #375 (@deg4uss3r)
|
||||||
|
|
||||||
- Allow for multiple occurences of `--style` to allow for the configuration
|
- Allow for multiple occurrences of `--style` to allow for the configuration
|
||||||
of styles from the config file, see #367 (@sindreij)
|
of styles from the config file, see #367 (@sindreij)
|
||||||
|
|
||||||
- Allow for multiple `--line-range` arguments, see #23
|
- Allow for multiple `--line-range` arguments, see #23
|
||||||
|
635
Cargo.lock
generated
635
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
57
Cargo.toml
57
Cargo.toml
@@ -6,7 +6,7 @@ homepage = "https://github.com/sharkdp/bat"
|
|||||||
license = "MIT/Apache-2.0"
|
license = "MIT/Apache-2.0"
|
||||||
name = "bat"
|
name = "bat"
|
||||||
repository = "https://github.com/sharkdp/bat"
|
repository = "https://github.com/sharkdp/bat"
|
||||||
version = "0.18.0"
|
version = "0.19.0"
|
||||||
exclude = ["assets/syntaxes/*", "assets/themes/*"]
|
exclude = ["assets/syntaxes/*", "assets/themes/*"]
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
edition = '2018'
|
edition = '2018'
|
||||||
@@ -16,17 +16,25 @@ default = ["application"]
|
|||||||
# Feature required for bat the application. Should be disabled when depending on
|
# Feature required for bat the application. Should be disabled when depending on
|
||||||
# bat as a library.
|
# bat as a library.
|
||||||
application = [
|
application = [
|
||||||
|
"bugreport",
|
||||||
|
"build-assets",
|
||||||
|
"git",
|
||||||
|
"minimal-application",
|
||||||
|
]
|
||||||
|
# Mainly for developers that want to iterate quickly
|
||||||
|
# Be aware that the included features might change in the future
|
||||||
|
minimal-application = [
|
||||||
"atty",
|
"atty",
|
||||||
"clap",
|
"clap",
|
||||||
"dirs-next",
|
"dirs-next",
|
||||||
"git",
|
|
||||||
"lazy_static",
|
|
||||||
"paging",
|
"paging",
|
||||||
"wild",
|
|
||||||
"regex-onig",
|
"regex-onig",
|
||||||
|
"wild",
|
||||||
]
|
]
|
||||||
git = ["git2"] # Support indicating git modifications
|
git = ["git2"] # Support indicating git modifications
|
||||||
paging = ["shell-words"] # Support applying a pager on the output
|
paging = ["shell-words", "grep-cli"] # Support applying a pager on the output
|
||||||
|
# Add "syntect/plist-load" when https://github.com/trishume/syntect/pull/345 reaches us
|
||||||
|
build-assets = ["syntect/yaml-load", "syntect/dump-create", "regex", "walkdir"]
|
||||||
|
|
||||||
# You need to use one of these if you depend on bat as a library:
|
# You need to use one of these if you depend on bat as a library:
|
||||||
regex-onig = ["syntect/regex-onig"] # Use the "oniguruma" regex engine
|
regex-onig = ["syntect/regex-onig"] # Use the "oniguruma" regex engine
|
||||||
@@ -35,22 +43,29 @@ regex-fancy = ["syntect/regex-fancy"] # Use the rust-only "fancy-regex" engine
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
atty = { version = "0.2.14", optional = true }
|
atty = { version = "0.2.14", optional = true }
|
||||||
ansi_term = "^0.12.1"
|
ansi_term = "^0.12.1"
|
||||||
ansi_colours = "^1.0"
|
ansi_colours = "^1.1"
|
||||||
console = "0.14.0"
|
bincode = "1.0"
|
||||||
lazy_static = { version = "1.4", optional = true }
|
console = "0.15.0"
|
||||||
|
flate2 = "1.0"
|
||||||
|
once_cell = "1.9"
|
||||||
|
thiserror = "1.0"
|
||||||
wild = { version = "2.0", optional = true }
|
wild = { version = "2.0", optional = true }
|
||||||
content_inspector = "0.2.4"
|
content_inspector = "0.2.4"
|
||||||
encoding = "0.2"
|
encoding = "0.2"
|
||||||
shell-words = { version = "1.0.0", optional = true }
|
shell-words = { version = "1.0.0", optional = true }
|
||||||
unicode-width = "0.1.8"
|
unicode-width = "0.1.9"
|
||||||
globset = "0.4"
|
globset = "0.4"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_yaml = "0.8"
|
serde_yaml = "0.8"
|
||||||
semver = "0.11"
|
semver = "1.0"
|
||||||
path_abs = { version = "0.5", default-features = false }
|
path_abs = { version = "0.5", default-features = false }
|
||||||
clircle = "0.3"
|
clircle = "0.3"
|
||||||
bugreport = "0.3"
|
bugreport = { version = "0.4", optional = true }
|
||||||
dirs-next = { version = "2.0.0", optional = true }
|
dirs-next = { version = "2.0.0", optional = true }
|
||||||
|
grep-cli = { version = "0.1.6", optional = true }
|
||||||
|
regex = { version = "1.0", optional = true }
|
||||||
|
walkdir = { version = "2.0", optional = true }
|
||||||
|
bytesize = { version = "1.1.0" }
|
||||||
|
|
||||||
[dependencies.git2]
|
[dependencies.git2]
|
||||||
version = "0.13"
|
version = "0.13"
|
||||||
@@ -58,32 +73,28 @@ optional = true
|
|||||||
default-features = false
|
default-features = false
|
||||||
|
|
||||||
[dependencies.syntect]
|
[dependencies.syntect]
|
||||||
version = "4.5.0"
|
version = "4.6.0"
|
||||||
default-features = false
|
default-features = false
|
||||||
features = ["parsing", "yaml-load", "dump-load", "dump-create"]
|
features = ["parsing"]
|
||||||
|
|
||||||
[dependencies.clap]
|
[dependencies.clap]
|
||||||
version = "2.33"
|
version = "2.34"
|
||||||
optional = true
|
optional = true
|
||||||
default-features = false
|
default-features = false
|
||||||
features = ["suggestions", "color", "wrap_help"]
|
features = ["suggestions", "color", "wrap_help"]
|
||||||
|
|
||||||
[dependencies.error-chain]
|
|
||||||
version = "0.12"
|
|
||||||
default-features = false
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
assert_cmd = "1.0.2"
|
assert_cmd = "2.0.4"
|
||||||
serial_test = "0.5.1"
|
serial_test = "0.5.1"
|
||||||
predicates = "1.0.7"
|
predicates = "2.1.0"
|
||||||
wait-timeout = "0.2.0"
|
wait-timeout = "0.2.0"
|
||||||
tempfile = "3.2.0"
|
tempfile = "3.3.0"
|
||||||
|
|
||||||
[target.'cfg(unix)'.dev-dependencies]
|
[target.'cfg(unix)'.dev-dependencies]
|
||||||
nix = "0.19.1"
|
nix = "0.23.1"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
clap = { version = "2.33", optional = true }
|
clap = { version = "2.34", optional = true }
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
lto = true
|
lto = true
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2018-2020 bat-developers (https://github.com/sharkdp/bat).
|
Copyright (c) 2018-2021 bat-developers (https://github.com/sharkdp/bat).
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
6
NOTICE
Normal file
6
NOTICE
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
Copyright (c) 2018-2021 bat-developers (https://github.com/sharkdp/bat).
|
||||||
|
|
||||||
|
bat is made available under the terms of either the MIT License or the Apache
|
||||||
|
License 2.0, at your option.
|
||||||
|
|
||||||
|
See the LICENSE-APACHE and LICENSE-MIT files for license details.
|
90
README.md
90
README.md
@@ -12,9 +12,26 @@
|
|||||||
<a href="#installation">Installation</a> •
|
<a href="#installation">Installation</a> •
|
||||||
<a href="#customization">Customization</a> •
|
<a href="#customization">Customization</a> •
|
||||||
<a href="#project-goals-and-alternatives">Project goals, alternatives</a><br>
|
<a href="#project-goals-and-alternatives">Project goals, alternatives</a><br>
|
||||||
[<a href="https://github.com/chinanf-boy/bat-zh">中文</a>] [<a href="doc/README-ja.md">日本語</a>] [<a href="doc/README-ko.md">한국어</a>] [<a href="doc/README-ru.md">Русский</a>]
|
[English]
|
||||||
|
[<a href="doc/README-zh.md">中文</a>]
|
||||||
|
[<a href="doc/README-ja.md">日本語</a>]
|
||||||
|
[<a href="doc/README-ko.md">한국어</a>]
|
||||||
|
[<a href="doc/README-ru.md">Русский</a>]
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
### Sponsors
|
||||||
|
|
||||||
|
a special thank you goes to our biggest <a href="doc/sponsors.md">sponsors</a>:<br>
|
||||||
|
<a href="https://workos.com/?utm_campaign=github_repo&utm_medium=referral&utm_content=bat&utm_source=github">
|
||||||
|
<img src="doc/sponsors/workos-logo-white-bg.svg" width="200" alt="WorkOS">
|
||||||
|
<br>
|
||||||
|
<strong>Your app, enterprise-ready.</strong>
|
||||||
|
<br>
|
||||||
|
<sub>Start selling to enterprise customers with just a few lines of code.</sub>
|
||||||
|
<br>
|
||||||
|
<sup>Add Single Sign-On (and more) in minutes instead of months.</sup>
|
||||||
|
</a>
|
||||||
|
|
||||||
### Syntax highlighting
|
### Syntax highlighting
|
||||||
|
|
||||||
`bat` supports syntax highlighting for a large number of programming and markup
|
`bat` supports syntax highlighting for a large number of programming and markup
|
||||||
@@ -38,7 +55,7 @@ characters:
|
|||||||
|
|
||||||
### Automatic paging
|
### Automatic paging
|
||||||
|
|
||||||
By default, `bat` pipes its own output to a pager (e.g `less`) if the output is too large for one screen.
|
By default, `bat` pipes its own output to a pager (e.g. `less`) if the output is too large for one screen.
|
||||||
If you would rather `bat` work like `cat` all the time (never page output), you can set `--paging=never` as an option, either on the command line or in your configuration file.
|
If you would rather `bat` work like `cat` all the time (never page output), you can set `--paging=never` as an option, either on the command line or in your configuration file.
|
||||||
If you intend to alias `cat` to `bat` in your shell configuration, you can use `alias cat='bat --paging=never'` to preserve the default behavior.
|
If you intend to alias `cat` to `bat` in your shell configuration, you can use `alias cat='bat --paging=never'` to preserve the default behavior.
|
||||||
|
|
||||||
@@ -99,19 +116,23 @@ bat f - g # output 'f', then stdin, then 'g'.
|
|||||||
You can use `bat` as a previewer for [`fzf`](https://github.com/junegunn/fzf). To do this,
|
You can use `bat` as a previewer for [`fzf`](https://github.com/junegunn/fzf). To do this,
|
||||||
use `bat`s `--color=always` option to force colorized output. You can also use `--line-range`
|
use `bat`s `--color=always` option to force colorized output. You can also use `--line-range`
|
||||||
option to restrict the load times for long files:
|
option to restrict the load times for long files:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
fzf --preview 'bat --color=always --style=numbers --line-range=:500 {}'
|
fzf --preview 'bat --color=always --style=numbers --line-range=:500 {}'
|
||||||
```
|
```
|
||||||
For more information, see [`fzf`s `README`](https://github.com/junegunn/fzf#preview-window).
|
|
||||||
|
For more information, see [`fzf`'s `README`](https://github.com/junegunn/fzf#preview-window).
|
||||||
|
|
||||||
#### `find` or `fd`
|
#### `find` or `fd`
|
||||||
|
|
||||||
You can use the `-exec` option of `find` to preview all search results with `bat`:
|
You can use the `-exec` option of `find` to preview all search results with `bat`:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
find … -exec bat {} +
|
find … -exec bat {} +
|
||||||
```
|
```
|
||||||
|
|
||||||
If you happen to use [`fd`](https://github.com/sharkdp/fd), you can use the `-X`/`--exec-batch` option to do the same:
|
If you happen to use [`fd`](https://github.com/sharkdp/fd), you can use the `-X`/`--exec-batch` option to do the same:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
fd … -X bat
|
fd … -X bat
|
||||||
```
|
```
|
||||||
@@ -127,9 +148,11 @@ batgrep needle src/
|
|||||||
#### `tail -f`
|
#### `tail -f`
|
||||||
|
|
||||||
`bat` can be combined with `tail -f` to continuously monitor a given file with syntax highlighting.
|
`bat` can be combined with `tail -f` to continuously monitor a given file with syntax highlighting.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
tail -f /var/log/pacman.log | bat --paging=never -l log
|
tail -f /var/log/pacman.log | bat --paging=never -l log
|
||||||
```
|
```
|
||||||
|
|
||||||
Note that we have to switch off paging in order for this to work. We have also specified the syntax
|
Note that we have to switch off paging in order for this to work. We have also specified the syntax
|
||||||
explicitly (`-l log`), as it can not be auto-detected in this case.
|
explicitly (`-l log`), as it can not be auto-detected in this case.
|
||||||
|
|
||||||
@@ -137,6 +160,7 @@ explicitly (`-l log`), as it can not be auto-detected in this case.
|
|||||||
|
|
||||||
You can combine `bat` with `git show` to view an older version of a given file with proper syntax
|
You can combine `bat` with `git show` to view an older version of a given file with proper syntax
|
||||||
highlighting:
|
highlighting:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git show v0.6.0:src/main.rs | bat -l rs
|
git show v0.6.0:src/main.rs | bat -l rs
|
||||||
```
|
```
|
||||||
@@ -173,7 +197,7 @@ bat main.cpp | xclip
|
|||||||
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
|
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
|
||||||
man 2 select
|
man 2 select
|
||||||
```
|
```
|
||||||
(replace `bat` by `batcat` if you are on Debian or Ubuntu)
|
(replace `bat` with `batcat` if you are on Debian or Ubuntu)
|
||||||
|
|
||||||
It might also be necessary to set `MANROFFOPT="-c"` if you experience
|
It might also be necessary to set `MANROFFOPT="-c"` if you experience
|
||||||
formatting problems.
|
formatting problems.
|
||||||
@@ -196,15 +220,12 @@ The [`prettybat`](https://github.com/eth-p/bat-extras/blob/master/doc/prettybat.
|
|||||||
### On Ubuntu (using `apt`)
|
### On Ubuntu (using `apt`)
|
||||||
*... and other Debian-based Linux distributions.*
|
*... and other Debian-based Linux distributions.*
|
||||||
|
|
||||||
`bat` is making its way through the [Ubuntu](https://packages.ubuntu.com/eoan/bat) and
|
`bat` is available on [Ubuntu since 20.04 ("Focal")](https://packages.ubuntu.com/search?keywords=bat&exact=1) and [Debian since August 2021 (Debian 11 - "Bullseye")](https://packages.debian.org/bullseye/bat).
|
||||||
[Debian](https://packages.debian.org/sid/bat) package release process, and is available
|
|
||||||
for Ubuntu as of Eoan 19.10. On Debian `bat` is currently only available on the unstable
|
|
||||||
"Sid" branch.
|
|
||||||
|
|
||||||
If your Ubuntu/Debian installation is new enough you can simply run:
|
If your Ubuntu/Debian installation is new enough you can simply run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
apt install bat
|
sudo apt install bat
|
||||||
```
|
```
|
||||||
|
|
||||||
**Important**: If you install `bat` this way, please note that the executable may be installed as `batcat` instead of `bat` (due to [a name
|
**Important**: If you install `bat` this way, please note that the executable may be installed as `batcat` instead of `bat` (due to [a name
|
||||||
@@ -222,7 +243,7 @@ the most recent release of `bat`, download the latest `.deb` package from the
|
|||||||
[release page](https://github.com/sharkdp/bat/releases) and install it via:
|
[release page](https://github.com/sharkdp/bat/releases) and install it via:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo dpkg -i bat_0.18.0_amd64.deb # adapt version number and architecture
|
sudo dpkg -i bat_0.18.3_amd64.deb # adapt version number and architecture
|
||||||
```
|
```
|
||||||
|
|
||||||
### On Alpine Linux
|
### On Alpine Linux
|
||||||
@@ -251,6 +272,14 @@ You can install [the `bat` package](https://koji.fedoraproject.org/koji/packagei
|
|||||||
dnf install bat
|
dnf install bat
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### On Funtoo Linux
|
||||||
|
|
||||||
|
You can install [the `bat` package](https://github.com/funtoo/dev-kit/tree/1.4-release/sys-apps/bat) from dev-kit.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
emerge sys-apps/bat
|
||||||
|
```
|
||||||
|
|
||||||
### On Gentoo Linux
|
### On Gentoo Linux
|
||||||
|
|
||||||
You can install [the `bat` package](https://packages.gentoo.org/packages/sys-apps/bat)
|
You can install [the `bat` package](https://packages.gentoo.org/packages/sys-apps/bat)
|
||||||
@@ -289,6 +318,14 @@ cd /usr/ports/textproc/bat
|
|||||||
make install
|
make install
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### On OpenBSD
|
||||||
|
|
||||||
|
You can install `bat` package using [`pkg_add(1)`](https://man.openbsd.org/pkg_add.1):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pkg_add bat
|
||||||
|
```
|
||||||
|
|
||||||
### Via nix
|
### Via nix
|
||||||
|
|
||||||
You can install `bat` using the [nix package manager](https://nixos.org/nix):
|
You can install `bat` using the [nix package manager](https://nixos.org/nix):
|
||||||
@@ -363,7 +400,7 @@ binaries are also available: look for archives with `musl` in the file name.
|
|||||||
|
|
||||||
### From source
|
### From source
|
||||||
|
|
||||||
If you want to build `bat` from source, you need Rust 1.42 or
|
If you want to build `bat` from source, you need Rust 1.51 or
|
||||||
higher. You can then use `cargo` to build everything:
|
higher. You can then use `cargo` to build everything:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -409,10 +446,11 @@ even when truecolor support is available:
|
|||||||
It replaces certain bright colors with 8-bit colors from 16 to 21. **Do not** use this simply
|
It replaces certain bright colors with 8-bit colors from 16 to 21. **Do not** use this simply
|
||||||
because you have a 256-color terminal but are not using base16-shell.
|
because you have a 256-color terminal but are not using base16-shell.
|
||||||
|
|
||||||
Although these themes are more restricted, they have two advantages over truecolor themes:
|
Although these themes are more restricted, they have three advantages over truecolor themes. They:
|
||||||
|
|
||||||
- They harmonize better with other terminal software using 3-bit or 4-bit colors.
|
- Enjoy maximum compatibility. Some terminal utilities do not support more than 3-bit colors.
|
||||||
- When you change your terminal theme, `bat` output already on the screen will update to match.
|
- Adapt to terminal theme changes. Even for already printed output.
|
||||||
|
- Visually harmonize better with other terminal software.
|
||||||
|
|
||||||
### Output style
|
### Output style
|
||||||
|
|
||||||
@@ -490,8 +528,9 @@ command line option. The option takes an argument of the form `pattern:syntax` w
|
|||||||
the absolute file path. The `syntax` part is the full name of a supported language
|
the absolute file path. The `syntax` part is the full name of a supported language
|
||||||
(use `bat --list-languages` for an overview).
|
(use `bat --list-languages` for an overview).
|
||||||
|
|
||||||
Note: You probably want to use this option as an entry in `bat`s configuration file instead
|
**Note:** You probably want to use this option as [an entry in `bat`'s configuration file](#configuration-file)
|
||||||
of passing it on the command line (see below).
|
for persistence instead of passing it on the command line as a one-off. Generally
|
||||||
|
you'd just use `-l` if you want to manually specify a language for a file.
|
||||||
|
|
||||||
Example: To use "INI" syntax highlighting for all files with a `.conf` file extension, use
|
Example: To use "INI" syntax highlighting for all files with a `.conf` file extension, use
|
||||||
```bash
|
```bash
|
||||||
@@ -516,6 +555,8 @@ set, `less` is used by default. If you want to use a different pager, you can ei
|
|||||||
`PAGER` variable or set the `BAT_PAGER` environment variable to override what is specified in
|
`PAGER` variable or set the `BAT_PAGER` environment variable to override what is specified in
|
||||||
`PAGER`.
|
`PAGER`.
|
||||||
|
|
||||||
|
**Note**: If `PAGER` is `more` or `most`, `bat` will silently use `less` instead to ensure support for colors.
|
||||||
|
|
||||||
If you want to pass command-line arguments to the pager, you can also set them via the
|
If you want to pass command-line arguments to the pager, you can also set them via the
|
||||||
`PAGER`/`BAT_PAGER` variables:
|
`PAGER`/`BAT_PAGER` variables:
|
||||||
|
|
||||||
@@ -565,7 +606,7 @@ alias cat="bat --theme=\$(defaults read -globalDomain AppleInterfaceStyle &> /de
|
|||||||
|
|
||||||
`bat` can also be customized with a configuration file. The location of the file is dependent
|
`bat` can also be customized with a configuration file. The location of the file is dependent
|
||||||
on your operating system. To get the default path for your system, call
|
on your operating system. To get the default path for your system, call
|
||||||
```
|
```bash
|
||||||
bat --config-file
|
bat --config-file
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -595,7 +636,7 @@ Example configuration file:
|
|||||||
# Use italic text on the terminal (not supported on all terminals)
|
# Use italic text on the terminal (not supported on all terminals)
|
||||||
--italic-text=always
|
--italic-text=always
|
||||||
|
|
||||||
# Use C++ syntax for .ino files
|
# Use C++ syntax for Arduino .ino files
|
||||||
--map-syntax "*.ino:C++"
|
--map-syntax "*.ino:C++"
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -647,6 +688,13 @@ bat() {
|
|||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|
||||||
|
### Garbled output
|
||||||
|
|
||||||
|
If an input file contains color codes or other ANSI escape sequences or control characters, `bat` will have problems
|
||||||
|
performing syntax highlighting and text wrapping, and thus the output can become garbled.
|
||||||
|
When displaying such files it is recommended to disable both syntax highlighting and wrapping by
|
||||||
|
passing the `--color=never --wrap=never` options to `bat`.
|
||||||
|
|
||||||
### Terminals & colors
|
### Terminals & colors
|
||||||
|
|
||||||
`bat` handles terminals *with* and *without* truecolor support. However, the colors in most syntax
|
`bat` handles terminals *with* and *without* truecolor support. However, the colors in most syntax
|
||||||
@@ -714,6 +762,10 @@ Take a look at the [`CONTRIBUTING.md`](CONTRIBUTING.md) guide.
|
|||||||
- [keith-hall](https://github.com/keith-hall)
|
- [keith-hall](https://github.com/keith-hall)
|
||||||
- [Enselic](https://github.com/Enselic)
|
- [Enselic](https://github.com/Enselic)
|
||||||
|
|
||||||
|
## Security vulnerabilities
|
||||||
|
|
||||||
|
Please contact [David Peter](https://david-peter.de/) via email if you want to report a vulnerability in `bat`.
|
||||||
|
|
||||||
## Project goals and alternatives
|
## Project goals and alternatives
|
||||||
|
|
||||||
`bat` tries to achieve the following goals:
|
`bat` tries to achieve the following goals:
|
||||||
@@ -727,7 +779,7 @@ There are a lot of alternatives, if you are looking for similar programs. See
|
|||||||
[this document](doc/alternatives.md) for a comparison.
|
[this document](doc/alternatives.md) for a comparison.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
Copyright (c) 2018-2020 [bat-developers](https://github.com/sharkdp/bat).
|
Copyright (c) 2018-2021 [bat-developers](https://github.com/sharkdp/bat).
|
||||||
|
|
||||||
`bat` is made available under the terms of either the MIT License or the Apache License 2.0, at your option.
|
`bat` is made available under the terms of either the MIT License or the Apache License 2.0, at your option.
|
||||||
|
|
||||||
|
BIN
assets/acknowledgements.bin
vendored
Normal file
BIN
assets/acknowledgements.bin
vendored
Normal file
Binary file not shown.
92
assets/completions/_bat.ps1.in
vendored
Normal file
92
assets/completions/_bat.ps1.in
vendored
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
|
||||||
|
using namespace System.Management.Automation
|
||||||
|
using namespace System.Management.Automation.Language
|
||||||
|
|
||||||
|
Register-ArgumentCompleter -Native -CommandName '{{PROJECT_EXECUTABLE}}' -ScriptBlock {
|
||||||
|
param($wordToComplete, $commandAst, $cursorPosition)
|
||||||
|
|
||||||
|
$commandElements = $commandAst.CommandElements
|
||||||
|
$command = @(
|
||||||
|
'{{PROJECT_EXECUTABLE}}'
|
||||||
|
for ($i = 1; $i -lt $commandElements.Count; $i++) {
|
||||||
|
$element = $commandElements[$i]
|
||||||
|
if ($element -isnot [StringConstantExpressionAst] -or
|
||||||
|
$element.StringConstantType -ne [StringConstantType]::BareWord -or
|
||||||
|
$element.Value.StartsWith('-')) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
$element.Value
|
||||||
|
}) -join ';'
|
||||||
|
|
||||||
|
$completions = @(switch ($command) {
|
||||||
|
'{{PROJECT_EXECUTABLE}}' {
|
||||||
|
[CompletionResult]::new('-l', 'l', [CompletionResultType]::ParameterName, 'Set the language for syntax highlighting.')
|
||||||
|
[CompletionResult]::new('--language', 'language', [CompletionResultType]::ParameterName, 'Set the language for syntax highlighting.')
|
||||||
|
[CompletionResult]::new('-H', 'H', [CompletionResultType]::ParameterName, 'Highlight lines N through M.')
|
||||||
|
[CompletionResult]::new('--highlight-line', 'highlight-line', [CompletionResultType]::ParameterName, 'Highlight lines N through M.')
|
||||||
|
[CompletionResult]::new('--file-name', 'file-name', [CompletionResultType]::ParameterName, 'Specify the name to display for a file.')
|
||||||
|
[CompletionResult]::new('--diff-context', 'diff-context', [CompletionResultType]::ParameterName, 'diff-context')
|
||||||
|
[CompletionResult]::new('--tabs', 'tabs', [CompletionResultType]::ParameterName, 'Set the tab width to T spaces.')
|
||||||
|
[CompletionResult]::new('--wrap', 'wrap', [CompletionResultType]::ParameterName, 'Specify the text-wrapping mode (*auto*, never, character).')
|
||||||
|
[CompletionResult]::new('--terminal-width', 'terminal-width', [CompletionResultType]::ParameterName, 'Explicitly set the width of the terminal instead of determining it automatically. If prefixed with ''+'' or ''-'', the value will be treated as an offset to the actual terminal width. See also: ''--wrap''.')
|
||||||
|
[CompletionResult]::new('--color', 'color', [CompletionResultType]::ParameterName, 'When to use colors (*auto*, never, always).')
|
||||||
|
[CompletionResult]::new('--italic-text', 'italic-text', [CompletionResultType]::ParameterName, 'Use italics in output (always, *never*)')
|
||||||
|
[CompletionResult]::new('--decorations', 'decorations', [CompletionResultType]::ParameterName, 'When to show the decorations (*auto*, never, always).')
|
||||||
|
[CompletionResult]::new('--paging', 'paging', [CompletionResultType]::ParameterName, 'Specify when to use the pager, or use `-P` to disable (*auto*, never, always).')
|
||||||
|
[CompletionResult]::new('--pager', 'pager', [CompletionResultType]::ParameterName, 'Determine which pager to use.')
|
||||||
|
[CompletionResult]::new('-m', 'm', [CompletionResultType]::ParameterName, 'Use the specified syntax for files matching the glob pattern (''*.cpp:C++'').')
|
||||||
|
[CompletionResult]::new('--map-syntax', 'map-syntax', [CompletionResultType]::ParameterName, 'Use the specified syntax for files matching the glob pattern (''*.cpp:C++'').')
|
||||||
|
[CompletionResult]::new('--theme', 'theme', [CompletionResultType]::ParameterName, 'Set the color theme for syntax highlighting.')
|
||||||
|
[CompletionResult]::new('--style', 'style', [CompletionResultType]::ParameterName, 'Comma-separated list of style elements to display (*auto*, full, plain, changes, header, grid, rule, numbers, snip).')
|
||||||
|
[CompletionResult]::new('-r', 'r', [CompletionResultType]::ParameterName, 'Only print the lines from N to M.')
|
||||||
|
[CompletionResult]::new('--line-range', 'line-range', [CompletionResultType]::ParameterName, 'Only print the lines from N to M.')
|
||||||
|
[CompletionResult]::new('-A', 'A', [CompletionResultType]::ParameterName, 'Show non-printable characters (space, tab, newline, ..).')
|
||||||
|
[CompletionResult]::new('--show-all', 'show-all', [CompletionResultType]::ParameterName, 'Show non-printable characters (space, tab, newline, ..).')
|
||||||
|
[CompletionResult]::new('-p', 'p', [CompletionResultType]::ParameterName, 'Show plain style (alias for ''--style=plain'').')
|
||||||
|
[CompletionResult]::new('--plain', 'plain', [CompletionResultType]::ParameterName, 'Show plain style (alias for ''--style=plain'').')
|
||||||
|
[CompletionResult]::new('-d', 'd', [CompletionResultType]::ParameterName, 'Only show lines that have been added/removed/modified.')
|
||||||
|
[CompletionResult]::new('--diff', 'diff', [CompletionResultType]::ParameterName, 'Only show lines that have been added/removed/modified.')
|
||||||
|
[CompletionResult]::new('-n', 'n', [CompletionResultType]::ParameterName, 'Show line numbers (alias for ''--style=numbers'').')
|
||||||
|
[CompletionResult]::new('--number', 'number', [CompletionResultType]::ParameterName, 'Show line numbers (alias for ''--style=numbers'').')
|
||||||
|
[CompletionResult]::new('-f', 'f', [CompletionResultType]::ParameterName, 'f')
|
||||||
|
[CompletionResult]::new('--force-colorization', 'force-colorization', [CompletionResultType]::ParameterName, 'force-colorization')
|
||||||
|
[CompletionResult]::new('-P', 'P', [CompletionResultType]::ParameterName, 'Alias for ''--paging=never''')
|
||||||
|
[CompletionResult]::new('--no-paging', 'no-paging', [CompletionResultType]::ParameterName, 'Alias for ''--paging=never''')
|
||||||
|
[CompletionResult]::new('--list-themes', 'list-themes', [CompletionResultType]::ParameterName, 'Display all supported highlighting themes.')
|
||||||
|
[CompletionResult]::new('-L', 'L', [CompletionResultType]::ParameterName, 'Display all supported languages.')
|
||||||
|
[CompletionResult]::new('--list-languages', 'list-languages', [CompletionResultType]::ParameterName, 'Display all supported languages.')
|
||||||
|
[CompletionResult]::new('-u', 'u', [CompletionResultType]::ParameterName, 'u')
|
||||||
|
[CompletionResult]::new('--unbuffered', 'unbuffered', [CompletionResultType]::ParameterName, 'unbuffered')
|
||||||
|
[CompletionResult]::new('--no-config', 'no-config', [CompletionResultType]::ParameterName, 'Do not use the configuration file')
|
||||||
|
[CompletionResult]::new('--no-custom-assets', 'no-custom-assets', [CompletionResultType]::ParameterName, 'Do not load custom assets')
|
||||||
|
[CompletionResult]::new('--config-file', 'config-file', [CompletionResultType]::ParameterName, 'Show path to the configuration file.')
|
||||||
|
[CompletionResult]::new('--generate-config-file', 'generate-config-file', [CompletionResultType]::ParameterName, 'Generates a default configuration file.')
|
||||||
|
[CompletionResult]::new('--config-dir', 'config-dir', [CompletionResultType]::ParameterName, 'Show bat''s configuration directory.')
|
||||||
|
[CompletionResult]::new('--cache-dir', 'cache-dir', [CompletionResultType]::ParameterName, 'Show bat''s cache directory.')
|
||||||
|
[CompletionResult]::new('--diagnostic', 'diagnostic', [CompletionResultType]::ParameterName, 'Show diagnostic information for bug reports.')
|
||||||
|
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print this help message.')
|
||||||
|
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print this help message.')
|
||||||
|
[CompletionResult]::new('-V', 'V', [CompletionResultType]::ParameterName, 'Show version information.')
|
||||||
|
[CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Show version information.')
|
||||||
|
[CompletionResult]::new('cache', 'cache', [CompletionResultType]::ParameterValue, 'Modify the syntax-definition and theme cache')
|
||||||
|
break
|
||||||
|
}
|
||||||
|
'{{PROJECT_EXECUTABLE}};cache' {
|
||||||
|
[CompletionResult]::new('--source', 'source', [CompletionResultType]::ParameterName, 'Use a different directory to load syntaxes and themes from.')
|
||||||
|
[CompletionResult]::new('--target', 'target', [CompletionResultType]::ParameterName, 'Use a different directory to store the cached syntax and theme set.')
|
||||||
|
[CompletionResult]::new('-b', 'b', [CompletionResultType]::ParameterName, 'Initialize (or update) the syntax/theme cache.')
|
||||||
|
[CompletionResult]::new('--build', 'build', [CompletionResultType]::ParameterName, 'Initialize (or update) the syntax/theme cache.')
|
||||||
|
[CompletionResult]::new('-c', 'c', [CompletionResultType]::ParameterName, 'Remove the cached syntax definitions and themes.')
|
||||||
|
[CompletionResult]::new('--clear', 'clear', [CompletionResultType]::ParameterName, 'Remove the cached syntax definitions and themes.')
|
||||||
|
[CompletionResult]::new('--blank', 'blank', [CompletionResultType]::ParameterName, 'Create completely new syntax and theme sets (instead of appending to the default sets).')
|
||||||
|
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Prints help information')
|
||||||
|
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Prints help information')
|
||||||
|
[CompletionResult]::new('-V', 'V', [CompletionResultType]::ParameterName, 'Prints version information')
|
||||||
|
[CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Prints version information')
|
||||||
|
break
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
$completions.Where{ $_.CompletionText -like "$wordToComplete*" } |
|
||||||
|
Sort-Object -Property ListItemText
|
||||||
|
}
|
88
assets/completions/bat.bash.in
vendored
Normal file
88
assets/completions/bat.bash.in
vendored
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
# shellcheck disable=SC2207
|
||||||
|
|
||||||
|
# Requires https://github.com/scop/bash-completion
|
||||||
|
|
||||||
|
_bat() {
|
||||||
|
local cur prev words cword split
|
||||||
|
_init_completion -s || return 0
|
||||||
|
|
||||||
|
if [[ ${words[1]-} == cache ]]; then
|
||||||
|
case $prev in
|
||||||
|
--source | --target)
|
||||||
|
_filedir -d
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
COMPREPLY=($(compgen -W "
|
||||||
|
--build --clear --source --target --blank --help
|
||||||
|
" -- "$cur"))
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
case $prev in
|
||||||
|
-l | --language)
|
||||||
|
local IFS=$'\n'
|
||||||
|
COMPREPLY=($(compgen -W "$(
|
||||||
|
"$1" --list-languages | while IFS=: read -r lang _; do
|
||||||
|
printf "%s\n" "$lang"
|
||||||
|
done
|
||||||
|
)" -- "$cur"))
|
||||||
|
compopt -o filenames # for escaping
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
-H | --highlight-line | --diff-context | --tabs | --terminal-width | \
|
||||||
|
-m | --map-syntax | --style | --line-range | -h | --help | -V | \
|
||||||
|
--version | --diagnostic | --config-file | --config-dir | \
|
||||||
|
--cache-dir | --generate-config-file)
|
||||||
|
# argument required but no completion available, or option
|
||||||
|
# causes an exit
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
--file-name)
|
||||||
|
_filedir
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
--wrap)
|
||||||
|
COMPREPLY=($(compgen -W "auto never character" -- "$cur"))
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
--color | --decorations | --paging)
|
||||||
|
COMPREPLY=($(compgen -W "auto never always" -- "$cur"))
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
--italic-text)
|
||||||
|
COMPREPLY=($(compgen -W "always never" -- "$cur"))
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
--pager)
|
||||||
|
COMPREPLY=($(compgen -c -- "$cur"))
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
--theme)
|
||||||
|
local IFS=$'\n'
|
||||||
|
COMPREPLY=($(compgen -W "$("$1" --list-themes)" -- "$cur"))
|
||||||
|
compopt -o filenames # for escaping
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
$split && return 0
|
||||||
|
|
||||||
|
if [[ $cur == -* ]]; then
|
||||||
|
COMPREPLY=($(compgen -W "
|
||||||
|
--show-all --plain --language --highlight-line
|
||||||
|
--file-name --diff --diff-context --tabs --wrap
|
||||||
|
--terminal-width --number --color --italic-text
|
||||||
|
--decorations --paging --pager --map-syntax --theme
|
||||||
|
--list-themes --style --line-range --list-languages
|
||||||
|
--help --version --force-colorization --unbuffered
|
||||||
|
--diagnostic --config-file --config-dir --cache-dir
|
||||||
|
--generate-config-file
|
||||||
|
" -- "$cur"))
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
_filedir
|
||||||
|
((cword == 1)) && COMPREPLY+=($(compgen -W cache -- "$cur"))
|
||||||
|
|
||||||
|
} && complete -F _bat {{PROJECT_EXECUTABLE}}
|
2
assets/completions/bat.fish.in
vendored
2
assets/completions/bat.fish.in
vendored
@@ -56,7 +56,7 @@ complete -c {{PROJECT_EXECUTABLE}} -s P -d "Disable paging. Alias for '--paging=
|
|||||||
|
|
||||||
complete -c {{PROJECT_EXECUTABLE}} -s A -l show-all -d "Show non-printable characters like space/tab/newline" -n "not __fish_seen_subcommand_from cache"
|
complete -c {{PROJECT_EXECUTABLE}} -s A -l show-all -d "Show non-printable characters like space/tab/newline" -n "not __fish_seen_subcommand_from cache"
|
||||||
|
|
||||||
complete -c {{PROJECT_EXECUTABLE}} -l style -xka "auto full plain changes header grid numbers" -d "Comma-separated list of style elements or presets to display with file contents" -n "not __fish_seen_subcommand_from cache"
|
complete -c {{PROJECT_EXECUTABLE}} -l style -xka "auto full plain changes header grid rule numbers snip" -d "Comma-separated list of style elements or presets to display with file contents" -n "not __fish_seen_subcommand_from cache"
|
||||||
|
|
||||||
complete -c {{PROJECT_EXECUTABLE}} -l tabs -x -d "<T> Set the tab width to T spaces (width of 0 passes tabs through directly)" -n "not __fish_seen_subcommand_from cache"
|
complete -c {{PROJECT_EXECUTABLE}} -l tabs -x -d "<T> Set the tab width to T spaces (width of 0 passes tabs through directly)" -n "not __fish_seen_subcommand_from cache"
|
||||||
|
|
||||||
|
8
assets/completions/bat.zsh.in
vendored
8
assets/completions/bat.zsh.in
vendored
@@ -44,6 +44,12 @@ _{{PROJECT_EXECUTABLE}}_main() {
|
|||||||
'(--style)'--style='[Comma-separated list of style elements to display]:<components>:->style'
|
'(--style)'--style='[Comma-separated list of style elements to display]:<components>:->style'
|
||||||
'(-r --line-range)'{-r+,--line-range=}'[Only print the lines from N to M]:<N\:M>...'
|
'(-r --line-range)'{-r+,--line-range=}'[Only print the lines from N to M]:<N\:M>...'
|
||||||
'(: --list-themes --list-languages -L)'{-L,--list-languages}'[Display all supported languages]'
|
'(: --list-themes --list-languages -L)'{-L,--list-languages}'[Display all supported languages]'
|
||||||
|
'(: --no-config)'--no-config'[Do not use the configuration file]'
|
||||||
|
'(: --no-custom-assets)'--no-custom-assets'[Do not load custom assets]'
|
||||||
|
'(: --config-dir)'--config-dir'[Show bat'"'"'s configuration directory]'
|
||||||
|
'(: --config-file)'--config-file'[Show path to the configuration file]'
|
||||||
|
'(: --generate-config-file)'--generate-config-file'[Generates a default configuration file]'
|
||||||
|
'(: --cache-dir)'--cache-dir'[Show bat'"'"'s cache directory]'
|
||||||
'(: -)'{-h,--help}'[Print this help message]'
|
'(: -)'{-h,--help}'[Print this help message]'
|
||||||
'(: -)'{-V,--version}'[Show version information]'
|
'(: -)'{-V,--version}'[Show version information]'
|
||||||
'*: :_files'
|
'*: :_files'
|
||||||
@@ -69,7 +75,7 @@ _{{PROJECT_EXECUTABLE}}_main() {
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
style)
|
style)
|
||||||
_values -s , 'style' auto full plain changes header grid numbers snip
|
_values -s , 'style' auto full plain changes header grid rule numbers snip
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
12
assets/create.sh
vendored
12
assets/create.sh
vendored
@@ -5,7 +5,7 @@ ASSET_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|||||||
REPO_DIR="$ASSET_DIR/.."
|
REPO_DIR="$ASSET_DIR/.."
|
||||||
|
|
||||||
# Ensure submodules are initialized.
|
# Ensure submodules are initialized.
|
||||||
function update_submodules() {
|
update_submodules() {
|
||||||
local submodule
|
local submodule
|
||||||
local submodule_prompt=unspecified
|
local submodule_prompt=unspecified
|
||||||
local submodule_path
|
local submodule_path
|
||||||
@@ -46,6 +46,7 @@ bat cache --clear
|
|||||||
# - Remove the JavaDoc patch once https://github.com/trishume/syntect/issues/222 has been fixed
|
# - Remove the JavaDoc patch once https://github.com/trishume/syntect/issues/222 has been fixed
|
||||||
# - Remove the C# patch once https://github.com/sublimehq/Packages/pull/2331 has been merged
|
# - Remove the C# patch once https://github.com/sublimehq/Packages/pull/2331 has been merged
|
||||||
|
|
||||||
|
# Apply patches
|
||||||
(
|
(
|
||||||
cd "$ASSET_DIR"
|
cd "$ASSET_DIR"
|
||||||
for patch in patches/*.patch; do
|
for patch in patches/*.patch; do
|
||||||
@@ -53,11 +54,16 @@ bat cache --clear
|
|||||||
done
|
done
|
||||||
)
|
)
|
||||||
|
|
||||||
bat cache --build --blank --source="$ASSET_DIR" --target="$ASSET_DIR"
|
reverse_patches() {
|
||||||
|
|
||||||
(
|
(
|
||||||
cd "$ASSET_DIR"
|
cd "$ASSET_DIR"
|
||||||
for patch in patches/*.patch; do
|
for patch in patches/*.patch; do
|
||||||
patch --strip=0 --reverse <"$patch"
|
patch --strip=0 --reverse <"$patch"
|
||||||
done
|
done
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
# Make sure to always reverse patches, even if the `bat cache` command fails or aborts
|
||||||
|
trap reverse_patches EXIT
|
||||||
|
|
||||||
|
bat cache --build --blank --acknowledgements --source="$ASSET_DIR" --target="$ASSET_DIR"
|
||||||
|
12
assets/manual/bat.1.in
vendored
12
assets/manual/bat.1.in
vendored
@@ -50,6 +50,8 @@ highlights lines 30 to 40
|
|||||||
highlights lines 1 to 40
|
highlights lines 1 to 40
|
||||||
.IP "\-\-highlight\-line 40:"
|
.IP "\-\-highlight\-line 40:"
|
||||||
highlights lines 40 to the end of the file
|
highlights lines 40 to the end of the file
|
||||||
|
.IP "\-\-highlight\-line 30:+10"
|
||||||
|
highlights lines 30 to 40
|
||||||
.RE
|
.RE
|
||||||
.HP
|
.HP
|
||||||
\fB\-\-file\-name\fR <name>...
|
\fB\-\-file\-name\fR <name>...
|
||||||
@@ -116,6 +118,8 @@ which pager is used, see the '\-\-pager' option. Possible values: *auto*, never,
|
|||||||
Determine which pager is used. This option will override the PAGER and BAT_PAGER
|
Determine which pager is used. This option will override the PAGER and BAT_PAGER
|
||||||
environment variables. The default pager is 'less'. To control when the pager is used, see
|
environment variables. The default pager is 'less'. To control when the pager is used, see
|
||||||
the '\-\-paging' option. Example: '\-\-pager "less \fB\-RF\fR"'.
|
the '\-\-paging' option. Example: '\-\-pager "less \fB\-RF\fR"'.
|
||||||
|
|
||||||
|
Note: By default, if the pager is set to 'less' (and no command-line options are specified), 'bat' will pass the following command line options to the pager: '-R'/'--RAW-CONTROL-CHARS', '-F'/'--quit-if-one-screen' and '-X'/'--no-init'. The last option ('-X') is only used for 'less' versions older than 530. The '-R' option is needed to interpret ANSI colors correctly. The second option ('-F') instructs less to exit immediately if the output size is smaller than the vertical size of the terminal. This is convenient for small files because you do not have to press 'q' to quit the pager. The third option ('-X') is needed to fix a bug with the '--quit-if-one-screen' feature in old versions of 'less'. Unfortunately, it also breaks mouse-wheel support in 'less'. If you want to enable mouse-wheel scrolling on older versions of 'less', you can pass just '-R' (as in the example above, this will disable the quit-if-one-screen feature). For less 530 or newer, it should work out of the box.
|
||||||
.HP
|
.HP
|
||||||
\fB\-m\fR, \fB\-\-map\-syntax\fR <glob-pattern:syntax-name>...
|
\fB\-m\fR, \fB\-\-map\-syntax\fR <glob-pattern:syntax-name>...
|
||||||
.IP
|
.IP
|
||||||
@@ -142,7 +146,7 @@ Configure which elements (line numbers, file headers, grid borders, Git modifica
|
|||||||
of components to display (e.g. 'numbers,changes,grid') or a pre\-defined style ('full').
|
of components to display (e.g. 'numbers,changes,grid') or a pre\-defined style ('full').
|
||||||
To set a default style, add the '\-\-style=".."' option to the configuration file or
|
To set a default style, add the '\-\-style=".."' option to the configuration file or
|
||||||
export the BAT_STYLE environment variable (e.g.: export BAT_STYLE=".."). Possible
|
export the BAT_STYLE environment variable (e.g.: export BAT_STYLE=".."). Possible
|
||||||
values: *auto*, full, plain, changes, header, grid, rule, numbers, snip.
|
values: *full*, auto, plain, changes, header, grid, rule, numbers, snip.
|
||||||
.HP
|
.HP
|
||||||
\fB\-r\fR, \fB\-\-line\-range\fR <N:M>...
|
\fB\-r\fR, \fB\-\-line\-range\fR <N:M>...
|
||||||
.IP
|
.IP
|
||||||
@@ -154,6 +158,8 @@ prints lines 30 to 40
|
|||||||
prints lines 1 to 40
|
prints lines 1 to 40
|
||||||
.IP "\-\-line\-range 40:"
|
.IP "\-\-line\-range 40:"
|
||||||
prints lines 40 to the end of the file
|
prints lines 40 to the end of the file
|
||||||
|
.IP "\-\-line\-range 30:+10"
|
||||||
|
prints lines 30 to 40
|
||||||
.RE
|
.RE
|
||||||
.HP
|
.HP
|
||||||
\fB\-L\fR, \fB\-\-list\-languages\fR
|
\fB\-L\fR, \fB\-\-list\-languages\fR
|
||||||
@@ -189,6 +195,10 @@ is dependent on your operating system. To get the default path for your system,
|
|||||||
|
|
||||||
Alternatively, you can use the BAT_CONFIG_PATH environment variable to point {{PROJECT_EXECUTABLE}} to a non-default
|
Alternatively, you can use the BAT_CONFIG_PATH environment variable to point {{PROJECT_EXECUTABLE}} to a non-default
|
||||||
location of the configuration file.
|
location of the configuration file.
|
||||||
|
|
||||||
|
To generate a default configuration file, call:
|
||||||
|
|
||||||
|
\fB{{PROJECT_EXECUTABLE}} --generate-config-file\fR
|
||||||
.SH "ADDING CUSTOM LANGUAGES"
|
.SH "ADDING CUSTOM LANGUAGES"
|
||||||
{{PROJECT_EXECUTABLE}} supports Sublime Text \fB.sublime-syntax\fR language files, and can be
|
{{PROJECT_EXECUTABLE}} supports Sublime Text \fB.sublime-syntax\fR language files, and can be
|
||||||
customized to add additional languages to your local installation. To do this, add the \fB.sublime-syntax\fR language
|
customized to add additional languages to your local installation. To do this, add the \fB.sublime-syntax\fR language
|
||||||
|
16
assets/patches/Groff.sublime-syntax.patch
vendored
Normal file
16
assets/patches/Groff.sublime-syntax.patch
vendored
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
diff --git syntaxes/02_Extra/Groff/Man Page/Man Page.sublime-syntax syntaxes/02_Extra/Groff/Man Page/Man Page.sublime-syntax
|
||||||
|
index 57834af..6648664 100644
|
||||||
|
--- syntaxes/02_Extra/Groff/Man Page/Man Page.sublime-syntax
|
||||||
|
+++ syntaxes/02_Extra/Groff/Man Page/Man Page.sublime-syntax
|
||||||
|
@@ -4,9 +4,9 @@
|
||||||
|
# - man-pages(7)
|
||||||
|
# - groff(7)
|
||||||
|
---
|
||||||
|
-name: Man Page (groff/troff)
|
||||||
|
+name: Groff/troff
|
||||||
|
scope: text.groff
|
||||||
|
-file_extensions: [man, groff, troff, '1', '2', '3', '4', '5', '6', '7']
|
||||||
|
+file_extensions: [groff, troff, '1', '2', '3', '4', '5', '6', '7', '8', '9']
|
||||||
|
|
||||||
|
contexts:
|
||||||
|
main:
|
11
assets/patches/Markdown.sublime-syntax.patch
vendored
11
assets/patches/Markdown.sublime-syntax.patch
vendored
@@ -1,5 +1,5 @@
|
|||||||
diff --git syntaxes/01_Packages/Markdown/Markdown.sublime-syntax syntaxes/01_Packages/Markdown/Markdown.sublime-syntax
|
diff --git syntaxes/01_Packages/Markdown/Markdown.sublime-syntax syntaxes/01_Packages/Markdown/Markdown.sublime-syntax
|
||||||
index 19dc685d..6afd87ae 100644
|
index 19dc685d..44440c7f 100644
|
||||||
--- syntaxes/01_Packages/Markdown/Markdown.sublime-syntax
|
--- syntaxes/01_Packages/Markdown/Markdown.sublime-syntax
|
||||||
+++ syntaxes/01_Packages/Markdown/Markdown.sublime-syntax
|
+++ syntaxes/01_Packages/Markdown/Markdown.sublime-syntax
|
||||||
@@ -24,7 +24,6 @@ variables:
|
@@ -24,7 +24,6 @@ variables:
|
||||||
@@ -166,3 +166,12 @@ index 19dc685d..6afd87ae 100644
|
|||||||
- match: ^\s*$\n?
|
- match: ^\s*$\n?
|
||||||
scope: invalid.illegal.non-terminated.bold-italic.markdown
|
scope: invalid.illegal.non-terminated.bold-italic.markdown
|
||||||
pop: true
|
pop: true
|
||||||
|
@@ -1152,7 +1110,7 @@ contexts:
|
||||||
|
- match: |-
|
||||||
|
(?x)
|
||||||
|
{{fenced_code_block_start}}
|
||||||
|
- ((?i:rust))
|
||||||
|
+ ((?i:rust|rs))
|
||||||
|
{{fenced_code_block_trailing_infostring_characters}}
|
||||||
|
captures:
|
||||||
|
0: meta.code-fence.definition.begin.rust.markdown-gfm
|
||||||
|
13
assets/patches/MediaWiki.sublime-syntax.patch
vendored
Normal file
13
assets/patches/MediaWiki.sublime-syntax.patch
vendored
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
diff --git syntaxes/02_Extra/MediaWiki/MediawikiNG.sublime-syntax syntaxes/02_Extra/MediaWiki/MediawikiNG.sublime-syntax
|
||||||
|
index f542c9e..8eaf020 100644
|
||||||
|
--- syntaxes/02_Extra/MediaWiki/MediawikiNG.sublime-syntax
|
||||||
|
+++ syntaxes/02_Extra/MediaWiki/MediawikiNG.sublime-syntax
|
||||||
|
@@ -1,7 +1,7 @@
|
||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
# http://www.sublimetext.com/docs/3/syntax.html
|
||||||
|
-name: Mediawiki NG
|
||||||
|
+name: MediaWiki
|
||||||
|
file_extensions: [mediawiki, wikipedia, wiki]
|
||||||
|
scope: text.html.mediawiki
|
||||||
|
|
20
assets/patches/Monokai-Extended.tmTheme.patch
vendored
20
assets/patches/Monokai-Extended.tmTheme.patch
vendored
@@ -7,7 +7,7 @@ index 9c2aa3e..180cbbf 100644
|
|||||||
<string>JSON String</string>
|
<string>JSON String</string>
|
||||||
<key>scope</key>
|
<key>scope</key>
|
||||||
- <string>meta.structure.dictionary.json string.quoted.double.json</string>
|
- <string>meta.structure.dictionary.json string.quoted.double.json</string>
|
||||||
+ <string>meta.mapping.key.json string.quoted.double.json</string>
|
+ <string>meta.mapping.key.json string.quoted.double.json, punctuation.separator.sequence.csv</string>
|
||||||
<key>settings</key>
|
<key>settings</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
@@ -16,3 +16,21 @@ index 9c2aa3e..180cbbf 100644
|
|||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
|
@@ -1027,7 +1027,7 @@
|
||||||
|
<key>name</key>
|
||||||
|
<string>Invalid</string>
|
||||||
|
<key>scope</key>
|
||||||
|
- <string>invalid</string>
|
||||||
|
+ <string>invalid, markup.error</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>background</key>
|
||||||
|
@@ -1042,7 +1042,7 @@
|
||||||
|
<key>name</key>
|
||||||
|
<string>Invalid deprecated</string>
|
||||||
|
<key>scope</key>
|
||||||
|
- <string>invalid.deprecated</string>
|
||||||
|
+ <string>invalid.deprecated, markup.warning</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>background</key>
|
||||||
|
15
assets/patches/Python.sublime-syntax.patch
vendored
Normal file
15
assets/patches/Python.sublime-syntax.patch
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
diff --git syntaxes/01_Packages/Python/Python.sublime-syntax syntaxes/01_Packages/Python/Python.sublime-syntax
|
||||||
|
index 2acd86d8..86257f7b 100644
|
||||||
|
--- syntaxes/01_Packages/Python/Python.sublime-syntax
|
||||||
|
+++ syntaxes/01_Packages/Python/Python.sublime-syntax
|
||||||
|
@@ -988,10 +988,6 @@ contexts:
|
||||||
|
- match: \}
|
||||||
|
scope: punctuation.section.mapping-or-set.end.python
|
||||||
|
set: after-expression
|
||||||
|
- - match: (?={{simple_expression}}:|\s*\*\*)
|
||||||
|
- set: inside-dictionary
|
||||||
|
- - match: (?={{simple_expression}}[,}]|\s*\*)
|
||||||
|
- set: inside-set
|
||||||
|
- match: ','
|
||||||
|
scope: punctuation.separator.set.python
|
||||||
|
set: inside-set
|
@@ -1,8 +1,8 @@
|
|||||||
diff --git syntaxes/01_Packages/ShellScript/Bash.sublime-syntax syntaxes/01_Packages/ShellScript/Bash.sublime-syntax
|
diff --git syntaxes/01_Packages/ShellScript/Bash.sublime-syntax syntaxes/01_Packages/ShellScript/Bash.sublime-syntax
|
||||||
index e973e319..a703cef8 100644
|
index e973e319..07c170a7 100644
|
||||||
--- syntaxes/01_Packages/ShellScript/Bash.sublime-syntax
|
--- syntaxes/01_Packages/ShellScript/Bash.sublime-syntax
|
||||||
+++ syntaxes/01_Packages/ShellScript/Bash.sublime-syntax
|
+++ syntaxes/01_Packages/ShellScript/Bash.sublime-syntax
|
||||||
@@ -30,8 +30,8 @@ file_extensions:
|
@@ -30,12 +30,12 @@ file_extensions:
|
||||||
- .zshenv
|
- .zshenv
|
||||||
- .zshrc
|
- .zshrc
|
||||||
- PKGBUILD # https://jlk.fjfi.cvut.cz/arch/manpages/man/PKGBUILD.5
|
- PKGBUILD # https://jlk.fjfi.cvut.cz/arch/manpages/man/PKGBUILD.5
|
||||||
@@ -13,3 +13,8 @@ index e973e319..a703cef8 100644
|
|||||||
|
|
||||||
first_line_match: |
|
first_line_match: |
|
||||||
(?x)
|
(?x)
|
||||||
|
- ^\#! .* \b(bash|zsh|sh|tcsh|ash)\b
|
||||||
|
+ ^\#! .* \b(bash|zsh|sh|tcsh|ash|dash)\b
|
||||||
|
| ^\# \s* -\*- [^*]* mode: \s* shell-script [^*]* -\*-
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
12
assets/patches/XML.sublime-syntax.patch
vendored
Normal file
12
assets/patches/XML.sublime-syntax.patch
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
diff --git syntaxes/01_Packages/XML/XML.sublime-syntax syntaxes/01_Packages/XML/XML.sublime-syntax
|
||||||
|
index ad7d9c87..af4a00f0 100644
|
||||||
|
--- syntaxes/01_Packages/XML/XML.sublime-syntax
|
||||||
|
+++ syntaxes/01_Packages/XML/XML.sublime-syntax
|
||||||
|
@@ -12,6 +12,7 @@ file_extensions:
|
||||||
|
- rss
|
||||||
|
- opml
|
||||||
|
- svg
|
||||||
|
+ - xaml
|
||||||
|
first_line_match: |-
|
||||||
|
(?x:
|
||||||
|
^(?:
|
BIN
assets/syntaxes.bin
vendored
BIN
assets/syntaxes.bin
vendored
Binary file not shown.
2
assets/syntaxes/02_Extra/CMake
vendored
2
assets/syntaxes/02_Extra/CMake
vendored
Submodule assets/syntaxes/02_Extra/CMake updated: 7d6231c934...ab6ef4ef9f
1
assets/syntaxes/02_Extra/CSV
vendored
1
assets/syntaxes/02_Extra/CSV
vendored
Submodule assets/syntaxes/02_Extra/CSV deleted from 4786d037a7
106
assets/syntaxes/02_Extra/CSV.sublime-syntax
vendored
106
assets/syntaxes/02_Extra/CSV.sublime-syntax
vendored
@@ -1,46 +1,78 @@
|
|||||||
%YAML 1.2
|
%YAML 1.2
|
||||||
---
|
---
|
||||||
# http://www.sublimetext.com/docs/3/syntax.html
|
# See http://www.sublimetext.com/docs/3/syntax.html
|
||||||
name: Advanced CSV
|
name: Comma Separated Values
|
||||||
file_extensions:
|
file_extensions:
|
||||||
- csv
|
- csv
|
||||||
- tsv
|
- tsv
|
||||||
scope: text.advanced_csv
|
scope: text.csv
|
||||||
|
variables:
|
||||||
|
field_separator: (?:[,;\t])
|
||||||
|
record_separator: (?:$\n?)
|
||||||
contexts:
|
contexts:
|
||||||
|
prototype:
|
||||||
|
- match: (?={{record_separator}})
|
||||||
|
pop: true
|
||||||
|
fields:
|
||||||
|
- match: ''
|
||||||
|
push:
|
||||||
|
- field_or_record_separator
|
||||||
|
- field4
|
||||||
|
- field_or_record_separator
|
||||||
|
- field3
|
||||||
|
- field_or_record_separator
|
||||||
|
- field2
|
||||||
|
- field_or_record_separator
|
||||||
|
- field1
|
||||||
main:
|
main:
|
||||||
- match: (\")
|
- meta_include_prototype: false
|
||||||
captures:
|
- match: '^'
|
||||||
1: string.quoted.double.advanced_csv
|
set: fields
|
||||||
push:
|
|
||||||
- meta_scope: meta.quoted.advanced_csv
|
field_or_record_separator:
|
||||||
- match: (\")
|
- meta_include_prototype: false
|
||||||
captures:
|
- match: '{{record_separator}}'
|
||||||
1: string.quoted.double.advanced_csv
|
scope: punctuation.terminator.record.csv
|
||||||
pop: true
|
pop: true
|
||||||
- include: main
|
- match: '{{field_separator}}'
|
||||||
- match: '(\[([+-]?\d*)(\:)?([+-]?\d*)(\,)?([+-]?\d*)(\:)?([+-]?\d*)\])?\s*([<>v^])?\s*(=)'
|
scope: punctuation.separator.sequence.csv
|
||||||
captures:
|
|
||||||
1: keyword.operator.advanced_csv
|
|
||||||
2: constant.numeric.formula.advanced_csv
|
|
||||||
4: constant.numeric.formula.advanced_csv
|
|
||||||
6: constant.numeric.formula.advanced_csv
|
|
||||||
8: constant.numeric.formula.advanced_csv
|
|
||||||
9: keyword.operator.advanced_csv
|
|
||||||
10: keyword.operator.advanced_csv
|
|
||||||
push:
|
|
||||||
- meta_scope: meta.range.advanced_csv
|
|
||||||
- match: (?=(\")|$)
|
|
||||||
pop: true
|
pop: true
|
||||||
- include: scope:source.python
|
|
||||||
- match: '(?<=^|,|\s|\")([0-9.eE+-]+)(?=$|,|\s|\")'
|
field_contents:
|
||||||
scope: meta.number.advanced_csv
|
- match: '"'
|
||||||
captures:
|
scope: punctuation.definition.string.begin.csv
|
||||||
1: constant.numeric.advanced_csv
|
push: double_quoted_string
|
||||||
- match: '(?<=^|,|\s|\")([^, \t\"]+)(?=$|,|\s|\")'
|
|
||||||
scope: meta.nonnumber.advanced_csv
|
- match: (?={{field_separator}}|{{record_separator}})
|
||||||
captures:
|
pop: true
|
||||||
1: storage.type.advanced_csv
|
|
||||||
- match: (\,)
|
double_quoted_string:
|
||||||
scope: meta.delimiter.advanced_csv
|
- meta_include_prototype: false
|
||||||
captures:
|
- meta_scope: string.quoted.double.csv
|
||||||
1: keyword.operator.advanced_csv
|
- match: '""'
|
||||||
|
scope: constant.character.escape.csv
|
||||||
|
- match: '"'
|
||||||
|
scope: punctuation.definition.string.end.csv
|
||||||
|
pop: true
|
||||||
|
|
||||||
|
field1:
|
||||||
|
- match: ''
|
||||||
|
set:
|
||||||
|
- meta_content_scope: meta.field-1.csv support.type
|
||||||
|
- include: field_contents
|
||||||
|
field2:
|
||||||
|
- match: ''
|
||||||
|
set:
|
||||||
|
- meta_content_scope: meta.field-2.csv support.function
|
||||||
|
- include: field_contents
|
||||||
|
field3:
|
||||||
|
- match: ''
|
||||||
|
set:
|
||||||
|
- meta_content_scope: meta.field-3.csv constant.numeric
|
||||||
|
- include: field_contents
|
||||||
|
field4:
|
||||||
|
- match: ''
|
||||||
|
set:
|
||||||
|
- meta_content_scope: meta.field-4.csv keyword.operator
|
||||||
|
- include: field_contents
|
||||||
|
|
||||||
|
2
assets/syntaxes/02_Extra/Crystal
vendored
2
assets/syntaxes/02_Extra/Crystal
vendored
Submodule assets/syntaxes/02_Extra/Crystal updated: 5e032ff5f5...eb63666f35
2
assets/syntaxes/02_Extra/Dart
vendored
2
assets/syntaxes/02_Extra/Dart
vendored
Submodule assets/syntaxes/02_Extra/Dart updated: d891fb36c9...2734901b01
332
assets/syntaxes/02_Extra/Dart.sublime-syntax
vendored
332
assets/syntaxes/02_Extra/Dart.sublime-syntax
vendored
@@ -1,6 +1,6 @@
|
|||||||
%YAML 1.2
|
%YAML 1.2
|
||||||
---
|
---
|
||||||
# http://www.sublimetext.com/docs/3/syntax.html
|
# http://www.sublimetext.com/docs/syntax.html
|
||||||
name: Dart
|
name: Dart
|
||||||
file_extensions:
|
file_extensions:
|
||||||
- dart
|
- dart
|
||||||
@@ -9,7 +9,7 @@ contexts:
|
|||||||
main:
|
main:
|
||||||
- match: ^(#!.*)$
|
- match: ^(#!.*)$
|
||||||
scope: meta.preprocessor.script.dart
|
scope: meta.preprocessor.script.dart
|
||||||
- match: ^\s*\b(library|import|export|part of|part)\b
|
- match: ^\w*\b(library|import|part of|part|export)\b
|
||||||
captures:
|
captures:
|
||||||
0: keyword.other.import.dart
|
0: keyword.other.import.dart
|
||||||
push:
|
push:
|
||||||
@@ -19,242 +19,114 @@ contexts:
|
|||||||
0: punctuation.terminator.dart
|
0: punctuation.terminator.dart
|
||||||
pop: true
|
pop: true
|
||||||
- include: strings
|
- include: strings
|
||||||
- match: \b(as|show|hide|deferred)\b
|
- include: comments
|
||||||
|
- match: \b(as|show|hide)\b
|
||||||
scope: keyword.other.import.dart
|
scope: keyword.other.import.dart
|
||||||
- include: comments
|
- include: comments
|
||||||
- include: constants-and-special-vars
|
- include: punctuation
|
||||||
- include: annotations
|
- include: annotations
|
||||||
- include: decl-typedef
|
|
||||||
- include: decl-class
|
|
||||||
- include: decl-enum
|
|
||||||
- include: decl-function
|
|
||||||
- include: keywords
|
- include: keywords
|
||||||
|
- include: constants-and-special-vars
|
||||||
- include: strings
|
- include: strings
|
||||||
annotations:
|
annotations:
|
||||||
- match: '^(?:\s*)((@)([a-zA-Z0-9_]+))'
|
- match: '@[a-zA-Z]+'
|
||||||
captures:
|
scope: storage.type.annotation.dart
|
||||||
1: annotation.dart
|
|
||||||
2: entity.name.function.annotation.dart
|
|
||||||
3: support.type.dart
|
|
||||||
comments:
|
comments:
|
||||||
- match: /\*\*/
|
- match: /\*\*/
|
||||||
scope: comment.block.empty.dart
|
scope: comment.block.empty.dart
|
||||||
captures:
|
captures:
|
||||||
0: punctuation.definition.comment.dart
|
0: punctuation.definition.comment.dart
|
||||||
|
- include: comments-doc-oldschool
|
||||||
|
- include: comments-doc
|
||||||
- include: comments-inline
|
- include: comments-inline
|
||||||
comments-inline:
|
comments-block:
|
||||||
- match: /\*
|
- match: /\*
|
||||||
push:
|
push:
|
||||||
- meta_scope: comment.block.dart
|
- meta_scope: comment.block.dart
|
||||||
- match: \*/
|
- match: \*/
|
||||||
pop: true
|
pop: true
|
||||||
- include: scope:text.dart-doccomments
|
- include: comments-block
|
||||||
- match: (///)
|
comments-doc:
|
||||||
captures:
|
- match: ///
|
||||||
1: marker.dart
|
|
||||||
push:
|
push:
|
||||||
- meta_scope: comment.line.triple-slash.dart
|
- meta_scope: comment.block.documentation.dart
|
||||||
- match: $
|
- match: .*
|
||||||
pop: true
|
pop: true
|
||||||
- include: scope:text.dart-doccomments
|
- include: dartdoc
|
||||||
- match: (//)
|
comments-doc-oldschool:
|
||||||
captures:
|
- match: /\*\*
|
||||||
1: marker.dart
|
|
||||||
push:
|
push:
|
||||||
- meta_scope: comment.line.double-slash.dart
|
- meta_scope: comment.block.documentation.dart
|
||||||
- match: $
|
- match: \*/
|
||||||
pop: true
|
pop: true
|
||||||
- include: scope:text.dart-doccomments
|
- include: comments-doc-oldschool
|
||||||
|
- include: comments-block
|
||||||
|
- include: dartdoc
|
||||||
|
comments-inline:
|
||||||
|
- include: comments-block
|
||||||
|
- match: ((//).*)$
|
||||||
|
captures:
|
||||||
|
1: comment.line.double-slash.dart
|
||||||
constants-and-special-vars:
|
constants-and-special-vars:
|
||||||
- match: \b(true|false|null)\b
|
- match: (?<!\$)\b(true|false|null)\b(?!\$)
|
||||||
scope: constant.language.dart
|
scope: constant.language.dart
|
||||||
- match: \b(this|super)\b
|
- match: (?<!\$)\b(this|super)\b(?!\$)
|
||||||
scope: variable.language.dart
|
scope: variable.language.dart
|
||||||
- match: '\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)\b'
|
- match: '(?<!\$)\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)\b(?!\$)'
|
||||||
scope: constant.numeric.dart
|
scope: constant.numeric.dart
|
||||||
decl-class:
|
- match: '(?<![a-zA-Z0-9_$])([_$]*[A-Z][a-zA-Z0-9_$]*|bool\b|num\b|int\b|double\b|dynamic\b)'
|
||||||
- match: \bclass\b
|
scope: support.class.dart
|
||||||
|
- match: '([_$]*[a-z][a-zA-Z0-9_$]*)(<|\(|\s+=>)'
|
||||||
captures:
|
captures:
|
||||||
0: keyword.control.new.dart
|
1: entity.name.function.dart
|
||||||
|
dartdoc:
|
||||||
|
- match: '(\[.*?\])'
|
||||||
|
captures:
|
||||||
|
0: variable.name.source.dart
|
||||||
|
- match: '^ {4,}(?![ \*]).*'
|
||||||
|
captures:
|
||||||
|
0: variable.name.source.dart
|
||||||
|
- match: '```.*?$'
|
||||||
push:
|
push:
|
||||||
- meta_scope: meta.declaration.class.dart
|
- meta_content_scope: variable.other.source.dart
|
||||||
- match: "(?={)"
|
- match: '```'
|
||||||
pop: true
|
pop: true
|
||||||
- include: keywords
|
- match: (`.*?`)
|
||||||
- match: "[A-Za-z_][A-Za-z0-9_]*"
|
|
||||||
scope: class.name.dart
|
|
||||||
decl-enum:
|
|
||||||
- match: \benum\b
|
|
||||||
captures:
|
captures:
|
||||||
0: keyword.declaration.dart
|
0: variable.other.source.dart
|
||||||
push:
|
- match: (`.*?`)
|
||||||
- meta_scope: meta.declaration.enum.dart
|
|
||||||
- match: "(?={)"
|
|
||||||
pop: true
|
|
||||||
- include: keywords
|
|
||||||
- match: "[A-Za-z_][A-Za-z0-9_]*"
|
|
||||||
scope: enum.name.dart
|
|
||||||
decl-function:
|
|
||||||
- match: ^\s*(?:\b(void|bool|num|int|double|dynamic|var|String|List|Map)\b)\s+(get)\s+(\w+)\s+(?==>)
|
|
||||||
comment: A getter with a primitive return type.
|
|
||||||
scope: meta.declaration.function.dart
|
|
||||||
captures:
|
captures:
|
||||||
1: storage.type.primitive.dart
|
0: variable.other.source.dart
|
||||||
2: keyword.declaration.dart
|
- match: (\* (( ).*))$
|
||||||
3: function.name.dart
|
|
||||||
- match: ^\s*(?:\b(\w+)\b\s+)?(get)\s+(\w+)\s+(?==>)
|
|
||||||
comment: A getter with a user-defined return type or no return type.
|
|
||||||
scope: meta.declaration.function.dart
|
|
||||||
captures:
|
captures:
|
||||||
1: type.user-defined.dart
|
2: variable.other.source.dart
|
||||||
2: keyword.declaration.dart
|
- match: (\* .*)$
|
||||||
3: function.name.dart
|
|
||||||
- match: ^\s*(set)\s+(\w+)(?=\()
|
|
||||||
comment: A setter.
|
|
||||||
captures:
|
|
||||||
1: keyword.declaration.dart
|
|
||||||
2: function.name.dart
|
|
||||||
push:
|
|
||||||
- meta_scope: meta.declaration.function.dart
|
|
||||||
- match: \)
|
|
||||||
pop: true
|
|
||||||
- include: comments-inline
|
|
||||||
- include: decl-function-parameter
|
|
||||||
- include: strings
|
|
||||||
- include: keywords
|
|
||||||
- match: ^\s*(?:\b(void|bool|num|int|double|dynamic|var|String|List|Map)\b)\s+(\w+)(?=\()
|
|
||||||
comment: A function with a primitive return type.
|
|
||||||
captures:
|
|
||||||
1: storage.type.primitive.dart
|
|
||||||
2: function.name.dart
|
|
||||||
push:
|
|
||||||
- meta_scope: meta.declaration.function.dart
|
|
||||||
- match: \)
|
|
||||||
pop: true
|
|
||||||
- include: comments-inline
|
|
||||||
- include: decl-function-parameter
|
|
||||||
- include: strings
|
|
||||||
- include: keywords
|
|
||||||
- match: ^\s*(?:\b(return)\b)\s+(\w+)(?=\()
|
|
||||||
comment: A function invocation after 'return'
|
|
||||||
captures:
|
|
||||||
1: keyword.control.dart
|
|
||||||
2: function.name.dart
|
|
||||||
push:
|
|
||||||
- meta_scope: meta.invocation.function.dart
|
|
||||||
- match: \)
|
|
||||||
pop: true
|
|
||||||
- include: comments-inline
|
|
||||||
- include: decl-function-parameter
|
|
||||||
- include: strings
|
|
||||||
- include: keywords
|
|
||||||
- match: ^\s*\b(new)\b\s+(\w+)(?=\()
|
|
||||||
comment: A class instantiation after 'new'
|
|
||||||
captures:
|
|
||||||
1: keyword.declaration.dart
|
|
||||||
2: function.name.dart
|
|
||||||
push:
|
|
||||||
- meta_scope: meta.invocation.function.dart
|
|
||||||
- match: \)
|
|
||||||
pop: true
|
|
||||||
- include: comments-inline
|
|
||||||
- include: decl-function-parameter
|
|
||||||
- include: strings
|
|
||||||
- include: keywords
|
|
||||||
decl-function-parameter:
|
|
||||||
- include: constants-and-special-vars
|
|
||||||
- match: (?:\b(void|bool|num|int|double|dynamic|var|String|List|Map)\b)\s+(\w+)(?=\()
|
|
||||||
comment: A function with a primitive return type.
|
|
||||||
captures:
|
|
||||||
1: storage.type.primitive.dart
|
|
||||||
2: function.name.dart
|
|
||||||
push:
|
|
||||||
- meta_scope: meta.parameter.function.dart
|
|
||||||
- match: \)
|
|
||||||
pop: true
|
|
||||||
- include: decl-function-parameter
|
|
||||||
- include: strings
|
|
||||||
- include: keywords
|
|
||||||
- match: \b(new)\b\s+(\w+)(?=\()
|
|
||||||
comment: A class instantiation after 'new'
|
|
||||||
captures:
|
|
||||||
1: keyword.declaration.dart
|
|
||||||
2: function.name.dart
|
|
||||||
push:
|
|
||||||
- meta_scope: meta.invocation.function.dart
|
|
||||||
- match: \)
|
|
||||||
pop: true
|
|
||||||
- include: decl-function-parameter
|
|
||||||
- include: strings
|
|
||||||
- include: keywords
|
|
||||||
- match: (?:\b(\w+)\b)\s+(\w+)(?=\()
|
|
||||||
comment: A function with a user-defined return type.
|
|
||||||
captures:
|
|
||||||
1: type.user-defined.dart
|
|
||||||
2: function.name.dart
|
|
||||||
push:
|
|
||||||
- meta_scope: meta.parameter.function.dart
|
|
||||||
- match: \)
|
|
||||||
pop: true
|
|
||||||
- include: decl-function-parameter
|
|
||||||
- include: strings
|
|
||||||
- include: keywords
|
|
||||||
- match: (\w+)(?=\()
|
|
||||||
comment: A function with no return type.
|
|
||||||
captures:
|
|
||||||
1: function.name.dart
|
|
||||||
push:
|
|
||||||
- meta_scope: meta.parameter.function.dart
|
|
||||||
- match: \)
|
|
||||||
pop: true
|
|
||||||
- include: decl-function-parameter
|
|
||||||
- include: strings
|
|
||||||
- include: keywords
|
|
||||||
decl-typedef:
|
|
||||||
- match: typedef
|
|
||||||
captures:
|
|
||||||
0: keyword.control.new.dart
|
|
||||||
push:
|
|
||||||
- meta_scope: meta.declaration.typedef.dart
|
|
||||||
- match: ;
|
|
||||||
captures:
|
|
||||||
0: punctuation.terminator.dart
|
|
||||||
pop: true
|
|
||||||
- match: '(?:\b(void|bool|num|int|double|dynamic|var|String|List|Map)\b|([a-zA-Z_][a-zA-Z0-9_]*))\s+([a-zA-Z_][a-zA-Z0-9_]+)'
|
|
||||||
captures:
|
|
||||||
1: storage.type.primitive.dart
|
|
||||||
2: typedef.return.dart
|
|
||||||
3: typedef.name.dart
|
|
||||||
- match: \(
|
|
||||||
push:
|
|
||||||
- meta_scope: typedef.params.dart
|
|
||||||
- match: \)
|
|
||||||
pop: true
|
|
||||||
- include: keywords
|
|
||||||
keywords:
|
keywords:
|
||||||
- match: \bassert\b
|
- match: (?<!\$)\bas\b(?!\$)
|
||||||
scope: keyword.control.assert.dart
|
|
||||||
- match: \bas\b
|
|
||||||
scope: keyword.cast.dart
|
scope: keyword.cast.dart
|
||||||
- match: \b(try|catch|finally|throw|on|rethrow)\b
|
- match: (?<!\$)\b(try|on|catch|finally|throw|rethrow)\b(?!\$)
|
||||||
scope: keyword.control.catch-exception.dart
|
scope: keyword.control.catch-exception.dart
|
||||||
- match: \s+\?\s+|\s+:\s+
|
- match: (?<!\$)\b(break|case|continue|default|do|else|for|if|in|return|switch|while)\b(?!\$)
|
||||||
scope: keyword.control.ternary.dart
|
|
||||||
- match: \b(break|case|continue|default|do|else|for|if|in|return|switch|while)\b
|
|
||||||
scope: keyword.control.dart
|
scope: keyword.control.dart
|
||||||
- match: \b(async\*|async|await\*|await|yield)\b
|
- match: (?<!\$)\b(sync(\*)?|async(\*)?|await|yield(\*)?)\b(?!\$)
|
||||||
scope: keyword.control.async.dart
|
scope: keyword.control.dart
|
||||||
- match: \b(new)\b
|
- match: (?<!\$)\bassert\b(?!\$)
|
||||||
|
scope: keyword.control.dart
|
||||||
|
- match: (?<!\$)\b(new)\b(?!\$)
|
||||||
scope: keyword.control.new.dart
|
scope: keyword.control.new.dart
|
||||||
- match: \b(abstract|extends|external|factory|implements|with|interface|get|native|operator|set|typedef)\b
|
- match: (?<!\$)\b(abstract|class|enum|extends|external|factory|implements|get|mixin|native|operator|set|typedef|with|covariant)\b(?!\$)
|
||||||
scope: keyword.declaration.dart
|
scope: keyword.declaration.dart
|
||||||
- match: \b(is\!?)\b
|
- match: (?<!\$)\b(is\!?)\b(?!\$)
|
||||||
scope: keyword.operator.dart
|
scope: keyword.operator.dart
|
||||||
|
- match: '\?|:'
|
||||||
|
scope: keyword.operator.ternary.dart
|
||||||
- match: (<<|>>>?|~|\^|\||&)
|
- match: (<<|>>>?|~|\^|\||&)
|
||||||
scope: keyword.operator.bitwise.dart
|
scope: keyword.operator.bitwise.dart
|
||||||
- match: ((&|\^|\||<<|>>>?)=)
|
- match: ((&|\^|\||<<|>>>?)=)
|
||||||
scope: keyword.operator.assignment.bitwise.dart
|
scope: keyword.operator.assignment.bitwise.dart
|
||||||
- match: (===?|!==?|<=?|>=?)
|
- match: (=>)
|
||||||
|
scope: keyword.operator.closure.dart
|
||||||
|
- match: (==|!=|<=?|>=?)
|
||||||
scope: keyword.operator.comparison.dart
|
scope: keyword.operator.comparison.dart
|
||||||
- match: '(([+*/%-]|\~)=)'
|
- match: '(([+*/%-]|\~)=)'
|
||||||
scope: keyword.operator.assignment.arithmetic.dart
|
scope: keyword.operator.assignment.arithmetic.dart
|
||||||
@@ -266,56 +138,22 @@ contexts:
|
|||||||
scope: keyword.operator.arithmetic.dart
|
scope: keyword.operator.arithmetic.dart
|
||||||
- match: (!|&&|\|\|)
|
- match: (!|&&|\|\|)
|
||||||
scope: keyword.operator.logical.dart
|
scope: keyword.operator.logical.dart
|
||||||
|
- match: (?<!\$)\b(static|final|const)\b(?!\$)
|
||||||
|
scope: storage.modifier.dart
|
||||||
|
- match: (?<!\$)\b(?:void|var)\b(?!\$)
|
||||||
|
scope: storage.type.primitive.dart
|
||||||
|
punctuation:
|
||||||
|
- match: ','
|
||||||
|
scope: punctuation.comma.dart
|
||||||
- match: ;
|
- match: ;
|
||||||
scope: punctuation.terminator.dart
|
scope: punctuation.terminator.dart
|
||||||
- match: \b(static|final|const)\b
|
|
||||||
scope: storage.modifier.dart
|
|
||||||
- match: \b(?:void|bool|num|int|double|dynamic|var|String|List|Map)\b
|
|
||||||
scope: storage.type.primitive.dart
|
|
||||||
regexp:
|
|
||||||
- match: '\\[^''"]'
|
|
||||||
scope: constant.character.escaped.regex.dart
|
|
||||||
- match: \(
|
|
||||||
push:
|
|
||||||
- meta_content_scope: meta.capture.regex.dart
|
|
||||||
- match: \)
|
|
||||||
pop: true
|
|
||||||
- match: \?(:|=|!)
|
|
||||||
scope: ignore.capture.regex.dart
|
|
||||||
- match: \*|\+|\?|\.|\|
|
|
||||||
scope: keyword.other.regex.dart
|
|
||||||
- match: \^|\$
|
|
||||||
scope: keyword.other.regex.dart
|
|
||||||
- match: \.
|
- match: \.
|
||||||
scope: constant.other.regex.dart
|
scope: punctuation.dot.dart
|
||||||
- match: '\[(\^)?'
|
|
||||||
captures:
|
|
||||||
1: keyword.other.negation.regex.dart
|
|
||||||
push:
|
|
||||||
- meta_scope: constant.character.range.regex.dart
|
|
||||||
- match: '\]'
|
|
||||||
pop: true
|
|
||||||
- match: '\\[^"'']'
|
|
||||||
scope: constant.character.escaped.regex.dart
|
|
||||||
- match: '\{(?:\d+)?,(?:\d+)?\}'
|
|
||||||
scope: keyword.other.regex.dart
|
|
||||||
string-interp:
|
string-interp:
|
||||||
- match: '(\$)(\{)'
|
- match: '\$((\w+)|\{([^{}]+)\})'
|
||||||
captures:
|
captures:
|
||||||
1: keyword.other.dart
|
|
||||||
2: keyword.other.dart
|
|
||||||
push:
|
|
||||||
- meta_scope: interpolation.dart
|
|
||||||
- meta_content_scope: source.dart
|
|
||||||
- match: '(\})'
|
|
||||||
captures:
|
|
||||||
1: keyword.other.dart
|
|
||||||
pop: true
|
|
||||||
- include: main
|
|
||||||
- match: (\$)(\w+)
|
|
||||||
captures:
|
|
||||||
1: keyword.other.dart
|
|
||||||
2: variable.parameter.dart
|
2: variable.parameter.dart
|
||||||
|
3: variable.parameter.dart
|
||||||
- match: \\.
|
- match: \\.
|
||||||
scope: constant.character.escape.dart
|
scope: constant.character.escape.dart
|
||||||
strings:
|
strings:
|
||||||
@@ -328,7 +166,7 @@ contexts:
|
|||||||
- match: (?<!r)'''
|
- match: (?<!r)'''
|
||||||
push:
|
push:
|
||||||
- meta_scope: string.interpolated.triple.single.dart
|
- meta_scope: string.interpolated.triple.single.dart
|
||||||
- match: "'''(?!')"
|
- match: '''''''(?!'')'
|
||||||
pop: true
|
pop: true
|
||||||
- include: string-interp
|
- include: string-interp
|
||||||
- match: r"""
|
- match: r"""
|
||||||
@@ -339,9 +177,9 @@ contexts:
|
|||||||
- match: r'''
|
- match: r'''
|
||||||
push:
|
push:
|
||||||
- meta_scope: string.quoted.triple.single.dart
|
- meta_scope: string.quoted.triple.single.dart
|
||||||
- match: "'''(?!')"
|
- match: '''''''(?!'')'
|
||||||
pop: true
|
pop: true
|
||||||
- match: (?<!\\|r)"
|
- match: (?<!\|r)"
|
||||||
push:
|
push:
|
||||||
- meta_scope: string.interpolated.double.dart
|
- meta_scope: string.interpolated.double.dart
|
||||||
- match: '"'
|
- match: '"'
|
||||||
@@ -354,16 +192,20 @@ contexts:
|
|||||||
- meta_scope: string.quoted.double.dart
|
- meta_scope: string.quoted.double.dart
|
||||||
- match: '"'
|
- match: '"'
|
||||||
pop: true
|
pop: true
|
||||||
- include: regexp
|
- match: \n
|
||||||
|
scope: invalid.string.newline
|
||||||
- match: (?<!\|r)'
|
- match: (?<!\|r)'
|
||||||
push:
|
push:
|
||||||
- meta_scope: string.interpolated.single.dart
|
- meta_scope: string.interpolated.single.dart
|
||||||
- match: "'"
|
- match: "'"
|
||||||
pop: true
|
pop: true
|
||||||
|
- match: \n
|
||||||
|
scope: invalid.string.newline
|
||||||
- include: string-interp
|
- include: string-interp
|
||||||
- match: r'
|
- match: r'
|
||||||
push:
|
push:
|
||||||
- meta_scope: string.quoted.single.dart
|
- meta_scope: string.quoted.single.dart
|
||||||
- match: "'"
|
- match: "'"
|
||||||
pop: true
|
pop: true
|
||||||
- include: regexp
|
- match: \n
|
||||||
|
scope: invalid.string.newline
|
||||||
|
2
assets/syntaxes/02_Extra/DotENV
vendored
2
assets/syntaxes/02_Extra/DotENV
vendored
Submodule assets/syntaxes/02_Extra/DotENV updated: a1c917633d...58201ba2ab
@@ -4,7 +4,6 @@
|
|||||||
name: DotENV
|
name: DotENV
|
||||||
file_extensions:
|
file_extensions:
|
||||||
- .env
|
- .env
|
||||||
- .envrc
|
|
||||||
- .env.dist
|
- .env.dist
|
||||||
- .env.local
|
- .env.local
|
||||||
- .env.sample
|
- .env.sample
|
||||||
@@ -19,8 +18,11 @@ file_extensions:
|
|||||||
- .env.production
|
- .env.production
|
||||||
- .env.production.local
|
- .env.production.local
|
||||||
- .env.dusk.local
|
- .env.dusk.local
|
||||||
- .flaskenv
|
|
||||||
- .env.staging
|
- .env.staging
|
||||||
|
- .env.default
|
||||||
|
- .env.defaults
|
||||||
|
- .envrc
|
||||||
|
- .flaskenv
|
||||||
scope: source.env
|
scope: source.env
|
||||||
contexts:
|
contexts:
|
||||||
main:
|
main:
|
||||||
|
2
assets/syntaxes/02_Extra/FSharp
vendored
2
assets/syntaxes/02_Extra/FSharp
vendored
Submodule assets/syntaxes/02_Extra/FSharp updated: c18616d6bd...9e4645c608
@@ -5,6 +5,7 @@ name: fstab
|
|||||||
file_extensions:
|
file_extensions:
|
||||||
- fstab
|
- fstab
|
||||||
- crypttab
|
- crypttab
|
||||||
|
- mtab
|
||||||
scope: source.fstab
|
scope: source.fstab
|
||||||
|
|
||||||
contexts:
|
contexts:
|
||||||
|
2
assets/syntaxes/02_Extra/GLSL
vendored
2
assets/syntaxes/02_Extra/GLSL
vendored
Submodule assets/syntaxes/02_Extra/GLSL updated: 4cd4acfffc...59a5f8a312
2
assets/syntaxes/02_Extra/GraphQL
vendored
2
assets/syntaxes/02_Extra/GraphQL
vendored
Submodule assets/syntaxes/02_Extra/GraphQL updated: 59304d6c7b...9b6f6d0a86
1
assets/syntaxes/02_Extra/Groff
vendored
Submodule
1
assets/syntaxes/02_Extra/Groff
vendored
Submodule
Submodule assets/syntaxes/02_Extra/Groff added at 651091c7e2
2
assets/syntaxes/02_Extra/Julia
vendored
2
assets/syntaxes/02_Extra/Julia
vendored
Submodule assets/syntaxes/02_Extra/Julia updated: e2b1cb549d...1e55f3211b
2
assets/syntaxes/02_Extra/LESS
vendored
2
assets/syntaxes/02_Extra/LESS
vendored
Submodule assets/syntaxes/02_Extra/LESS updated: 44632e19af...836b47ec61
1
assets/syntaxes/02_Extra/LLVM
vendored
Submodule
1
assets/syntaxes/02_Extra/LLVM
vendored
Submodule
Submodule assets/syntaxes/02_Extra/LLVM added at 274126faa9
2
assets/syntaxes/02_Extra/Lean
vendored
2
assets/syntaxes/02_Extra/Lean
vendored
Submodule assets/syntaxes/02_Extra/Lean updated: 49d185361a...29a03a8aba
1
assets/syntaxes/02_Extra/LiveScript
vendored
Submodule
1
assets/syntaxes/02_Extra/LiveScript
vendored
Submodule
Submodule assets/syntaxes/02_Extra/LiveScript added at 2575013851
400
assets/syntaxes/02_Extra/LiveScript.sublime-syntax
vendored
Normal file
400
assets/syntaxes/02_Extra/LiveScript.sublime-syntax
vendored
Normal file
@@ -0,0 +1,400 @@
|
|||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
# http://www.sublimetext.com/docs/3/syntax.html
|
||||||
|
name: LiveScript
|
||||||
|
comment: "LiveScript Syntax: version 1"
|
||||||
|
file_extensions:
|
||||||
|
- ls
|
||||||
|
- Slakefile
|
||||||
|
- ls.erb
|
||||||
|
first_line_match: ^#!.*\bls
|
||||||
|
scope: source.livescript
|
||||||
|
contexts:
|
||||||
|
main:
|
||||||
|
- match: |-
|
||||||
|
(?x)
|
||||||
|
!?[~-]{1,2}>\*?
|
||||||
|
|<[~-]{1,2}!?
|
||||||
|
|\(\s* (?= instanceof[\s)]|and[\s)]|or[\s)]|is[\s)]|isnt[\s)]|in[\s)]|import[\s)]|import\ all[\s)] |\.|[-+/*%^&<>=|][\b\s)\w$]|\*\*|\%\%)
|
||||||
|
| (?<=[\s(]instanceof|[\s(]and|[\s(]or|[\s(]is|[\s(]isnt|[\s(]in|[\s(]import|[\s(]import\ all|[\s(]do|\.|\*\*|\%\%|[\b\s(\w$][-+/*%^&<>=|]) \s*\)
|
||||||
|
scope: storage.type.function.livescript
|
||||||
|
- match: \/\*
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.comment.livescript
|
||||||
|
push:
|
||||||
|
- meta_scope: comment.block.livescript
|
||||||
|
- match: \*\/
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.comment.livescript
|
||||||
|
pop: true
|
||||||
|
- match: '@\w*'
|
||||||
|
scope: storage.type.annotation.livescriptscript
|
||||||
|
- match: '(#)(?!\{).*$\n?'
|
||||||
|
scope: comment.line.number-sign.livescript
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.comment.livescript
|
||||||
|
- match: '((?:!|~|!~|~!)?function\*?)\s+([$\w\-]*[$\w]+)'
|
||||||
|
captures:
|
||||||
|
1: storage.type.function.livescript
|
||||||
|
2: entity.name.function.livescript
|
||||||
|
- match: (new)\s+(\w+(?:\.\w*)*)
|
||||||
|
captures:
|
||||||
|
1: keyword.operator.new.livescript
|
||||||
|
2: entity.name.type.instance.livescript
|
||||||
|
- match: \b(package|private|protected|public|interface|enum|static)(?!-)\b
|
||||||
|
scope: keyword.illegal.livescript
|
||||||
|
- match: "'''"
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.begin.livescript
|
||||||
|
push:
|
||||||
|
- meta_scope: string.quoted.heredoc.livescript
|
||||||
|
- match: "'''"
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.end.livescript
|
||||||
|
pop: true
|
||||||
|
- match: '"""'
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.begin.livescript
|
||||||
|
push:
|
||||||
|
- meta_scope: string.quoted.double.heredoc.livescript
|
||||||
|
- match: '"""'
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.end.livescript
|
||||||
|
pop: true
|
||||||
|
- match: \\.
|
||||||
|
scope: constant.character.escape.livescript
|
||||||
|
- include: interpolated_livescript
|
||||||
|
- match: "``"
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.begin.livescript
|
||||||
|
push:
|
||||||
|
- meta_scope: string.quoted.script.livescript
|
||||||
|
- match: "``"
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.end.livescript
|
||||||
|
pop: true
|
||||||
|
- match: '\\(x[0-9A-Fa-f]{2}|[0-2][0-7]{0,2}|3[0-6][0-7]|37[0-7]?|[4-7][0-7]?|.)'
|
||||||
|
scope: constant.character.escape.livescript
|
||||||
|
- match: '<\['
|
||||||
|
push:
|
||||||
|
- meta_scope: string.array-literal.livescript
|
||||||
|
- match: '\]>'
|
||||||
|
pop: true
|
||||||
|
- match: '/{2}(?![\s=/*+{}?]).*?[^\\]/[igmy]{0,4}(?![a-zA-Z0-9])/{2}'
|
||||||
|
scope: string.regexp.livescript
|
||||||
|
- match: '/{2}\n'
|
||||||
|
push:
|
||||||
|
- meta_scope: string.regexp.livescript
|
||||||
|
- match: "/{2}[imgy]{0,4}"
|
||||||
|
pop: true
|
||||||
|
- include: embedded_spaced_comment
|
||||||
|
- include: interpolated_livescript
|
||||||
|
- match: "/{2}"
|
||||||
|
push:
|
||||||
|
- meta_scope: string.regexp.livescript
|
||||||
|
- match: "/{2}[imgy]{0,4}"
|
||||||
|
pop: true
|
||||||
|
- match: '\\(x[0-9A-Fa-f]{2}|[0-2][0-7]{0,2}|3[0-6][0-7]|37[0-7]?|[4-7][0-7]?|.)'
|
||||||
|
scope: constant.character.escape.livescript
|
||||||
|
- include: interpolated_livescript
|
||||||
|
- match: '/(?![\s=/*+{}?]).*?[^\\]/[igmy]{0,4}(?![a-zA-Z0-9])'
|
||||||
|
scope: string.regexp.livescript
|
||||||
|
- match: |-
|
||||||
|
(?x)
|
||||||
|
\b(?<![\.\$\-@])(
|
||||||
|
instanceof|new|delete|typeof|and|or|is|isnt|not
|
||||||
|
)(?!\-|\s*:)\b
|
||||||
|
scope: keyword.operator.livescript
|
||||||
|
- match: <\||\|>
|
||||||
|
scope: keyword.operator.livescript
|
||||||
|
- match: "=>"
|
||||||
|
scope: keyword.control.livescript
|
||||||
|
- match: |-
|
||||||
|
(?x)
|
||||||
|
\b(?<![\.\$\-@])(?:
|
||||||
|
return|break|continue|throw
|
||||||
|
|try|if|while|for|for\s+own|switch|unless|until
|
||||||
|
|catch|finally|else|nobreak|case|default|fallthrough|when|otherwise|then
|
||||||
|
|yield
|
||||||
|
)(?!\-|\s*:)\b
|
||||||
|
scope: keyword.control.livescript
|
||||||
|
- match: |-
|
||||||
|
(?x)
|
||||||
|
and=|or=|%|&|\^|\*|\/|(?<![a-zA-Z$_])(\-)?\-(?!\-?>)|\+\+|\+|
|
||||||
|
~(?!~?>)|==|=|!=|<=|>=|<<=|>>=|
|
||||||
|
>>>=|<>|<(?!\[)|(?<!\])>|(?<!\w)!(?!([~\-]+)?>)|&&|\.\.(\.)?|\s\.\s|\?|\|\||\:|\*=|(?<!\()/=|%=|\+=|\-=|\.=|&=
|
||||||
|
|\^=
|
||||||
|
scope: keyword.operator.livescript
|
||||||
|
- match: |-
|
||||||
|
(?x)
|
||||||
|
\b(?<![\.\$\-@])(?:
|
||||||
|
function
|
||||||
|
)(?!\-|\s*:)\b
|
||||||
|
scope: storage.type.function.livescript
|
||||||
|
- match: |-
|
||||||
|
(?x)
|
||||||
|
\b(?<![\.\$\-@])(?:
|
||||||
|
this|throw|then|try|typeof!?|til|to
|
||||||
|
|continue|const|case|catch|class
|
||||||
|
|in|instanceof|import|import\s+all|implements|if|is
|
||||||
|
|default|delete|debugger|do
|
||||||
|
|for|for\s+own|finally|function|from|fallthrough
|
||||||
|
|super|switch
|
||||||
|
|else|nobreak|extends|export|eval
|
||||||
|
|and|arguments
|
||||||
|
|new|not
|
||||||
|
|unless|until
|
||||||
|
|while|with|when
|
||||||
|
|of|or|otherwise
|
||||||
|
|let|var|loop
|
||||||
|
|match
|
||||||
|
|by|yield
|
||||||
|
)(?!\-|\s*:)\b
|
||||||
|
scope: keyword.other.livescript
|
||||||
|
- match: '([a-zA-Z\$_](?:[\w$.-])*)\s*(?!\::)((:)|(=(?!>)))\s*(?!(\s*!?\s*\(.*\))?\s*(!?[~-]{1,2}>\*?))'
|
||||||
|
captures:
|
||||||
|
1: variable.assignment.livescript
|
||||||
|
3: punctuation.separator.key-value, keyword.operator.livescript
|
||||||
|
4: keyword.operator.livescript
|
||||||
|
- match: '(?<=\s|^)([\[\{])(?=.*?[\]\}]\s+[:=])'
|
||||||
|
captures:
|
||||||
|
0: keyword.operator.livescript
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.variable.assignment.destructured.livescript
|
||||||
|
- match: '([\]\}]\s*[:=])'
|
||||||
|
captures:
|
||||||
|
0: keyword.operator.livescript
|
||||||
|
pop: true
|
||||||
|
- include: variable_name
|
||||||
|
- include: instance_variable
|
||||||
|
- include: single_quoted_string
|
||||||
|
- include: double_quoted_string
|
||||||
|
- include: numeric
|
||||||
|
- match: |-
|
||||||
|
(?x)
|
||||||
|
(\s*)
|
||||||
|
(?=[a-zA-Z\$_])
|
||||||
|
([a-zA-Z\$_]([\w$.:-])*)\s*
|
||||||
|
(?=[:=](\s*!?\s*\(.*\))?\s*(!?[~-]{1,2}>\*?))
|
||||||
|
scope: meta.function.livescript
|
||||||
|
captures:
|
||||||
|
2: entity.name.function.livescript
|
||||||
|
3: entity.name.function.livescript
|
||||||
|
4: variable.parameter.function.livescript
|
||||||
|
5: storage.type.function.livescript
|
||||||
|
- match: \b(?<!\.)(true|on|yes)(?!\s*:)\b
|
||||||
|
scope: constant.language.boolean.true.livescript
|
||||||
|
- match: \b(?<!\.)(false|off|no)(?!\s*:)\b
|
||||||
|
scope: constant.language.boolean.false.livescript
|
||||||
|
- match: \b(?<!\.)(null|void)(?!\s*:)\b
|
||||||
|
scope: constant.language.null.livescript
|
||||||
|
- match: \b(?<!\.)(super|this|extends)(?!\s*:)\b
|
||||||
|
scope: variable.language.livescript
|
||||||
|
- match: '(class\b)\s+(@?[a-zA-Z$_][\w$.-]*)?(?:\s+(extends)\s+(@?[a-zA-Z$_][\w$.-]*))?'
|
||||||
|
scope: meta.class.livescript
|
||||||
|
captures:
|
||||||
|
1: storage.type.class.livescript
|
||||||
|
2: entity.name.type.class.livescript
|
||||||
|
3: keyword.control.inheritance.livescript
|
||||||
|
4: entity.other.inherited-class.livescript
|
||||||
|
- match: \b(debugger|\\)\b
|
||||||
|
scope: keyword.other.livescript
|
||||||
|
- match: |-
|
||||||
|
(?x)\b(
|
||||||
|
Array|ArrayBuffer|Blob|Boolean|Date|document|event|Function|
|
||||||
|
Int(8|16|32|64)Array|Math|Map|Number|
|
||||||
|
Object|Proxy|RegExp|Set|String|WeakMap|
|
||||||
|
window|Uint(8|16|32|64)Array|XMLHttpRequest
|
||||||
|
)\b
|
||||||
|
scope: support.class.livescript
|
||||||
|
- match: \b(console)\b
|
||||||
|
scope: entity.name.type.object.livescript
|
||||||
|
- match: \b(Infinity|NaN|undefined)\b
|
||||||
|
scope: constant.language.livescript
|
||||||
|
- match: \;
|
||||||
|
scope: punctuation.terminator.statement.livescript
|
||||||
|
- match: ',[ |\t]*'
|
||||||
|
scope: meta.delimiter.object.comma.livescript
|
||||||
|
- match: \.
|
||||||
|
scope: meta.delimiter.method.period.livescript
|
||||||
|
- match: '\{|\}'
|
||||||
|
scope: meta.brace.curly.livescript
|
||||||
|
- match: \(|\)
|
||||||
|
scope: meta.brace.round.livescript
|
||||||
|
- match: '\[|\]\s*'
|
||||||
|
scope: meta.brace.square.livescript
|
||||||
|
- include: instance_variable
|
||||||
|
- include: backslash_string
|
||||||
|
- include: single_quoted_string
|
||||||
|
- include: double_quoted_string
|
||||||
|
- include: numeric
|
||||||
|
- match: '()(@|@@|[$\w\-]*[$\w]+)\s*(`)'
|
||||||
|
captures:
|
||||||
|
1: keyword.operator.livescript
|
||||||
|
2: meta.function-call.livescript
|
||||||
|
3: keyword.operator.livescript
|
||||||
|
- match: "`"
|
||||||
|
scope: keyword.operator.livescript
|
||||||
|
- match: '()(@|@@|[$\w\-]*[$\w]+)(?:(\??\!)|[(])'
|
||||||
|
captures:
|
||||||
|
1: keyword.operator.livescript
|
||||||
|
2: meta.function-call.livescript
|
||||||
|
3: keyword.operator.livescript
|
||||||
|
- match: '(@|@@|[$\w\-]*[$\w]+)(\?)? (?!\s*(((by|of|and|or|with|when|unless|if|is|isnt|else|nobreak|for|from|not in|in|catch|til|to|then|import|extends|implements|instanceof)\b)|[=:.*\/+\-%\^<>][ =)]|[`}%*)]|/(?!.*?/)|&&|[.][^.]|=>|\/ +|\||\|\||\-\-|\+\+|\|>|<|\||$|\n|\#|/\*))'
|
||||||
|
captures:
|
||||||
|
1: meta.function-call.livescript
|
||||||
|
2: keyword.operator.livescript
|
||||||
|
- match: \| _
|
||||||
|
scope: keyword.control.livescript
|
||||||
|
- match: '\|(?![.])'
|
||||||
|
scope: keyword.control.livescript
|
||||||
|
- match: \|
|
||||||
|
scope: keyword.operator.livescript
|
||||||
|
- match: ((?<=console\.)(debug|warn|info|log|error|time(End|-end)|assert))\b
|
||||||
|
scope: support.function.console.livescript
|
||||||
|
- match: |-
|
||||||
|
(?x)\b(
|
||||||
|
decodeURI(Component)?|encodeURI(Component)?|eval|parse(Float|Int)|require
|
||||||
|
)\b
|
||||||
|
scope: support.function.livescript
|
||||||
|
- match: |-
|
||||||
|
(?x)(?<![.-])\b(
|
||||||
|
map|filter|reject|partition|find|each|head|tail|last|initial|empty|
|
||||||
|
values|keys|length|cons|append|join|reverse|fold(l|r)?1?|unfoldr|
|
||||||
|
and(List|-list)|or(List|-list)|any|all|unique|sum|product|mean|compact|
|
||||||
|
concat(Map|-map)?|maximum|minimum|scan(l|r)?1?|replicate|slice|apply|
|
||||||
|
split(At|-at)?|take(While|-while)?|drop(While|-while)?|span|first|
|
||||||
|
break(It|-it)|list(ToObj|-to-obj)|obj(ToFunc|-to-func)|
|
||||||
|
pairs(ToObj|-to-obj)|obj(ToPairs|-to-pairs|ToLists|-to-lists)|
|
||||||
|
zip(All|-all)?(With|-with)?|compose|curry|partial|flip|fix|
|
||||||
|
sort(With|-with|By|-by)?|group(By|-by)|break(List|-list|Str|-str)|
|
||||||
|
difference|intersection|union|average|flatten|chars|unchars|repeat|
|
||||||
|
lines|unlines|words|unwords|max|min|negate|abs|signum|quot|rem|div|mod|
|
||||||
|
recip|pi|tau|exp|sqrt|ln|pow|sin|cos|tan|asin|acos|atan|atan2|truncate|
|
||||||
|
round|ceiling|floor|is(It|-it)NaN|even|odd|gcd|lcm|disabled__id
|
||||||
|
)\b(?![.-])
|
||||||
|
comment: |
|
||||||
|
Generated by DOM query from http://gkz.github.com/prelude-ls/:
|
||||||
|
[].slice
|
||||||
|
.call(document.querySelectorAll(".nav-pills li a"))
|
||||||
|
.map(function(_) {return _.innerText})
|
||||||
|
.filter(function(_) {return _.trim() !== '})
|
||||||
|
.slice(2)
|
||||||
|
.join("|")
|
||||||
|
scope: support.function.prelude.livescript
|
||||||
|
- match: '(?x)(?<![.-])\b(that|it|e|_)\b'
|
||||||
|
scope: support.function.semireserved.livescript
|
||||||
|
- match: |-
|
||||||
|
(?x)((?<=(\.|\]|\)))(
|
||||||
|
apply|call|concat|every|filter|for(Each|-each)|
|
||||||
|
from|has(Own|-own)(Property|-property)|index(Of|-of)|
|
||||||
|
is(Prototype|-prototype)(Of|-of)|join|last(Index|-index)(Of|-of)|
|
||||||
|
map|of|pop|property(Is|-is)(Enumerable|-enumerable)|push|
|
||||||
|
reduce(Right|-right)?|reverse|shift|slice|some|sort|
|
||||||
|
splice|to(Locale|-locale)?(String|-string)|unshift|valueOf
|
||||||
|
))\b(?!-)
|
||||||
|
scope: support.function.method.array.livescript
|
||||||
|
- match: |-
|
||||||
|
(?x)((?<=Array\.)(
|
||||||
|
isArray
|
||||||
|
))\b
|
||||||
|
scope: support.function.static.array.livescript
|
||||||
|
- match: |-
|
||||||
|
(?x)((?<=Object\.)(
|
||||||
|
create|define(Propert|-propert)(ies|y)|freeze|
|
||||||
|
get(Own|-own)(Property|-property)(Descriptors?|Names)|
|
||||||
|
get(Property|-property)(Descriptor|Names)|getPrototypeOf|
|
||||||
|
is((Extensible|-extensible)|(Frozen|-frozen)|(Sealed|-sealed))?|
|
||||||
|
keys|prevent(Extensions|-extensions)|seal
|
||||||
|
))\b
|
||||||
|
scope: support.function.static.object.livescript
|
||||||
|
- match: |-
|
||||||
|
(?x)((?<=Math\.)(
|
||||||
|
abs|acos|acosh|asin|asinh|atan|atan2|atanh|ceil|cos|cosh|exp|expm1|floor|
|
||||||
|
hypot|log|log10|log1p|log2|max|min|pow|random|round|sign|sin|sinh|sqrt|
|
||||||
|
tan|tanh|trunc
|
||||||
|
))\b
|
||||||
|
scope: support.function.static.math.livescript
|
||||||
|
- match: |-
|
||||||
|
(?x)((?<=Number\.)(
|
||||||
|
is(Finite|Integer|NaN)|to(Integer|-integer)
|
||||||
|
))\b
|
||||||
|
scope: support.function.static.number.livescript
|
||||||
|
- match: '[\$\w][\w-]*'
|
||||||
|
scope: variable.other.livescript
|
||||||
|
backslash_string:
|
||||||
|
- match: '\\([\\)\s,\};\]])?'
|
||||||
|
captures:
|
||||||
|
0: string.quoted.single.livescript
|
||||||
|
push:
|
||||||
|
- meta_content_scope: string.quoted.single.livescript
|
||||||
|
- match: '([\\)\s,\};\]])'
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.end.livescript
|
||||||
|
pop: true
|
||||||
|
constructor_variable:
|
||||||
|
- match: '([a-zA-Z$_][\w$-]*)(@{2})([a-zA-Z$_][\w$-]*)?'
|
||||||
|
scope: variable.other.readwrite.constructor.livescript
|
||||||
|
double_quoted_string:
|
||||||
|
- match: '"'
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.begin.livescript
|
||||||
|
push:
|
||||||
|
- meta_scope: string.quoted.double.livescript
|
||||||
|
- match: '"'
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.end.livescript
|
||||||
|
pop: true
|
||||||
|
- match: '\\(x[0-9A-Fa-f]{2}|[0-2][0-7]{0,2}|3[0-6][0-7]|37[0-7]?|[4-7][0-7]?|.)'
|
||||||
|
scope: constant.character.escape.livescript
|
||||||
|
- include: interpolated_livescript
|
||||||
|
embedded_comment:
|
||||||
|
- match: (?<!\\)(#).*$\n
|
||||||
|
scope: comment.line.number-sign.livescript
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.comment.livescript
|
||||||
|
embedded_spaced_comment:
|
||||||
|
- match: (?<!\\)(#\s).*$\n
|
||||||
|
scope: comment.line.number-sign.livescript
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.comment.livescript
|
||||||
|
instance_variable:
|
||||||
|
- match: '(?<![$\w\-])(@)'
|
||||||
|
scope: variable.other.readwrite.instance.livescript
|
||||||
|
interpolated_livescript:
|
||||||
|
- match: '\#\{'
|
||||||
|
captures:
|
||||||
|
0: punctuation.section.embedded.livescript
|
||||||
|
push:
|
||||||
|
- meta_scope: source.livescript.embedded.source
|
||||||
|
- match: '\}'
|
||||||
|
captures:
|
||||||
|
0: punctuation.section.embedded.livescript
|
||||||
|
pop: true
|
||||||
|
- include: main
|
||||||
|
- match: '\#'
|
||||||
|
push:
|
||||||
|
- meta_scope: source.livescript.embedded.source.simple
|
||||||
|
- match: ""
|
||||||
|
pop: true
|
||||||
|
- include: main
|
||||||
|
numeric:
|
||||||
|
- match: '(?<![\$@a-zA-Z_])(([0-9]+r[0-9_]+)|((16r|0[xX])[0-9a-fA-F_]+)|([0-9]+(\.[0-9]+[0-9_]*)?(e[+\-]?[0-9_]+)?)[_a-zA-Z0-9]*)'
|
||||||
|
scope: constant.numeric.livescript
|
||||||
|
single_quoted_string:
|
||||||
|
- match: "'"
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.begin.livescript
|
||||||
|
push:
|
||||||
|
- meta_scope: string.quoted.single.livescript
|
||||||
|
- match: "'"
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.end.livescript
|
||||||
|
pop: true
|
||||||
|
- match: '\\(x[0-9A-Fa-f]{2}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)'
|
||||||
|
scope: constant.character.escape.livescript
|
||||||
|
variable_name:
|
||||||
|
- match: '([a-zA-Z\$_][\w$-]*(\.\w+)*)(?!\-)'
|
||||||
|
scope: variable.assignment.livescript
|
||||||
|
captures:
|
||||||
|
1: variable.assignment.livescript
|
1
assets/syntaxes/02_Extra/MediaWiki
vendored
Submodule
1
assets/syntaxes/02_Extra/MediaWiki
vendored
Submodule
Submodule assets/syntaxes/02_Extra/MediaWiki added at 81bf97cace
1
assets/syntaxes/02_Extra/Nim.sublime-syntax
vendored
1
assets/syntaxes/02_Extra/Nim.sublime-syntax
vendored
@@ -5,6 +5,7 @@ name: Nim
|
|||||||
file_extensions:
|
file_extensions:
|
||||||
- nim
|
- nim
|
||||||
- nims
|
- nims
|
||||||
|
- nimble
|
||||||
scope: source.nim
|
scope: source.nim
|
||||||
contexts:
|
contexts:
|
||||||
main:
|
main:
|
||||||
|
2
assets/syntaxes/02_Extra/PowerShell
vendored
2
assets/syntaxes/02_Extra/PowerShell
vendored
Submodule assets/syntaxes/02_Extra/PowerShell updated: 4a0a076661...742f0b5d4b
106
assets/syntaxes/02_Extra/PowerShell.sublime-syntax
vendored
106
assets/syntaxes/02_Extra/PowerShell.sublime-syntax
vendored
@@ -24,7 +24,7 @@ contexts:
|
|||||||
- include: commands
|
- include: commands
|
||||||
- include: commentLine
|
- include: commentLine
|
||||||
- include: variable
|
- include: variable
|
||||||
- include: interpolatedStringContent
|
- include: subexpression
|
||||||
- include: function
|
- include: function
|
||||||
- include: attribute
|
- include: attribute
|
||||||
- include: UsingDirective
|
- include: UsingDirective
|
||||||
@@ -33,32 +33,38 @@ contexts:
|
|||||||
- include: doubleQuotedString
|
- include: doubleQuotedString
|
||||||
- include: scriptblock
|
- include: scriptblock
|
||||||
- include: doubleQuotedStringEscapes
|
- include: doubleQuotedStringEscapes
|
||||||
- match: (?<!')'
|
- match: '[''\x{2018}-\x{201B}]'
|
||||||
captures:
|
captures:
|
||||||
0: punctuation.definition.string.begin.powershell
|
0: punctuation.definition.string.begin.powershell
|
||||||
push:
|
push:
|
||||||
- meta_scope: string.quoted.single.powershell
|
- meta_scope: string.quoted.single.powershell
|
||||||
- match: "'(?!')"
|
- match: '[''\x{2018}-\x{201B}]{2}'
|
||||||
|
scope: constant.character.escape.powershell
|
||||||
|
- match: '[''\x{2018}-\x{201B}]'
|
||||||
captures:
|
captures:
|
||||||
0: punctuation.definition.string.end.powershell
|
0: punctuation.definition.string.end.powershell
|
||||||
pop: true
|
pop: true
|
||||||
- match: "''"
|
- match: '(@["\x{201C}-\x{201E}])\s*$'
|
||||||
scope: constant.character.escape.powershell
|
captures:
|
||||||
- match: \@"(?=$)
|
1: punctuation.definition.string.begin.powershell
|
||||||
push:
|
push:
|
||||||
- meta_scope: string.quoted.double.heredoc.powershell
|
- meta_scope: string.quoted.double.heredoc.powershell
|
||||||
- match: ^"@
|
- match: '^["\x{201C}-\x{201E}]@'
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.end.powershell
|
||||||
pop: true
|
pop: true
|
||||||
- include: variableNoProperty
|
- include: variableNoProperty
|
||||||
- include: doubleQuotedStringEscapes
|
- include: doubleQuotedStringEscapes
|
||||||
- include: interpolation
|
- include: interpolation
|
||||||
- match: \@'(?=$)
|
- match: '(@[''\x{2018}-\x{201B}])\s*$'
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.string.begin.powershell
|
||||||
push:
|
push:
|
||||||
- meta_scope: string.quoted.single.heredoc.powershell
|
- meta_scope: string.quoted.single.heredoc.powershell
|
||||||
- match: ^'@
|
- match: '^[''\x{2018}-\x{201B}]@'
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.end.powershell
|
||||||
pop: true
|
pop: true
|
||||||
- match: "''"
|
|
||||||
scope: constant.character.escape.powershell
|
|
||||||
- include: numericConstant
|
- include: numericConstant
|
||||||
- match: (@)(\()
|
- match: (@)(\()
|
||||||
captures:
|
captures:
|
||||||
@@ -71,11 +77,12 @@ contexts:
|
|||||||
0: punctuation.section.group.end.powershell
|
0: punctuation.section.group.end.powershell
|
||||||
pop: true
|
pop: true
|
||||||
- include: main
|
- include: main
|
||||||
- match: (\$)(\()
|
- match: ((\$))(\()
|
||||||
comment: "TODO: move to repo; make recursive."
|
comment: "TODO: move to repo; make recursive."
|
||||||
captures:
|
captures:
|
||||||
1: punctuation.definition.variable.powershell
|
1: keyword.other.substatement.powershell
|
||||||
2: punctuation.section.group.begin.powershell
|
2: punctuation.definition.subexpression.powershell
|
||||||
|
3: punctuation.section.group.begin.powershell
|
||||||
push:
|
push:
|
||||||
- meta_scope: meta.group.complex.subexpression.powershell
|
- meta_scope: meta.group.complex.subexpression.powershell
|
||||||
- match: \)
|
- match: \)
|
||||||
@@ -85,7 +92,7 @@ contexts:
|
|||||||
- include: main
|
- include: main
|
||||||
- match: '(\b(([A-Za-z0-9\-_\.]+)\.(?i:exe|com|cmd|bat))\b)'
|
- match: '(\b(([A-Za-z0-9\-_\.]+)\.(?i:exe|com|cmd|bat))\b)'
|
||||||
scope: support.function.powershell
|
scope: support.function.powershell
|
||||||
- match: (?<!\w|-|\.)((?i:begin|break|catch|continue|data|default|define|do|dynamicparam|else|elseif|end|exit|finally|for|from|if|in|inlinescript|parallel|param|process|return|sequence|switch|throw|trap|try|until|var|while)|%|\?)(?!\w)
|
- match: (?<!\w|-|\.)((?i:begin|break|catch|clean|continue|data|default|define|do|dynamicparam|else|elseif|end|exit|finally|for|from|if|in|inlinescript|parallel|param|process|return|sequence|switch|throw|trap|try|until|var|while)|%|\?)(?!\w)
|
||||||
scope: keyword.control.powershell
|
scope: keyword.control.powershell
|
||||||
- match: '(?<!\w|-|[^\)]\.)((?i:(foreach|where)(?!-object))|%|\?)(?!\w)'
|
- match: '(?<!\w|-|[^\)]\.)((?i:(foreach|where)(?!-object))|%|\?)(?!\w)'
|
||||||
scope: keyword.control.powershell
|
scope: keyword.control.powershell
|
||||||
@@ -135,7 +142,7 @@ contexts:
|
|||||||
- meta_scope: meta.requires.powershell
|
- meta_scope: meta.requires.powershell
|
||||||
- match: $
|
- match: $
|
||||||
pop: true
|
pop: true
|
||||||
- match: \-(?i:Modules|PSSnapin|RunAsAdministrator|ShellId|Version)
|
- match: \-(?i:Modules|PSSnapin|RunAsAdministrator|ShellId|Version|Assembly|PSEdition)
|
||||||
scope: keyword.other.powershell
|
scope: keyword.other.powershell
|
||||||
- match: '(?<!-)\b\p{L}+|\d+(?:\.\d+)*'
|
- match: '(?<!-)\b\p{L}+|\d+(?:\.\d+)*'
|
||||||
scope: variable.parameter.powershell
|
scope: variable.parameter.powershell
|
||||||
@@ -187,51 +194,53 @@ contexts:
|
|||||||
comment: Builtin cmdlets with reserved verbs
|
comment: Builtin cmdlets with reserved verbs
|
||||||
scope: support.function.powershell
|
scope: support.function.powershell
|
||||||
commentEmbeddedDocs:
|
commentEmbeddedDocs:
|
||||||
- match: ^(?i:(?:\s?|#)+(\.)(COMPONENT|DESCRIPTION|EXAMPLE|EXTERNALHELP|FORWARDHELPCATEGORY|FORWARDHELPTARGETNAME|FUNCTIONALITY|INPUTS|LINK|NOTES|OUTPUTS|REMOTEHELPRUNSPACE|ROLE|SYNOPSIS))
|
- match: (?:^|\G)(?i:\s*(\.)(COMPONENT|DESCRIPTION|EXAMPLE|FUNCTIONALITY|INPUTS|LINK|NOTES|OUTPUTS|ROLE|SYNOPSIS))\s*$
|
||||||
|
comment: these embedded doc keywords do not support arguments, must be the only thing on the line
|
||||||
scope: comment.documentation.embedded.powershell
|
scope: comment.documentation.embedded.powershell
|
||||||
captures:
|
captures:
|
||||||
1: constant.string.documentation.powershell
|
1: constant.string.documentation.powershell
|
||||||
2: keyword.operator.documentation.powershell
|
2: keyword.operator.documentation.powershell
|
||||||
- match: '(?i:\s?(\.)(PARAMETER|FORWARDHELPTARGETNAME|FORWARDHELPCATEGORY|REMOTEHELPRUNSPACE|EXTERNALHELP)\s+([a-z0-9-_]+))'
|
- match: (?:^|\G)(?i:\s*(\.)(EXTERNALHELP|FORWARDHELP(?:CATEGORY|TARGETNAME)|PARAMETER|REMOTEHELPRUNSPACE))\s+(.+?)\s*$
|
||||||
|
comment: these embedded doc keywords require arguments though the type required may be inconsistent, they may not all be able to use the same argument match
|
||||||
scope: comment.documentation.embedded.powershell
|
scope: comment.documentation.embedded.powershell
|
||||||
captures:
|
captures:
|
||||||
1: constant.string.documentation.powershell
|
1: constant.string.documentation.powershell
|
||||||
2: keyword.operator.documentation.powershell
|
2: keyword.operator.documentation.powershell
|
||||||
3: keyword.operator.documentation.powershell
|
3: keyword.operator.documentation.powershell
|
||||||
commentLine:
|
commentLine:
|
||||||
- match: '(?<![`\\-])#'
|
- match: '(?<![`\\-])(#)#*'
|
||||||
captures:
|
captures:
|
||||||
0: punctuation.definition.comment.powershell
|
1: punctuation.definition.comment.powershell
|
||||||
push:
|
push:
|
||||||
- meta_scope: comment.line.powershell
|
- meta_scope: comment.line.powershell
|
||||||
- match: $\n?
|
- match: $\n?
|
||||||
captures:
|
captures:
|
||||||
0: punctuation.definition.comment.powershell
|
1: punctuation.definition.comment.powershell
|
||||||
pop: true
|
pop: true
|
||||||
- include: commentEmbeddedDocs
|
- include: commentEmbeddedDocs
|
||||||
- include: RequiresDirective
|
- include: RequiresDirective
|
||||||
doubleQuotedString:
|
doubleQuotedString:
|
||||||
- match: (?<!(?<!`)")"
|
- match: '["\x{201C}-\x{201E}]'
|
||||||
captures:
|
captures:
|
||||||
0: punctuation.definition.string.begin.powershell
|
0: punctuation.definition.string.begin.powershell
|
||||||
push:
|
push:
|
||||||
- meta_scope: string.quoted.double.powershell
|
- meta_scope: string.quoted.double.powershell
|
||||||
- match: '"(?!")'
|
|
||||||
captures:
|
|
||||||
0: punctuation.definition.string.end.powershell
|
|
||||||
pop: true
|
|
||||||
- match: '(?i)\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,64}\b'
|
- match: '(?i)\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,64}\b'
|
||||||
- include: variableNoProperty
|
- include: variableNoProperty
|
||||||
- include: doubleQuotedStringEscapes
|
- include: doubleQuotedStringEscapes
|
||||||
|
- match: '["\x{201C}-\x{201E}]{2}'
|
||||||
|
scope: constant.character.escape.powershell
|
||||||
- include: interpolation
|
- include: interpolation
|
||||||
- match: '`\s*$'
|
- match: '`\s*$'
|
||||||
scope: keyword.other.powershell
|
scope: keyword.other.powershell
|
||||||
|
- match: '["\x{201C}-\x{201E}]'
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.end.powershell
|
||||||
|
pop: true
|
||||||
doubleQuotedStringEscapes:
|
doubleQuotedStringEscapes:
|
||||||
- match: '`[`0abefnrtv"''$]'
|
- match: '`[`0abefnrtv''"\x{2018}-\x{201E}$]'
|
||||||
scope: constant.character.escape.powershell
|
scope: constant.character.escape.powershell
|
||||||
- include: unicodeEscape
|
- include: unicodeEscape
|
||||||
- match: '""'
|
|
||||||
scope: constant.character.escape.powershell
|
|
||||||
function:
|
function:
|
||||||
- match: '^(?:\s*+)(?i)(function|filter|configuration|workflow)\s+(?:(global|local|script|private):)?((?:\p{L}|\d|_|-|\.)+)'
|
- match: '^(?:\s*+)(?i)(function|filter|configuration|workflow)\s+(?:(global|local|script|private):)?((?:\p{L}|\d|_|-|\.)+)'
|
||||||
captures:
|
captures:
|
||||||
@@ -263,33 +272,23 @@ contexts:
|
|||||||
4: keyword.operator.assignment.powershell
|
4: keyword.operator.assignment.powershell
|
||||||
- include: scriptblock
|
- include: scriptblock
|
||||||
- include: main
|
- include: main
|
||||||
interpolatedStringContent:
|
|
||||||
- match: \(
|
|
||||||
captures:
|
|
||||||
0: punctuation.section.group.begin.powershell
|
|
||||||
push:
|
|
||||||
- meta_content_scope: interpolated.simple.source.powershell
|
|
||||||
- match: \)
|
|
||||||
captures:
|
|
||||||
0: punctuation.section.group.end.powershell
|
|
||||||
pop: true
|
|
||||||
- include: main
|
|
||||||
- include: interpolation
|
|
||||||
- include: interpolatedStringContent
|
|
||||||
interpolation:
|
interpolation:
|
||||||
- match: (\$)(\()
|
- match: (((\$)))((\())
|
||||||
captures:
|
captures:
|
||||||
1: punctuation.definition.variable.powershell
|
1: keyword.other.substatement.powershell
|
||||||
2: punctuation.section.group.begin.powershell
|
2: punctuation.definition.substatement.powershell
|
||||||
|
3: punctuation.section.embedded.substatement.begin.powershell
|
||||||
|
4: punctuation.section.group.begin.powershell
|
||||||
|
5: punctuation.section.embedded.substatement.begin.powershell
|
||||||
push:
|
push:
|
||||||
|
- meta_scope: meta.embedded.substatement.powershell
|
||||||
- meta_content_scope: interpolated.complex.source.powershell
|
- meta_content_scope: interpolated.complex.source.powershell
|
||||||
- match: \)
|
- match: (\))
|
||||||
captures:
|
captures:
|
||||||
0: punctuation.section.group.end.powershell
|
0: punctuation.section.group.end.powershell
|
||||||
|
1: punctuation.section.embedded.substatement.end.powershell
|
||||||
pop: true
|
pop: true
|
||||||
- include: main
|
- include: main
|
||||||
- include: interpolation
|
|
||||||
- include: interpolatedStringContent
|
|
||||||
numericConstant:
|
numericConstant:
|
||||||
- match: '(?<!\w)([-+]?0(?:x|X)[0-9a-fA-F_]+(?:U|u|L|l|UL|Ul|uL|ul|LU|Lu|lU|lu)?)((?i:[kmgtp]b)?)\b'
|
- match: '(?<!\w)([-+]?0(?:x|X)[0-9a-fA-F_]+(?:U|u|L|l|UL|Ul|uL|ul|LU|Lu|lU|lu)?)((?i:[kmgtp]b)?)\b'
|
||||||
captures:
|
captures:
|
||||||
@@ -330,6 +329,17 @@ contexts:
|
|||||||
0: punctuation.section.braces.end.powershell
|
0: punctuation.section.braces.end.powershell
|
||||||
pop: true
|
pop: true
|
||||||
- include: main
|
- include: main
|
||||||
|
subexpression:
|
||||||
|
- match: \(
|
||||||
|
captures:
|
||||||
|
0: punctuation.section.group.begin.powershell
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.group.simple.subexpression.powershell
|
||||||
|
- match: \)
|
||||||
|
captures:
|
||||||
|
0: punctuation.section.group.end.powershell
|
||||||
|
pop: true
|
||||||
|
- include: main
|
||||||
type:
|
type:
|
||||||
- match: '\['
|
- match: '\['
|
||||||
captures:
|
captures:
|
||||||
|
1
assets/syntaxes/02_Extra/Racket
vendored
Submodule
1
assets/syntaxes/02_Extra/Racket
vendored
Submodule
Submodule assets/syntaxes/02_Extra/Racket added at 7df4479c07
52
assets/syntaxes/02_Extra/Racket.sublime-syntax
vendored
Normal file
52
assets/syntaxes/02_Extra/Racket.sublime-syntax
vendored
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
# http://www.sublimetext.com/docs/3/syntax.html
|
||||||
|
name: Racket
|
||||||
|
file_extensions:
|
||||||
|
- rkt
|
||||||
|
scope: source.racket
|
||||||
|
contexts:
|
||||||
|
main:
|
||||||
|
- match: '[^\\](\"[^\"]*\")'
|
||||||
|
captures:
|
||||||
|
1: string.quoted.double.source.racket
|
||||||
|
- match: '\((define)\s+([a-zA-Z0-9_\-?\+^]+)\s*'
|
||||||
|
scope: meta.variable.source.racket
|
||||||
|
captures:
|
||||||
|
1: keyword.source.racket
|
||||||
|
2: entity.name.variable.source.racket
|
||||||
|
- match: '\((define)\s+\(([a-zA-Z0-9_\-?\+^]+)\s*'
|
||||||
|
scope: meta.function.source.racket
|
||||||
|
captures:
|
||||||
|
1: keyword.source.racket
|
||||||
|
2: entity.name.function
|
||||||
|
- match: '\((struct)\s+([a-zA-Z0-9_\-?\+^]+)\s+'
|
||||||
|
scope: meta.struct.source.racket
|
||||||
|
captures:
|
||||||
|
1: keyword.source.racket
|
||||||
|
2: entity.name.type
|
||||||
|
- match: '[\s\(](if|lambda|cond|define|type-case|let|letrec|let!|\#lang|require|test|else|first|rest|define-type|define-type-alias|define-struct|not|local|error|lang)[\s\)]'
|
||||||
|
scope: meta.keywords.source.racket
|
||||||
|
captures:
|
||||||
|
1: keyword.source.racket
|
||||||
|
- match: '[\s\(](true|false|empty|null)[\s\)]'
|
||||||
|
captures:
|
||||||
|
1: constant.language.source.racket
|
||||||
|
- match: '[\s\(\[\{](#t|#true|#f|#false)[\s\)\]\}]'
|
||||||
|
captures:
|
||||||
|
1: constant.language.source.racket
|
||||||
|
- match: '(#\\[a-zA-Z0-9_\-?\+\.\!\"]+)'
|
||||||
|
captures:
|
||||||
|
1: constant.language.source.racket
|
||||||
|
- match: '\b(0|([1-9][0-9_]*))\b'
|
||||||
|
scope: constant.numeric.integer.source.racket
|
||||||
|
- match: ;
|
||||||
|
push:
|
||||||
|
- meta_scope: comment.line.documentation.source.racket
|
||||||
|
- match: $\n
|
||||||
|
pop: true
|
||||||
|
- match: '#\|'
|
||||||
|
push:
|
||||||
|
- meta_scope: comment.block.source.racket
|
||||||
|
- match: '\|#'
|
||||||
|
pop: true
|
2
assets/syntaxes/02_Extra/SCSS_Sass
vendored
2
assets/syntaxes/02_Extra/SCSS_Sass
vendored
Submodule assets/syntaxes/02_Extra/SCSS_Sass updated: 4868322030...d3d9404640
1
assets/syntaxes/02_Extra/Slim
vendored
Submodule
1
assets/syntaxes/02_Extra/Slim
vendored
Submodule
Submodule assets/syntaxes/02_Extra/Slim added at 3b1441f89f
306
assets/syntaxes/02_Extra/Slim.sublime-syntax
vendored
Normal file
306
assets/syntaxes/02_Extra/Slim.sublime-syntax
vendored
Normal file
@@ -0,0 +1,306 @@
|
|||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
# http://www.sublimetext.com/docs/syntax.html
|
||||||
|
name: Ruby Slim
|
||||||
|
file_extensions:
|
||||||
|
- slim
|
||||||
|
- skim
|
||||||
|
scope: text.slim
|
||||||
|
contexts:
|
||||||
|
main:
|
||||||
|
- match: ^(\s*)(ruby):$
|
||||||
|
captures:
|
||||||
|
2: constant.language.name.ruby.filter.slim
|
||||||
|
push:
|
||||||
|
- meta_scope: text.ruby.filter.slim
|
||||||
|
- match: ^(?!(\1\s)|\s*$)
|
||||||
|
pop: true
|
||||||
|
- include: scope:source.ruby
|
||||||
|
- match: ^(\s*)(javascript):$
|
||||||
|
captures:
|
||||||
|
2: constant.language.name.javascript.filter.slim
|
||||||
|
push:
|
||||||
|
- meta_scope: source.js.filter.slim
|
||||||
|
- match: ^(?!(\1\s)|\s*$)
|
||||||
|
pop: true
|
||||||
|
- include: scope:source.js
|
||||||
|
- match: ^(---)\s*\n
|
||||||
|
captures:
|
||||||
|
1: storage.frontmatter.slim
|
||||||
|
push:
|
||||||
|
- meta_scope: source.yaml.meta.slim
|
||||||
|
- match: ^(---)\s*\n
|
||||||
|
captures:
|
||||||
|
1: storage.frontmatter.slim
|
||||||
|
pop: true
|
||||||
|
- include: scope:source.yaml
|
||||||
|
- match: ^(\s*)(coffee):$
|
||||||
|
captures:
|
||||||
|
2: constant.language.name.coffeescript.filter.slim
|
||||||
|
push:
|
||||||
|
- meta_scope: text.coffeescript.filter.slim
|
||||||
|
- match: ^(?!(\1\s)|\s*$)
|
||||||
|
pop: true
|
||||||
|
- include: scope:source.coffee
|
||||||
|
- match: ^(\s*)(markdown):$
|
||||||
|
captures:
|
||||||
|
2: constant.language.name.markdown.filter.slim
|
||||||
|
push:
|
||||||
|
- meta_scope: text.markdown.filter.slim
|
||||||
|
- match: ^(?!(\1\s)|\s*$)
|
||||||
|
pop: true
|
||||||
|
- include: scope:text.html.markdown
|
||||||
|
- match: ^(\s*)(css):$
|
||||||
|
captures:
|
||||||
|
2: constant.language.name.css.filter.slim
|
||||||
|
push:
|
||||||
|
- meta_scope: text.css.filter.slim
|
||||||
|
- match: ^(?!(\1\s)|\s*$)
|
||||||
|
pop: true
|
||||||
|
- include: scope:source.css
|
||||||
|
- match: ^(\s*)(sass):$
|
||||||
|
captures:
|
||||||
|
2: constant.language.name.sass.filter.slim
|
||||||
|
push:
|
||||||
|
- meta_scope: text.sass.filter.slim
|
||||||
|
- match: ^(?!(\1\s)|\s*$)
|
||||||
|
pop: true
|
||||||
|
- include: scope:source.sass
|
||||||
|
- match: ^(\s*)(scss):$
|
||||||
|
captures:
|
||||||
|
2: constant.language.name.scss.filter.slim
|
||||||
|
push:
|
||||||
|
- meta_scope: text.scss.filter.slim
|
||||||
|
- match: ^(?!(\1\s)|\s*$)
|
||||||
|
pop: true
|
||||||
|
- include: scope:source.scss
|
||||||
|
- match: ^(\s*)(less):$
|
||||||
|
captures:
|
||||||
|
2: constant.language.name.less.filter.slim
|
||||||
|
push:
|
||||||
|
- meta_scope: text.less.filter.slim
|
||||||
|
- match: ^(?!(\1\s)|\s*$)
|
||||||
|
pop: true
|
||||||
|
- include: scope:source.less
|
||||||
|
- match: ^(\s*)(erb):$
|
||||||
|
captures:
|
||||||
|
2: constant.language.name.erb.filter.slim
|
||||||
|
push:
|
||||||
|
- meta_scope: text.erb.filter.slim
|
||||||
|
- match: ^(?!(\1\s)|\s*$)
|
||||||
|
pop: true
|
||||||
|
- include: scope:source.erb
|
||||||
|
- match: ^(! )($|\s.*)
|
||||||
|
scope: meta.prolog.slim
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.prolog.slim
|
||||||
|
- match: ^(\s*)(/)\s*.*$
|
||||||
|
captures:
|
||||||
|
2: comment.line.slash.slim
|
||||||
|
push:
|
||||||
|
- meta_scope: comment.block.slim
|
||||||
|
- match: ^(?!(\1\s)|\s*$)
|
||||||
|
pop: true
|
||||||
|
- match: ^\s*(?=-)
|
||||||
|
push:
|
||||||
|
- match: $
|
||||||
|
pop: true
|
||||||
|
- include: rubyline
|
||||||
|
- match: (?==+|~)
|
||||||
|
push:
|
||||||
|
- match: $
|
||||||
|
pop: true
|
||||||
|
- include: rubyline
|
||||||
|
- include: tag-attribute
|
||||||
|
- include: embedded-ruby
|
||||||
|
- match: ^(\s*)(\||')\s*
|
||||||
|
comment: Verbatim text (can include HTML tags and copied lines)
|
||||||
|
push:
|
||||||
|
- match: ^(?!(\1\s)|\s*$)
|
||||||
|
pop: true
|
||||||
|
- include: scope:text.html.basic
|
||||||
|
- include: embedded-ruby
|
||||||
|
- match: '^\s*(\.|#|[-a-zA-Z0-9]+)([\w-]+)?'
|
||||||
|
comment: '1 - dot OR hash OR any combination of word, number; 2 - OPTIONAL any combination of word, number, dash or underscore (following a . or'
|
||||||
|
captures:
|
||||||
|
1: entity.name.tag.slim
|
||||||
|
2: entity.other.attribute-name.event.slim
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.tag
|
||||||
|
- match: '$|(?!\.|#|:|-|~|/|\}|\]|\*|\s?[\*\{])'
|
||||||
|
captures:
|
||||||
|
1: entity.name.tag.slim
|
||||||
|
2: entity.other.attribute-name.event.slim
|
||||||
|
pop: true
|
||||||
|
- match: '(:[\w\d]+)+'
|
||||||
|
comment: XML
|
||||||
|
push:
|
||||||
|
- meta_scope: entity.name.tag.slim
|
||||||
|
- match: $|\s
|
||||||
|
pop: true
|
||||||
|
- match: '(:\s)(\.|#|[a-zA-Z0-9]+)([\w-]+)?'
|
||||||
|
comment: Inline HTML / 1 - colon; 2 - dot OR hash OR any combination of word, number; 3 - OPTIONAL any combination of word, number, dash or underscore (following a . or
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.tag.end.slim
|
||||||
|
2: entity.name.tag.slim
|
||||||
|
3: entity.other.attribute-name.event.slim
|
||||||
|
push:
|
||||||
|
- match: '$|(?!\.|#|=|-|~|/|\}|\]|\*|\s?[\*\{])'
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.tag.end.slim
|
||||||
|
2: entity.name.tag.slim
|
||||||
|
3: entity.other.attribute-name.event.slim
|
||||||
|
pop: true
|
||||||
|
- include: root-class-id-tag
|
||||||
|
- include: tag-attribute
|
||||||
|
- match: '(\*\{)(?=.*\}|.*\|\s*$)'
|
||||||
|
comment: Splat attributes
|
||||||
|
captures:
|
||||||
|
1: punctuation.section.embedded.ruby
|
||||||
|
push:
|
||||||
|
- meta_scope: source.ruby.embedded.slim
|
||||||
|
- match: '(\})|$|^(?!.*\|\s*$)'
|
||||||
|
captures:
|
||||||
|
1: punctuation.section.embedded.ruby
|
||||||
|
pop: true
|
||||||
|
- include: embedded-ruby
|
||||||
|
- include: root-class-id-tag
|
||||||
|
- include: rubyline
|
||||||
|
- match: /
|
||||||
|
scope: punctuation.terminator.tag.slim
|
||||||
|
- match: ^\s*(\\.)
|
||||||
|
captures:
|
||||||
|
1: meta.escape.slim
|
||||||
|
- match: ^\s*(?=\||')
|
||||||
|
push:
|
||||||
|
- match: $
|
||||||
|
pop: true
|
||||||
|
- include: embedded-ruby
|
||||||
|
- include: scope:text.html.basic
|
||||||
|
- match: '(?=<[\w\d\:]+)'
|
||||||
|
comment: Inline and root-level HTML tags
|
||||||
|
push:
|
||||||
|
- match: $|\/\>
|
||||||
|
pop: true
|
||||||
|
- include: scope:text.html.basic
|
||||||
|
continuation:
|
||||||
|
- match: '([\\,])\s*\n'
|
||||||
|
captures:
|
||||||
|
1: punctuation.separator.continuation.slim
|
||||||
|
delimited-ruby-a:
|
||||||
|
- match: '=\('
|
||||||
|
push:
|
||||||
|
- meta_scope: source.ruby.embedded.slim
|
||||||
|
- match: \)(?=( \w|$))
|
||||||
|
pop: true
|
||||||
|
- include: scope:source.ruby.rails
|
||||||
|
delimited-ruby-b:
|
||||||
|
- match: '=\['
|
||||||
|
push:
|
||||||
|
- meta_scope: source.ruby.embedded.slim
|
||||||
|
- match: '\](?=( \w|$))'
|
||||||
|
pop: true
|
||||||
|
- include: scope:source.ruby.rails
|
||||||
|
delimited-ruby-c:
|
||||||
|
- match: '=\{'
|
||||||
|
push:
|
||||||
|
- meta_scope: source.ruby.embedded.slim
|
||||||
|
- match: '\}(?=( \w|$))'
|
||||||
|
pop: true
|
||||||
|
- include: scope:source.ruby.rails
|
||||||
|
embedded-ruby:
|
||||||
|
- match: '(?<!\\)#\{{1,2}'
|
||||||
|
captures:
|
||||||
|
0: punctuation.section.embedded.ruby
|
||||||
|
push:
|
||||||
|
- meta_scope: source.ruby.embedded.html
|
||||||
|
- match: '\}{1,2}'
|
||||||
|
captures:
|
||||||
|
0: punctuation.section.embedded.ruby
|
||||||
|
pop: true
|
||||||
|
- include: scope:source.ruby.rails
|
||||||
|
entities:
|
||||||
|
- match: '(&)([a-zA-Z0-9]+|#[0-9]+|#x[0-9a-fA-F]+)(;)'
|
||||||
|
scope: constant.character.entity.html
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.entity.html
|
||||||
|
3: punctuation.definition.entity.html
|
||||||
|
- match: '&'
|
||||||
|
scope: invalid.illegal.bad-ampersand.html
|
||||||
|
interpolated-ruby:
|
||||||
|
- match: '=(?=\b)'
|
||||||
|
push:
|
||||||
|
- meta_scope: source.ruby.embedded.html
|
||||||
|
- match: \s|\w$
|
||||||
|
pop: true
|
||||||
|
root-class-id-tag:
|
||||||
|
- match: '(\.|#)([\w\d\-]+)'
|
||||||
|
captures:
|
||||||
|
1: punctuation.separator.key-value.html
|
||||||
|
2: entity.other.attribute-name.html
|
||||||
|
rubyline:
|
||||||
|
- match: (==|=)(<>|><|<'|'<|<|>)?|-
|
||||||
|
comment: Hack to thwart Sublime's Ruby highlighter. It thinks do without a variable continues the next line (this can be muted with a / at the end of the line). For things like yields, do is unnecessary without an argument, so this hack will suffice
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.line.ruby.slim
|
||||||
|
- meta_content_scope: source.ruby.embedded.slim
|
||||||
|
- match: (do\s*\n$)|(?<!\\|,|,\n|\\\n)$
|
||||||
|
captures:
|
||||||
|
1: keyword.control.start-block.ruby
|
||||||
|
pop: true
|
||||||
|
- match: '#.*$'
|
||||||
|
comment: Hack to let ruby comments work in this context properly
|
||||||
|
scope: comment.line.number-sign.ruby
|
||||||
|
- include: continuation
|
||||||
|
- include: scope:source.ruby.rails
|
||||||
|
string-double-quoted:
|
||||||
|
- match: (")(?=.*")
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.begin.html
|
||||||
|
push:
|
||||||
|
- meta_scope: string.quoted.double.html
|
||||||
|
- meta_content_scope: meta.toc-list.id.html
|
||||||
|
- match: '"'
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.end.html
|
||||||
|
pop: true
|
||||||
|
- include: embedded-ruby
|
||||||
|
- include: entities
|
||||||
|
string-single-quoted:
|
||||||
|
- match: (')(?=.*')
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.begin.html
|
||||||
|
push:
|
||||||
|
- meta_scope: string.quoted.single.html
|
||||||
|
- meta_content_scope: meta.toc-list.id.html
|
||||||
|
- match: "'"
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.end.html
|
||||||
|
pop: true
|
||||||
|
- include: embedded-ruby
|
||||||
|
- include: entities
|
||||||
|
tag-attribute:
|
||||||
|
- match: '([\w.#_-]+)(=)(?!\s)(true|false|nil)?(\s*\(|\{)?'
|
||||||
|
captures:
|
||||||
|
1: entity.other.attribute-name.event.slim
|
||||||
|
2: punctuation.separator.key-value.html
|
||||||
|
3: constant.language.slim
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.attribute-with-value.slim
|
||||||
|
- match: '\}|\)|$'
|
||||||
|
captures:
|
||||||
|
1: entity.other.attribute-name.event.slim
|
||||||
|
2: punctuation.separator.key-value.html
|
||||||
|
3: constant.language.slim
|
||||||
|
pop: true
|
||||||
|
- include: tag-stuff
|
||||||
|
- include: string-double-quoted
|
||||||
|
- include: string-single-quoted
|
||||||
|
tag-stuff:
|
||||||
|
- include: tag-attribute
|
||||||
|
- include: interpolated-ruby
|
||||||
|
- include: delimited-ruby-a
|
||||||
|
- include: delimited-ruby-b
|
||||||
|
- include: delimited-ruby-c
|
||||||
|
- include: rubyline
|
||||||
|
- include: embedded-ruby
|
@@ -197,7 +197,7 @@ contexts:
|
|||||||
scope: entity.other.attribute-name.stylus
|
scope: entity.other.attribute-name.stylus
|
||||||
- match: |-
|
- match: |-
|
||||||
(?x) # multi-line regex definition mode
|
(?x) # multi-line regex definition mode
|
||||||
(?<=^|;|{)\s* # starts after begining of line, '{' or ';''
|
(?<=^|;|{)\s* # starts after beginning of line, '{' or ';''
|
||||||
(?= # lookahead for
|
(?= # lookahead for
|
||||||
(
|
(
|
||||||
[a-zA-Z0-9_-] # then a letter
|
[a-zA-Z0-9_-] # then a letter
|
||||||
@@ -207,7 +207,7 @@ contexts:
|
|||||||
(/\*.*?\*/) # comment
|
(/\*.*?\*/) # comment
|
||||||
)+
|
)+
|
||||||
|
|
||||||
\s*[:\s]\s* # value is separted by colon or space
|
\s*[:\s]\s* # value is separated by colon or space
|
||||||
|
|
||||||
(?!(\s*\{)) # if there are only spaces afterwards
|
(?!(\s*\{)) # if there are only spaces afterwards
|
||||||
|
|
||||||
|
1
assets/syntaxes/02_Extra/SublimeEthereum
vendored
Submodule
1
assets/syntaxes/02_Extra/SublimeEthereum
vendored
Submodule
Submodule assets/syntaxes/02_Extra/SublimeEthereum added at b60e0a3e00
1
assets/syntaxes/02_Extra/Syslog
vendored
1
assets/syntaxes/02_Extra/Syslog
vendored
Submodule assets/syntaxes/02_Extra/Syslog deleted from 7628d4e0b8
1
assets/syntaxes/02_Extra/SystemVerilog
vendored
Submodule
1
assets/syntaxes/02_Extra/SystemVerilog
vendored
Submodule
Submodule assets/syntaxes/02_Extra/SystemVerilog added at 7eca705e87
2
assets/syntaxes/02_Extra/TOML
vendored
2
assets/syntaxes/02_Extra/TOML
vendored
Submodule assets/syntaxes/02_Extra/TOML updated: 0f14b7caf3...ed38438900
2
assets/syntaxes/02_Extra/TypeScript
vendored
2
assets/syntaxes/02_Extra/TypeScript
vendored
Submodule assets/syntaxes/02_Extra/TypeScript updated: a607ddfec9...ba45efd058
384
assets/syntaxes/02_Extra/TypeScript.sublime-syntax
vendored
384
assets/syntaxes/02_Extra/TypeScript.sublime-syntax
vendored
@@ -44,7 +44,7 @@ contexts:
|
|||||||
- match: (?=$)
|
- match: (?=$)
|
||||||
pop: true
|
pop: true
|
||||||
access-modifier:
|
access-modifier:
|
||||||
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(abstract|public|protected|private|readonly|static|declare)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
|
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(abstract|declare|override|public|protected|private|readonly|static)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
|
||||||
scope: storage.modifier.ts
|
scope: storage.modifier.ts
|
||||||
after-operator-block-as-object-literal:
|
after-operator-block-as-object-literal:
|
||||||
- match: '(?<!\+\+|--)(?<=[:=(,\[?+!>]|^await|[^\._$[:alnum:]]await|^return|[^\._$[:alnum:]]return|^yield|[^\._$[:alnum:]]yield|^throw|[^\._$[:alnum:]]throw|^in|[^\._$[:alnum:]]in|^of|[^\._$[:alnum:]]of|^typeof|[^\._$[:alnum:]]typeof|&&|\|\||\*)\s*(\{)'
|
- match: '(?<!\+\+|--)(?<=[:=(,\[?+!>]|^await|[^\._$[:alnum:]]await|^return|[^\._$[:alnum:]]return|^yield|[^\._$[:alnum:]]yield|^throw|[^\._$[:alnum:]]throw|^in|[^\._$[:alnum:]]in|^of|[^\._$[:alnum:]]of|^typeof|[^\._$[:alnum:]]typeof|&&|\|\||\*)\s*(\{)'
|
||||||
@@ -106,7 +106,7 @@ contexts:
|
|||||||
(?=
|
(?=
|
||||||
# sure shot arrow functions even if => is on new line
|
# sure shot arrow functions even if => is on new line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
||||||
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
||||||
(
|
(
|
||||||
([)]\s*:) | # ():
|
([)]\s*:) | # ():
|
||||||
@@ -116,9 +116,9 @@ contexts:
|
|||||||
|
|
||||||
# arrow function possible to detect only with => on same line
|
# arrow function possible to detect only with => on same line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||||
\s*=> # arrow operator
|
\s*=> # arrow operator
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -268,7 +268,7 @@ contexts:
|
|||||||
- include: decorator
|
- include: decorator
|
||||||
- match: (?<=:)\s*
|
- match: (?<=:)\s*
|
||||||
push:
|
push:
|
||||||
- match: '(?=\s|[;),}\]:\-\+]|;|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
|
- match: '(?=\s|[;),}\]:\-\+]|;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
|
||||||
pop: true
|
pop: true
|
||||||
- include: expression
|
- include: expression
|
||||||
- include: method-declaration
|
- include: method-declaration
|
||||||
@@ -317,7 +317,12 @@ contexts:
|
|||||||
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(break|continue|do|goto|while)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
|
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(break|continue|do|goto|while)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
|
||||||
scope: keyword.control.loop.ts
|
scope: keyword.control.loop.ts
|
||||||
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(return)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
|
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(return)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
|
||||||
scope: keyword.control.flow.ts
|
captures:
|
||||||
|
0: keyword.control.flow.ts
|
||||||
|
push:
|
||||||
|
- match: '(?=[;}]|$|;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
|
||||||
|
pop: true
|
||||||
|
- include: expression
|
||||||
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(case|default|switch)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
|
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(case|default|switch)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
|
||||||
scope: keyword.control.switch.ts
|
scope: keyword.control.switch.ts
|
||||||
- include: if-statement
|
- include: if-statement
|
||||||
@@ -762,7 +767,7 @@ contexts:
|
|||||||
4: keyword.control.default.ts
|
4: keyword.control.default.ts
|
||||||
push:
|
push:
|
||||||
- meta_scope: meta.export.default.ts
|
- meta_scope: meta.export.default.ts
|
||||||
- match: (?=$|;|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))
|
- match: (?=$|;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))
|
||||||
pop: true
|
pop: true
|
||||||
- include: interface-declaration
|
- include: interface-declaration
|
||||||
- include: expression
|
- include: expression
|
||||||
@@ -772,7 +777,7 @@ contexts:
|
|||||||
2: keyword.control.type.ts
|
2: keyword.control.type.ts
|
||||||
push:
|
push:
|
||||||
- meta_scope: meta.export.ts
|
- meta_scope: meta.export.ts
|
||||||
- match: (?=$|;|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))
|
- match: (?=$|;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))
|
||||||
pop: true
|
pop: true
|
||||||
- include: import-export-declaration
|
- include: import-export-declaration
|
||||||
expression:
|
expression:
|
||||||
@@ -785,11 +790,11 @@ contexts:
|
|||||||
- include: string
|
- include: string
|
||||||
- include: decorator
|
- include: decorator
|
||||||
- include: destructuring-parameter
|
- include: destructuring-parameter
|
||||||
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(public|protected|private|readonly)\s+(?=(public|protected|private|readonly)\s+)'
|
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(override|public|protected|private|readonly)\s+(?=(override|public|protected|private|readonly)\s+)'
|
||||||
captures:
|
captures:
|
||||||
1: storage.modifier.ts
|
1: storage.modifier.ts
|
||||||
- match: |-
|
- match: |-
|
||||||
(?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??)(?=\s*
|
(?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(override|public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??)(?=\s*
|
||||||
# function assignment |
|
# function assignment |
|
||||||
(=\s*(
|
(=\s*(
|
||||||
((async\s+)?(
|
((async\s+)?(
|
||||||
@@ -798,10 +803,10 @@ contexts:
|
|||||||
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
||||||
)) |
|
)) |
|
||||||
((async\s*)?(
|
((async\s*)?(
|
||||||
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
|
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
|
||||||
# sure shot arrow functions even if => is on new line
|
# sure shot arrow functions even if => is on new line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
||||||
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
||||||
(
|
(
|
||||||
([)]\s*:) | # ():
|
([)]\s*:) | # ():
|
||||||
@@ -811,9 +816,9 @@ contexts:
|
|||||||
|
|
||||||
# arrow function possible to detect only with => on same line
|
# arrow function possible to detect only with => on same line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||||
\s*=> # arrow operator
|
\s*=> # arrow operator
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
@@ -831,18 +836,18 @@ contexts:
|
|||||||
))
|
))
|
||||||
)) |
|
)) |
|
||||||
(:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) |
|
(:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) |
|
||||||
(:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) |
|
(:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) |
|
||||||
(:\s*(=>|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
|
(:\s*(=>|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
|
||||||
((async\s+)?(
|
((async\s+)?(
|
||||||
(function\s*[(<*]) |
|
(function\s*[(<*]) |
|
||||||
(function\s+) |
|
(function\s+) |
|
||||||
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
||||||
)) |
|
)) |
|
||||||
((async\s*)?(
|
((async\s*)?(
|
||||||
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
|
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
|
||||||
# sure shot arrow functions even if => is on new line
|
# sure shot arrow functions even if => is on new line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
||||||
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
||||||
(
|
(
|
||||||
([)]\s*:) | # ():
|
([)]\s*:) | # ():
|
||||||
@@ -852,9 +857,9 @@ contexts:
|
|||||||
|
|
||||||
# arrow function possible to detect only with => on same line
|
# arrow function possible to detect only with => on same line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||||
\s*=> # arrow operator
|
\s*=> # arrow operator
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
@@ -865,7 +870,7 @@ contexts:
|
|||||||
3: entity.name.function.ts variable.language.this.ts
|
3: entity.name.function.ts variable.language.this.ts
|
||||||
4: entity.name.function.ts
|
4: entity.name.function.ts
|
||||||
5: keyword.operator.optional.ts
|
5: keyword.operator.optional.ts
|
||||||
- match: '(?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??)(?=\s*[:,]|$)'
|
- match: '(?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(override|public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??)(?=\s*[:,]|$)'
|
||||||
captures:
|
captures:
|
||||||
1: storage.modifier.ts
|
1: storage.modifier.ts
|
||||||
2: keyword.operator.rest.ts
|
2: keyword.operator.rest.ts
|
||||||
@@ -930,10 +935,11 @@ contexts:
|
|||||||
scope: keyword.operator.comparison.ts
|
scope: keyword.operator.comparison.ts
|
||||||
- match: <=|>=|<>|<|>
|
- match: <=|>=|<>|<|>
|
||||||
scope: keyword.operator.relational.ts
|
scope: keyword.operator.relational.ts
|
||||||
- match: '(?<=[_$[:alnum:]])(\!)\s*(/)(?![/*])'
|
- match: '(?<=[_$[:alnum:]])(\!)\s*(?:(/=)|(?:(/)(?![/*])))'
|
||||||
captures:
|
captures:
|
||||||
1: keyword.operator.logical.ts
|
1: keyword.operator.logical.ts
|
||||||
2: keyword.operator.arithmetic.ts
|
2: keyword.operator.assignment.compound.ts
|
||||||
|
3: keyword.operator.arithmetic.ts
|
||||||
- match: \!|&&|\|\||\?\?
|
- match: \!|&&|\|\||\?\?
|
||||||
scope: keyword.operator.logical.ts
|
scope: keyword.operator.logical.ts
|
||||||
- match: \&|~|\^|\|
|
- match: \&|~|\^|\|
|
||||||
@@ -946,16 +952,18 @@ contexts:
|
|||||||
scope: keyword.operator.increment.ts
|
scope: keyword.operator.increment.ts
|
||||||
- match: '%|\*|/|-|\+'
|
- match: '%|\*|/|-|\+'
|
||||||
scope: keyword.operator.arithmetic.ts
|
scope: keyword.operator.arithmetic.ts
|
||||||
- match: '(?<=[_$[:alnum:])\]])\s*(?=(\/\*([^\*]|(\*[^\/]))*\*\/\s*)+(/)(?![/*]))'
|
- match: '(?<=[_$[:alnum:])\]])\s*(?=(\/\*([^\*]|(\*[^\/]))*\*\/\s*)+(?:(/=)|(?:(/)(?![/*]))))'
|
||||||
push:
|
push:
|
||||||
- match: '(/)(?!\*([^\*]|(\*[^\/]))*\*\/)'
|
- match: '(?:(/=)|(?:(/)(?!\*([^\*]|(\*[^\/]))*\*\/)))'
|
||||||
captures:
|
captures:
|
||||||
1: keyword.operator.arithmetic.ts
|
1: keyword.operator.assignment.compound.ts
|
||||||
|
2: keyword.operator.arithmetic.ts
|
||||||
pop: true
|
pop: true
|
||||||
- include: comment
|
- include: comment
|
||||||
- match: '(?<=[_$[:alnum:])\]])\s*(/)(?![/*])'
|
- match: '(?<=[_$[:alnum:])\]])\s*(?:(/=)|(?:(/)(?![/*])))'
|
||||||
captures:
|
captures:
|
||||||
1: keyword.operator.arithmetic.ts
|
1: keyword.operator.assignment.compound.ts
|
||||||
|
2: keyword.operator.arithmetic.ts
|
||||||
expressionPunctuations:
|
expressionPunctuations:
|
||||||
- include: punctuation-comma
|
- include: punctuation-comma
|
||||||
- include: punctuation-accessor
|
- include: punctuation-accessor
|
||||||
@@ -1021,10 +1029,10 @@ contexts:
|
|||||||
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
||||||
)) |
|
)) |
|
||||||
((async\s*)?(
|
((async\s*)?(
|
||||||
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
|
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
|
||||||
# sure shot arrow functions even if => is on new line
|
# sure shot arrow functions even if => is on new line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
||||||
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
||||||
(
|
(
|
||||||
([)]\s*:) | # ():
|
([)]\s*:) | # ():
|
||||||
@@ -1034,9 +1042,9 @@ contexts:
|
|||||||
|
|
||||||
# arrow function possible to detect only with => on same line
|
# arrow function possible to detect only with => on same line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||||
\s*=> # arrow operator
|
\s*=> # arrow operator
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
@@ -1054,18 +1062,18 @@ contexts:
|
|||||||
))
|
))
|
||||||
)) |
|
)) |
|
||||||
(:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) |
|
(:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) |
|
||||||
(:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) |
|
(:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) |
|
||||||
(:\s*(=>|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
|
(:\s*(=>|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
|
||||||
((async\s+)?(
|
((async\s+)?(
|
||||||
(function\s*[(<*]) |
|
(function\s*[(<*]) |
|
||||||
(function\s+) |
|
(function\s+) |
|
||||||
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
||||||
)) |
|
)) |
|
||||||
((async\s*)?(
|
((async\s*)?(
|
||||||
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
|
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
|
||||||
# sure shot arrow functions even if => is on new line
|
# sure shot arrow functions even if => is on new line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
||||||
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
||||||
(
|
(
|
||||||
([)]\s*:) | # ():
|
([)]\s*:) | # ():
|
||||||
@@ -1075,9 +1083,9 @@ contexts:
|
|||||||
|
|
||||||
# arrow function possible to detect only with => on same line
|
# arrow function possible to detect only with => on same line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||||
\s*=> # arrow operator
|
\s*=> # arrow operator
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
@@ -1118,18 +1126,19 @@ contexts:
|
|||||||
- include: type-parameters
|
- include: type-parameters
|
||||||
- include: function-parameters
|
- include: function-parameters
|
||||||
- include: return-type
|
- include: return-type
|
||||||
|
- include: type-function-return-type
|
||||||
- include: decl-block
|
- include: decl-block
|
||||||
- match: \*
|
- match: \*
|
||||||
scope: keyword.generator.asterisk.ts
|
scope: keyword.generator.asterisk.ts
|
||||||
function-call:
|
function-call:
|
||||||
- match: '(?=(((([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\)]))\s*(?:(\?\.\s*)|(\!))?((<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?\())'
|
- match: '(?=(((([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\)]))\s*(?:(\?\.\s*)|(\!))?((<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?\())'
|
||||||
push:
|
push:
|
||||||
- match: '(?<=\))(?!(((([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\)]))\s*(?:(\?\.\s*)|(\!))?((<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?\())'
|
- match: '(?<=\))(?!(((([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\)]))\s*(?:(\?\.\s*)|(\!))?((<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?\())'
|
||||||
pop: true
|
pop: true
|
||||||
- match: '(?=(([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))'
|
- match: '(?=(([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))'
|
||||||
push:
|
push:
|
||||||
- meta_scope: meta.function-call.ts
|
- meta_scope: meta.function-call.ts
|
||||||
- match: '(?=\s*(?:(\?\.\s*)|(\!))?((<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?\())'
|
- match: '(?=\s*(?:(\?\.\s*)|(\!))?((<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?\())'
|
||||||
pop: true
|
pop: true
|
||||||
- include: function-call-target
|
- include: function-call-target
|
||||||
- include: comment
|
- include: comment
|
||||||
@@ -1169,7 +1178,7 @@ contexts:
|
|||||||
6: meta.definition.function.ts entity.name.function.ts
|
6: meta.definition.function.ts entity.name.function.ts
|
||||||
push:
|
push:
|
||||||
- meta_scope: meta.function.ts
|
- meta_scope: meta.function.ts
|
||||||
- match: '(?=;|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))|(?<=\})'
|
- match: '(?=;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))|(?<=\})'
|
||||||
pop: true
|
pop: true
|
||||||
- include: function-name
|
- include: function-name
|
||||||
- include: function-body
|
- include: function-body
|
||||||
@@ -1221,10 +1230,10 @@ contexts:
|
|||||||
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
||||||
)) |
|
)) |
|
||||||
((async\s*)?(
|
((async\s*)?(
|
||||||
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
|
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
|
||||||
# sure shot arrow functions even if => is on new line
|
# sure shot arrow functions even if => is on new line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
||||||
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
||||||
(
|
(
|
||||||
([)]\s*:) | # ():
|
([)]\s*:) | # ():
|
||||||
@@ -1234,9 +1243,9 @@ contexts:
|
|||||||
|
|
||||||
# arrow function possible to detect only with => on same line
|
# arrow function possible to detect only with => on same line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||||
\s*=> # arrow operator
|
\s*=> # arrow operator
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
@@ -1260,7 +1269,7 @@ contexts:
|
|||||||
- match: "[_$[:alpha:]][_$[:alnum:]]*"
|
- match: "[_$[:alpha:]][_$[:alnum:]]*"
|
||||||
scope: variable.other.readwrite.ts
|
scope: variable.other.readwrite.ts
|
||||||
if-statement:
|
if-statement:
|
||||||
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?=\bif\s*(\(([^\(\)]|(\([^\(\)]*\)))*\))\s*(?!\{))'
|
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?=\bif\s*(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))\s*(?!\{))'
|
||||||
push:
|
push:
|
||||||
- match: '(?=;|$|\})'
|
- match: '(?=;|$|\})'
|
||||||
pop: true
|
pop: true
|
||||||
@@ -1275,12 +1284,12 @@ contexts:
|
|||||||
0: meta.brace.round.ts
|
0: meta.brace.round.ts
|
||||||
pop: true
|
pop: true
|
||||||
- include: expression
|
- include: expression
|
||||||
- match: '(?<=\))\s*\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)+\])+\/([gimsuy]+|(?![\/\*])|(?=\/\*))(?!\s*[a-zA-Z0-9_$]))'
|
- match: '(?<=\))\s*\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)*\])+\/([dgimsuy]+|(?![\/\*])|(?=\/\*))(?!\s*[a-zA-Z0-9_$]))'
|
||||||
captures:
|
captures:
|
||||||
0: punctuation.definition.string.begin.ts
|
0: punctuation.definition.string.begin.ts
|
||||||
push:
|
push:
|
||||||
- meta_scope: string.regexp.ts
|
- meta_scope: string.regexp.ts
|
||||||
- match: "(/)([gimsuy]*)"
|
- match: "(/)([dgimsuy]*)"
|
||||||
captures:
|
captures:
|
||||||
1: punctuation.definition.string.end.ts
|
1: punctuation.definition.string.end.ts
|
||||||
2: keyword.other.ts
|
2: keyword.other.ts
|
||||||
@@ -1414,6 +1423,9 @@ contexts:
|
|||||||
2: keyword.operator.type.modifier.ts
|
2: keyword.operator.type.modifier.ts
|
||||||
3: keyword.operator.optional.ts
|
3: keyword.operator.optional.ts
|
||||||
pop: true
|
pop: true
|
||||||
|
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(as)\s+'
|
||||||
|
captures:
|
||||||
|
1: keyword.control.as.ts
|
||||||
- include: type
|
- include: type
|
||||||
inline-tags:
|
inline-tags:
|
||||||
- match: '(\[)[^\]]+(\])(?={@(?:link|linkcode|linkplain|tutorial))'
|
- match: '(\[)[^\]]+(\])(?={@(?:link|linkcode|linkplain|tutorial))'
|
||||||
@@ -1504,25 +1516,27 @@ contexts:
|
|||||||
- include: this-literal
|
- include: this-literal
|
||||||
- include: super-literal
|
- include: super-literal
|
||||||
method-declaration:
|
method-declaration:
|
||||||
- match: '(?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(public|private|protected)\s+)?(?:\b(abstract)\s+)?(?:\b(async)\s+)?\s*\b(constructor)\b(?!:)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
|
- match: '(?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(override)\s+)?(?:\b(public|private|protected)\s+)?(?:\b(abstract)\s+)?(?:\b(async)\s+)?\s*\b(constructor)\b(?!:)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
|
||||||
captures:
|
captures:
|
||||||
1: storage.modifier.ts
|
1: storage.modifier.ts
|
||||||
2: storage.modifier.ts
|
2: storage.modifier.ts
|
||||||
3: storage.modifier.async.ts
|
3: storage.modifier.ts
|
||||||
4: storage.type.ts
|
4: storage.modifier.async.ts
|
||||||
|
5: storage.type.ts
|
||||||
push:
|
push:
|
||||||
- meta_scope: meta.method.declaration.ts
|
- meta_scope: meta.method.declaration.ts
|
||||||
- match: '(?=\}|;|,|$)|(?<=\})'
|
- match: '(?=\}|;|,|$)|(?<=\})'
|
||||||
pop: true
|
pop: true
|
||||||
- include: method-declaration-name
|
- include: method-declaration-name
|
||||||
- include: function-body
|
- include: function-body
|
||||||
- match: '(?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(public|private|protected)\s+)?(?:\b(abstract)\s+)?(?:\b(async)\s+)?(?:(?:\s*\b(new)\b(?!:)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))|(?:(\*)\s*)?)(?=\s*((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?[\(])'
|
- match: '(?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(override)\s+)?(?:\b(public|private|protected)\s+)?(?:\b(abstract)\s+)?(?:\b(async)\s+)?(?:(?:\s*\b(new)\b(?!:)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))|(?:(\*)\s*)?)(?=\s*((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?[\(])'
|
||||||
captures:
|
captures:
|
||||||
1: storage.modifier.ts
|
1: storage.modifier.ts
|
||||||
2: storage.modifier.ts
|
2: storage.modifier.ts
|
||||||
3: storage.modifier.async.ts
|
3: storage.modifier.ts
|
||||||
4: keyword.operator.new.ts
|
4: storage.modifier.async.ts
|
||||||
5: keyword.generator.asterisk.ts
|
5: keyword.operator.new.ts
|
||||||
|
6: keyword.generator.asterisk.ts
|
||||||
push:
|
push:
|
||||||
- meta_scope: meta.method.declaration.ts
|
- meta_scope: meta.method.declaration.ts
|
||||||
- match: '(?=\}|;|,|$)|(?<=\})'
|
- match: '(?=\}|;|,|$)|(?<=\})'
|
||||||
@@ -1530,7 +1544,7 @@ contexts:
|
|||||||
- include: method-declaration-name
|
- include: method-declaration-name
|
||||||
- include: function-body
|
- include: function-body
|
||||||
- match: |-
|
- match: |-
|
||||||
(?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(public|private|protected)\s+)?(?:\b(abstract)\s+)?(?:\b(async)\s+)?(?:\b(get|set)\s+)?(?:(\*)\s*)?(?=\s*(((\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?:
|
(?x)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(override)\s+)?(?:\b(public|private|protected)\s+)?(?:\b(abstract)\s+)?(?:\b(async)\s+)?(?:\b(get|set)\s+)?(?:(\*)\s*)?(?=\s*(((\b(?<!\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:b|B)[01][01_]*(n)?\b(?!\$))|(\b(?<!\$)0(?:o|O)?[0-7][0-7_]*(n)?\b(?!\$))|((?<!\$)(?:
|
||||||
(?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3
|
(?:\b[0-9][0-9_]*(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.1E+3
|
||||||
(?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3
|
(?:\b[0-9][0-9_]*(\.)[eE][+-]?[0-9][0-9_]*(n)?\b)| # 1.E+3
|
||||||
(?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3
|
(?:\B(\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\b)| # .1E+3
|
||||||
@@ -1539,13 +1553,14 @@ contexts:
|
|||||||
(?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1.
|
(?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1.
|
||||||
(?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1
|
(?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1
|
||||||
(?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1
|
(?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1
|
||||||
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?[\(])
|
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?[\(])
|
||||||
captures:
|
captures:
|
||||||
1: storage.modifier.ts
|
1: storage.modifier.ts
|
||||||
2: storage.modifier.ts
|
2: storage.modifier.ts
|
||||||
3: storage.modifier.async.ts
|
3: storage.modifier.ts
|
||||||
4: storage.type.property.ts
|
4: storage.modifier.async.ts
|
||||||
5: keyword.generator.asterisk.ts
|
5: storage.type.property.ts
|
||||||
|
6: keyword.generator.asterisk.ts
|
||||||
push:
|
push:
|
||||||
- meta_scope: meta.method.declaration.ts
|
- meta_scope: meta.method.declaration.ts
|
||||||
- match: '(?=\}|;|,|$)|(?<=\})'
|
- match: '(?=\}|;|,|$)|(?<=\})'
|
||||||
@@ -1582,7 +1597,7 @@ contexts:
|
|||||||
3: storage.type.namespace.ts
|
3: storage.type.namespace.ts
|
||||||
push:
|
push:
|
||||||
- meta_scope: meta.namespace.declaration.ts
|
- meta_scope: meta.namespace.declaration.ts
|
||||||
- match: '(?<=\})|(?=;|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
|
- match: '(?<=\})|(?=;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
|
||||||
pop: true
|
pop: true
|
||||||
- include: comment
|
- include: comment
|
||||||
- include: string
|
- include: string
|
||||||
@@ -1598,9 +1613,7 @@ contexts:
|
|||||||
- meta_scope: new.expr.ts
|
- meta_scope: new.expr.ts
|
||||||
- match: '(?<=\))|(?=[;),}\]:?\-\+\>]|\|\||\&\&|\!\=\=|$|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))new(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))function((\s+[_$[:alpha:]][_$[:alnum:]]*)|(\s*[\(]))))'
|
- match: '(?<=\))|(?=[;),}\]:?\-\+\>]|\|\||\&\&|\!\=\=|$|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))new(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))function((\s+[_$[:alpha:]][_$[:alnum:]]*)|(\s*[\(]))))'
|
||||||
pop: true
|
pop: true
|
||||||
- include: paren-expression
|
- include: expression
|
||||||
- include: class-declaration
|
|
||||||
- include: type
|
|
||||||
null-literal:
|
null-literal:
|
||||||
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))null(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
|
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))null(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
|
||||||
scope: constant.language.null.ts
|
scope: constant.language.null.ts
|
||||||
@@ -1781,7 +1794,7 @@ contexts:
|
|||||||
(?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1.
|
(?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1.
|
||||||
(?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1
|
(?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1
|
||||||
(?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1
|
(?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1
|
||||||
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?[\(])
|
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?[\(])
|
||||||
captures:
|
captures:
|
||||||
1: storage.modifier.async.ts
|
1: storage.modifier.async.ts
|
||||||
2: storage.type.property.ts
|
2: storage.type.property.ts
|
||||||
@@ -1802,7 +1815,7 @@ contexts:
|
|||||||
(?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1.
|
(?:\b[0-9][0-9_]*(\.)(n)?\B)| # 1.
|
||||||
(?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1
|
(?:\B(\.)[0-9][0-9_]*(n)?\b)| # .1
|
||||||
(?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1
|
(?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1
|
||||||
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?[\(])
|
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?[\(])
|
||||||
captures:
|
captures:
|
||||||
1: storage.modifier.async.ts
|
1: storage.modifier.async.ts
|
||||||
2: storage.type.property.ts
|
2: storage.type.property.ts
|
||||||
@@ -1864,10 +1877,10 @@ contexts:
|
|||||||
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
||||||
)) |
|
)) |
|
||||||
((async\s*)?(
|
((async\s*)?(
|
||||||
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
|
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
|
||||||
# sure shot arrow functions even if => is on new line
|
# sure shot arrow functions even if => is on new line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
||||||
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
||||||
(
|
(
|
||||||
([)]\s*:) | # ():
|
([)]\s*:) | # ():
|
||||||
@@ -1877,9 +1890,9 @@ contexts:
|
|||||||
|
|
||||||
# arrow function possible to detect only with => on same line
|
# arrow function possible to detect only with => on same line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||||
\s*=> # arrow operator
|
\s*=> # arrow operator
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
@@ -1930,7 +1943,7 @@ contexts:
|
|||||||
- meta_scope: meta.object.member.ts
|
- meta_scope: meta.object.member.ts
|
||||||
- match: '(?=,|\})'
|
- match: '(?=,|\})'
|
||||||
pop: true
|
pop: true
|
||||||
- match: '(?<=:)\s*(async)?(?=\s*(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)\(\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))'
|
- match: '(?<=:)\s*(async)?(?=\s*(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)\(\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))'
|
||||||
captures:
|
captures:
|
||||||
1: storage.modifier.async.ts
|
1: storage.modifier.async.ts
|
||||||
push:
|
push:
|
||||||
@@ -1946,7 +1959,7 @@ contexts:
|
|||||||
0: meta.brace.round.ts
|
0: meta.brace.round.ts
|
||||||
pop: true
|
pop: true
|
||||||
- include: expression-inside-possibly-arrow-parens
|
- include: expression-inside-possibly-arrow-parens
|
||||||
- match: '(?<=:)\s*(async)?\s*(\()(?=\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))'
|
- match: '(?<=:)\s*(async)?\s*(\()(?=\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))'
|
||||||
captures:
|
captures:
|
||||||
1: storage.modifier.async.ts
|
1: storage.modifier.async.ts
|
||||||
2: meta.brace.round.ts
|
2: meta.brace.round.ts
|
||||||
@@ -1963,7 +1976,7 @@ contexts:
|
|||||||
- match: (?<=\>)
|
- match: (?<=\>)
|
||||||
pop: true
|
pop: true
|
||||||
- include: type-parameters
|
- include: type-parameters
|
||||||
- match: '(?<=\>)\s*(\()(?=\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))'
|
- match: '(?<=\>)\s*(\()(?=\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))'
|
||||||
captures:
|
captures:
|
||||||
1: meta.brace.round.ts
|
1: meta.brace.round.ts
|
||||||
push:
|
push:
|
||||||
@@ -1997,11 +2010,11 @@ contexts:
|
|||||||
- include: destructuring-parameter-rest
|
- include: destructuring-parameter-rest
|
||||||
- include: variable-initializer
|
- include: variable-initializer
|
||||||
parameter-name:
|
parameter-name:
|
||||||
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(public|protected|private|readonly)\s+(?=(public|protected|private|readonly)\s+)'
|
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(override|public|protected|private|readonly)\s+(?=(override|public|protected|private|readonly)\s+)'
|
||||||
captures:
|
captures:
|
||||||
1: storage.modifier.ts
|
1: storage.modifier.ts
|
||||||
- match: |-
|
- match: |-
|
||||||
(?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??)(?=\s*
|
(?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(override|public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??)(?=\s*
|
||||||
# function assignment |
|
# function assignment |
|
||||||
(=\s*(
|
(=\s*(
|
||||||
((async\s+)?(
|
((async\s+)?(
|
||||||
@@ -2010,10 +2023,10 @@ contexts:
|
|||||||
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
||||||
)) |
|
)) |
|
||||||
((async\s*)?(
|
((async\s*)?(
|
||||||
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
|
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
|
||||||
# sure shot arrow functions even if => is on new line
|
# sure shot arrow functions even if => is on new line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
||||||
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
||||||
(
|
(
|
||||||
([)]\s*:) | # ():
|
([)]\s*:) | # ():
|
||||||
@@ -2023,9 +2036,9 @@ contexts:
|
|||||||
|
|
||||||
# arrow function possible to detect only with => on same line
|
# arrow function possible to detect only with => on same line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||||
\s*=> # arrow operator
|
\s*=> # arrow operator
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
@@ -2043,18 +2056,18 @@ contexts:
|
|||||||
))
|
))
|
||||||
)) |
|
)) |
|
||||||
(:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) |
|
(:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) |
|
||||||
(:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) |
|
(:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) |
|
||||||
(:\s*(=>|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
|
(:\s*(=>|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
|
||||||
((async\s+)?(
|
((async\s+)?(
|
||||||
(function\s*[(<*]) |
|
(function\s*[(<*]) |
|
||||||
(function\s+) |
|
(function\s+) |
|
||||||
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
||||||
)) |
|
)) |
|
||||||
((async\s*)?(
|
((async\s*)?(
|
||||||
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
|
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
|
||||||
# sure shot arrow functions even if => is on new line
|
# sure shot arrow functions even if => is on new line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
||||||
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
||||||
(
|
(
|
||||||
([)]\s*:) | # ():
|
([)]\s*:) | # ():
|
||||||
@@ -2064,9 +2077,9 @@ contexts:
|
|||||||
|
|
||||||
# arrow function possible to detect only with => on same line
|
# arrow function possible to detect only with => on same line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||||
\s*=> # arrow operator
|
\s*=> # arrow operator
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
@@ -2077,7 +2090,7 @@ contexts:
|
|||||||
3: entity.name.function.ts variable.language.this.ts
|
3: entity.name.function.ts variable.language.this.ts
|
||||||
4: entity.name.function.ts
|
4: entity.name.function.ts
|
||||||
5: keyword.operator.optional.ts
|
5: keyword.operator.optional.ts
|
||||||
- match: '(?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??)'
|
- match: '(?x)(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(override|public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*(\??)'
|
||||||
captures:
|
captures:
|
||||||
1: storage.modifier.ts
|
1: storage.modifier.ts
|
||||||
2: keyword.operator.rest.ts
|
2: keyword.operator.rest.ts
|
||||||
@@ -2137,14 +2150,14 @@ contexts:
|
|||||||
pop: true
|
pop: true
|
||||||
- include: expression
|
- include: expression
|
||||||
paren-expression-possibly-arrow:
|
paren-expression-possibly-arrow:
|
||||||
- match: '(?<=[(=,])\s*(async)?(?=\s*((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?\(\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))'
|
- match: '(?<=[(=,])\s*(async)?(?=\s*((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?\(\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))'
|
||||||
captures:
|
captures:
|
||||||
1: storage.modifier.async.ts
|
1: storage.modifier.async.ts
|
||||||
push:
|
push:
|
||||||
- match: (?<=\))
|
- match: (?<=\))
|
||||||
pop: true
|
pop: true
|
||||||
- include: paren-expression-possibly-arrow-with-typeparameters
|
- include: paren-expression-possibly-arrow-with-typeparameters
|
||||||
- match: '(?<=[(=,]|=>|^return|[^\._$[:alnum:]]return)\s*(async)?(?=\s*((((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?\()|(<))\s*$)'
|
- match: '(?<=[(=,]|=>|^return|[^\._$[:alnum:]]return)\s*(async)?(?=\s*((((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?\()|(<))\s*$)'
|
||||||
captures:
|
captures:
|
||||||
1: storage.modifier.async.ts
|
1: storage.modifier.async.ts
|
||||||
push:
|
push:
|
||||||
@@ -2164,7 +2177,7 @@ contexts:
|
|||||||
pop: true
|
pop: true
|
||||||
- include: expression-inside-possibly-arrow-parens
|
- include: expression-inside-possibly-arrow-parens
|
||||||
possibly-arrow-return-type:
|
possibly-arrow-return-type:
|
||||||
- match: '(?<=\)|^)\s*(:)(?=\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*=>)'
|
- match: '(?<=\)|^)\s*(:)(?=\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*=>)'
|
||||||
captures:
|
captures:
|
||||||
1: meta.arrow.ts meta.return.type.arrow.ts keyword.operator.type.annotation.ts
|
1: meta.arrow.ts meta.return.type.arrow.ts keyword.operator.type.annotation.ts
|
||||||
push:
|
push:
|
||||||
@@ -2211,23 +2224,23 @@ contexts:
|
|||||||
pop: true
|
pop: true
|
||||||
- include: string-character-escape
|
- include: string-character-escape
|
||||||
regex:
|
regex:
|
||||||
- match: '(?<!\+\+|--|})(?<=[=(:,\[?+!]|^return|[^\._$[:alnum:]]return|^case|[^\._$[:alnum:]]case|=>|&&|\|\||\*\/)\s*(\/)(?![\/*])(?=(?:[^\/\\\[\()]|\\.|\[([^\]\\]|\\.)+\]|\(([^\)\\]|\\.)+\))+\/([gimsuy]+|(?![\/\*])|(?=\/\*))(?!\s*[a-zA-Z0-9_$]))'
|
- match: '(?<!\+\+|--|})(?<=[=(:,\[?+!]|^return|[^\._$[:alnum:]]return|^case|[^\._$[:alnum:]]case|=>|&&|\|\||\*\/)\s*(\/)(?![\/*])(?=(?:[^\/\\\[\()]|\\.|\[([^\]\\]|\\.)+\]|\(([^\)\\]|\\.)+\))+\/([dgimsuy]+|(?![\/\*])|(?=\/\*))(?!\s*[a-zA-Z0-9_$]))'
|
||||||
captures:
|
captures:
|
||||||
1: punctuation.definition.string.begin.ts
|
1: punctuation.definition.string.begin.ts
|
||||||
push:
|
push:
|
||||||
- meta_scope: string.regexp.ts
|
- meta_scope: string.regexp.ts
|
||||||
- match: "(/)([gimsuy]*)"
|
- match: "(/)([dgimsuy]*)"
|
||||||
captures:
|
captures:
|
||||||
1: punctuation.definition.string.end.ts
|
1: punctuation.definition.string.end.ts
|
||||||
2: keyword.other.ts
|
2: keyword.other.ts
|
||||||
pop: true
|
pop: true
|
||||||
- include: regexp
|
- include: regexp
|
||||||
- match: '((?<![_$[:alnum:])\]]|\+\+|--|}|\*\/)|((?<=^return|[^\._$[:alnum:]]return|^case|[^\._$[:alnum:]]case))\s*)\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)+\])+\/([gimsuy]+|(?![\/\*])|(?=\/\*))(?!\s*[a-zA-Z0-9_$]))'
|
- match: '((?<![_$[:alnum:])\]]|\+\+|--|}|\*\/)|((?<=^return|[^\._$[:alnum:]]return|^case|[^\._$[:alnum:]]case))\s*)\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)*\])+\/([dgimsuy]+|(?![\/\*])|(?=\/\*))(?!\s*[a-zA-Z0-9_$]))'
|
||||||
captures:
|
captures:
|
||||||
0: punctuation.definition.string.begin.ts
|
0: punctuation.definition.string.begin.ts
|
||||||
push:
|
push:
|
||||||
- meta_scope: string.regexp.ts
|
- meta_scope: string.regexp.ts
|
||||||
- match: "(/)([gimsuy]*)"
|
- match: "(/)([dgimsuy]*)"
|
||||||
captures:
|
captures:
|
||||||
1: punctuation.definition.string.end.ts
|
1: punctuation.definition.string.end.ts
|
||||||
2: keyword.other.ts
|
2: keyword.other.ts
|
||||||
@@ -2430,7 +2443,7 @@ contexts:
|
|||||||
4: support.variable.property.target.ts
|
4: support.variable.property.target.ts
|
||||||
- match: |-
|
- match: |-
|
||||||
(?x) (?:(\.)|(\?\.(?!\s*[[:digit:]]))) \s* (?:
|
(?x) (?:(\.)|(\?\.(?!\s*[[:digit:]]))) \s* (?:
|
||||||
(?:(constructor|length|prototype|__proto__)\b(?!\$|\s*(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?\())
|
(?:(constructor|length|prototype|__proto__)\b(?!\$|\s*(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?\())
|
||||||
|
|
|
|
||||||
(?:(EPSILON|MAX_SAFE_INTEGER|MAX_VALUE|MIN_SAFE_INTEGER|MIN_VALUE|NEGATIVE_INFINITY|POSITIVE_INFINITY)\b(?!\$)))
|
(?:(EPSILON|MAX_SAFE_INTEGER|MAX_VALUE|MIN_SAFE_INTEGER|MIN_VALUE|NEGATIVE_INFINITY|POSITIVE_INFINITY)\b(?!\$)))
|
||||||
captures:
|
captures:
|
||||||
@@ -2536,7 +2549,7 @@ contexts:
|
|||||||
|siblingBelow|size|source|specified|standby|start|status|statusbar|statusText|style|styleSheets|suffixes|summary
|
|siblingBelow|size|source|specified|standby|start|status|statusbar|statusText|style|styleSheets|suffixes|summary
|
||||||
|systemId|systemLanguage|tagName|tags|target|tBodies|text|textAlign|textDecoration|textIndent|textTransform|tFoot|tHead
|
|systemId|systemLanguage|tagName|tags|target|tBodies|text|textAlign|textDecoration|textIndent|textTransform|tFoot|tHead
|
||||||
|title|toolbar|top|type|undefined|uniqueID|updateInterval|URL|URLUnencoded|useMap|userAgent|userLanguage|userProfile
|
|title|toolbar|top|type|undefined|uniqueID|updateInterval|URL|URLUnencoded|useMap|userAgent|userLanguage|userProfile
|
||||||
|vAlign|value|valueType|vendor|vendorSub|version|visibility|vspace|whiteSpace|width|X[MS]LDocument|zIndex))\b(?!\$|\s*(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?\()
|
|vAlign|value|valueType|vendor|vendorSub|version|visibility|vspace|whiteSpace|width|X[MS]LDocument|zIndex))\b(?!\$|\s*(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?\()
|
||||||
captures:
|
captures:
|
||||||
1: punctuation.accessor.ts
|
1: punctuation.accessor.ts
|
||||||
2: punctuation.accessor.optional.ts
|
2: punctuation.accessor.optional.ts
|
||||||
@@ -2703,27 +2716,7 @@ contexts:
|
|||||||
0: case-clause.expr.ts punctuation.definition.section.case-statement.ts
|
0: case-clause.expr.ts punctuation.definition.section.case-statement.ts
|
||||||
- include: statements
|
- include: statements
|
||||||
template:
|
template:
|
||||||
- match: '(?=(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*)(<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?`)'
|
- include: template-call
|
||||||
push:
|
|
||||||
- meta_scope: string.template.ts
|
|
||||||
- match: (?=`)
|
|
||||||
pop: true
|
|
||||||
- match: '(?=(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*))'
|
|
||||||
push:
|
|
||||||
- match: '(?=(<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?`)'
|
|
||||||
pop: true
|
|
||||||
- include: support-function-call-identifiers
|
|
||||||
- match: "([_$[:alpha:]][_$[:alnum:]]*)"
|
|
||||||
scope: entity.name.function.tagged-template.ts
|
|
||||||
- include: type-arguments
|
|
||||||
- match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(?=(<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)`)'
|
|
||||||
captures:
|
|
||||||
1: entity.name.function.tagged-template.ts
|
|
||||||
push:
|
|
||||||
- meta_scope: string.template.ts
|
|
||||||
- match: (?=`)
|
|
||||||
pop: true
|
|
||||||
- include: type-arguments
|
|
||||||
- match: "([_$[:alpha:]][_$[:alnum:]]*)?(`)"
|
- match: "([_$[:alpha:]][_$[:alnum:]]*)?(`)"
|
||||||
captures:
|
captures:
|
||||||
1: entity.name.function.tagged-template.ts
|
1: entity.name.function.tagged-template.ts
|
||||||
@@ -2736,6 +2729,28 @@ contexts:
|
|||||||
pop: true
|
pop: true
|
||||||
- include: template-substitution-element
|
- include: template-substitution-element
|
||||||
- include: string-character-escape
|
- include: string-character-escape
|
||||||
|
template-call:
|
||||||
|
- match: '(?=(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*)(<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?`)'
|
||||||
|
push:
|
||||||
|
- meta_scope: string.template.ts
|
||||||
|
- match: (?=`)
|
||||||
|
pop: true
|
||||||
|
- match: '(?=(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*))'
|
||||||
|
push:
|
||||||
|
- match: '(?=(<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?`)'
|
||||||
|
pop: true
|
||||||
|
- include: support-function-call-identifiers
|
||||||
|
- match: "([_$[:alpha:]][_$[:alnum:]]*)"
|
||||||
|
scope: entity.name.function.tagged-template.ts
|
||||||
|
- include: type-arguments
|
||||||
|
- match: '([_$[:alpha:]][_$[:alnum:]]*)?\s*(?=(<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)`)'
|
||||||
|
captures:
|
||||||
|
1: entity.name.function.tagged-template.ts
|
||||||
|
push:
|
||||||
|
- meta_scope: string.template.ts
|
||||||
|
- match: (?=`)
|
||||||
|
pop: true
|
||||||
|
- include: type-arguments
|
||||||
template-substitution-element:
|
template-substitution-element:
|
||||||
- match: '\$\{'
|
- match: '\$\{'
|
||||||
captures:
|
captures:
|
||||||
@@ -2748,6 +2763,32 @@ contexts:
|
|||||||
0: punctuation.definition.template-expression.end.ts
|
0: punctuation.definition.template-expression.end.ts
|
||||||
pop: true
|
pop: true
|
||||||
- include: expression
|
- include: expression
|
||||||
|
template-type:
|
||||||
|
- include: template-call
|
||||||
|
- match: "([_$[:alpha:]][_$[:alnum:]]*)?(`)"
|
||||||
|
captures:
|
||||||
|
1: entity.name.function.tagged-template.ts
|
||||||
|
2: punctuation.definition.string.template.begin.ts
|
||||||
|
push:
|
||||||
|
- meta_scope: string.template.ts
|
||||||
|
- match: "`"
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.template.end.ts
|
||||||
|
pop: true
|
||||||
|
- include: template-type-substitution-element
|
||||||
|
- include: string-character-escape
|
||||||
|
template-type-substitution-element:
|
||||||
|
- match: '\$\{'
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.template-expression.begin.ts
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.template.expression.ts
|
||||||
|
- meta_content_scope: meta.embedded.line.ts
|
||||||
|
- match: '\}'
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.template-expression.end.ts
|
||||||
|
pop: true
|
||||||
|
- include: type
|
||||||
ternary-expression:
|
ternary-expression:
|
||||||
- match: '(?!\?\.\s*[^[:digit:]])(\?)(?!\?)'
|
- match: '(?!\?\.\s*[^[:digit:]])(\?)(?!\?)'
|
||||||
captures:
|
captures:
|
||||||
@@ -2763,7 +2804,7 @@ contexts:
|
|||||||
scope: variable.language.this.ts
|
scope: variable.language.this.ts
|
||||||
type:
|
type:
|
||||||
- include: comment
|
- include: comment
|
||||||
- include: string
|
- include: type-string
|
||||||
- include: numeric-literal
|
- include: numeric-literal
|
||||||
- include: type-primitive
|
- include: type-primitive
|
||||||
- include: type-builtin-literals
|
- include: type-builtin-literals
|
||||||
@@ -2788,15 +2829,23 @@ contexts:
|
|||||||
4: entity.name.type.alias.ts
|
4: entity.name.type.alias.ts
|
||||||
push:
|
push:
|
||||||
- meta_scope: meta.type.declaration.ts
|
- meta_scope: meta.type.declaration.ts
|
||||||
- match: '(?=\}|;|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
|
- match: '(?=\}|;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
|
||||||
pop: true
|
pop: true
|
||||||
- include: comment
|
- include: comment
|
||||||
- include: type-parameters
|
- include: type-parameters
|
||||||
|
- match: '(=)\s*(intrinsic)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
|
||||||
|
captures:
|
||||||
|
1: keyword.operator.assignment.ts
|
||||||
|
2: keyword.control.intrinsic.ts
|
||||||
|
push:
|
||||||
|
- match: '(?=\}|;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
|
||||||
|
pop: true
|
||||||
|
- include: type
|
||||||
- match: (=)\s*
|
- match: (=)\s*
|
||||||
captures:
|
captures:
|
||||||
1: keyword.operator.assignment.ts
|
1: keyword.operator.assignment.ts
|
||||||
push:
|
push:
|
||||||
- match: '(?=\}|;|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
|
- match: '(?=\}|;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
|
||||||
pop: true
|
pop: true
|
||||||
- include: type
|
- include: type
|
||||||
type-annotation:
|
type-annotation:
|
||||||
@@ -2854,17 +2903,19 @@ contexts:
|
|||||||
- include: type
|
- include: type
|
||||||
- include: type
|
- include: type
|
||||||
type-fn-type-parameters:
|
type-fn-type-parameters:
|
||||||
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(new)\b(?=\s*\<)'
|
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(abstract)\s+)?(new)\b(?=\s*\<)'
|
||||||
captures:
|
captures:
|
||||||
1: meta.type.constructor.ts keyword.control.new.ts
|
1: meta.type.constructor.ts storage.modifier.ts
|
||||||
|
2: meta.type.constructor.ts keyword.control.new.ts
|
||||||
push:
|
push:
|
||||||
- match: (?<=>)
|
- match: (?<=>)
|
||||||
pop: true
|
pop: true
|
||||||
- include: comment
|
- include: comment
|
||||||
- include: type-parameters
|
- include: type-parameters
|
||||||
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(new)\b\s*(?=\()'
|
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(abstract)\s+)?(new)\b\s*(?=\()'
|
||||||
captures:
|
captures:
|
||||||
1: keyword.control.new.ts
|
1: storage.modifier.ts
|
||||||
|
2: keyword.control.new.ts
|
||||||
push:
|
push:
|
||||||
- meta_scope: meta.type.constructor.ts
|
- meta_scope: meta.type.constructor.ts
|
||||||
- match: (?<=\))
|
- match: (?<=\))
|
||||||
@@ -2993,8 +3044,6 @@ contexts:
|
|||||||
scope: keyword.operator.ternary.ts
|
scope: keyword.operator.ternary.ts
|
||||||
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))infer(?=\s+[_$[:alpha:]])'
|
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))infer(?=\s+[_$[:alpha:]])'
|
||||||
scope: keyword.operator.expression.infer.ts
|
scope: keyword.operator.expression.infer.ts
|
||||||
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))awaited(?=\s+[_$[:alpha:]])'
|
|
||||||
scope: keyword.operator.expression.awaited.ts
|
|
||||||
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))import(?=\s*\()'
|
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))import(?=\s*\()'
|
||||||
scope: keyword.operator.expression.import.ts
|
scope: keyword.operator.expression.import.ts
|
||||||
type-parameters:
|
type-parameters:
|
||||||
@@ -3037,7 +3086,7 @@ contexts:
|
|||||||
))
|
))
|
||||||
)) |
|
)) |
|
||||||
(:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) |
|
(:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) |
|
||||||
(:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))))
|
(:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))))
|
||||||
captures:
|
captures:
|
||||||
1: storage.modifier.ts
|
1: storage.modifier.ts
|
||||||
2: keyword.operator.rest.ts
|
2: keyword.operator.rest.ts
|
||||||
@@ -3074,6 +3123,10 @@ contexts:
|
|||||||
type-primitive:
|
type-primitive:
|
||||||
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(string|number|bigint|boolean|symbol|any|void|never|unknown)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
|
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(string|number|bigint|boolean|symbol|any|void|never|unknown)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
|
||||||
scope: support.type.primitive.ts
|
scope: support.type.primitive.ts
|
||||||
|
type-string:
|
||||||
|
- include: qstring-single
|
||||||
|
- include: qstring-double
|
||||||
|
- include: template-type
|
||||||
type-tuple:
|
type-tuple:
|
||||||
- match: '\['
|
- match: '\['
|
||||||
captures:
|
captures:
|
||||||
@@ -3095,7 +3148,12 @@ contexts:
|
|||||||
- include: punctuation-comma
|
- include: punctuation-comma
|
||||||
typeof-operator:
|
typeof-operator:
|
||||||
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))typeof(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
|
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))typeof(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
|
||||||
scope: keyword.operator.expression.typeof.ts
|
captures:
|
||||||
|
0: keyword.operator.expression.typeof.ts
|
||||||
|
push:
|
||||||
|
- match: '(?=[,);}\]=>:&|{\?]|$|;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))'
|
||||||
|
pop: true
|
||||||
|
- include: expression
|
||||||
undefined-literal:
|
undefined-literal:
|
||||||
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))undefined(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
|
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))undefined(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))'
|
||||||
scope: constant.language.undefined.ts
|
scope: constant.language.undefined.ts
|
||||||
@@ -3103,7 +3161,7 @@ contexts:
|
|||||||
- match: '(?=(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(var|let)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))'
|
- match: '(?=(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(var|let)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))'
|
||||||
push:
|
push:
|
||||||
- meta_scope: meta.var.expr.ts
|
- meta_scope: meta.var.expr.ts
|
||||||
- match: '(?!(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(var|let)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))((?=;|}|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)|^\s*$|;|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))|((?<!^let|[^\._$[:alnum:]]let|^var|[^\._$[:alnum:]]var)(?=\s*$)))'
|
- match: '(?!(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(var|let)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))((?=;|}|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)|;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))|((?<!^let|[^\._$[:alnum:]]let|^var|[^\._$[:alnum:]]var)(?=\s*$)))'
|
||||||
pop: true
|
pop: true
|
||||||
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(var|let)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*'
|
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(var|let)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*'
|
||||||
captures:
|
captures:
|
||||||
@@ -3136,7 +3194,7 @@ contexts:
|
|||||||
3: storage.type.ts
|
3: storage.type.ts
|
||||||
push:
|
push:
|
||||||
- meta_scope: meta.var.expr.ts
|
- meta_scope: meta.var.expr.ts
|
||||||
- match: '(?!(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(const(?!\s+enum\b))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))((?=;|}|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)|^\s*$|;|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))|((?<!^const|[^\._$[:alnum:]]const)(?=\s*$)))'
|
- match: '(?!(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(const(?!\s+enum\b))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))((?=;|}|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(of|in)\s+)|;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))|((?<!^const|[^\._$[:alnum:]]const)(?=\s*$)))'
|
||||||
pop: true
|
pop: true
|
||||||
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(const(?!\s+enum\b))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*'
|
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?\b(const(?!\s+enum\b))(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))\s*'
|
||||||
captures:
|
captures:
|
||||||
@@ -3173,10 +3231,10 @@ contexts:
|
|||||||
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
||||||
)) |
|
)) |
|
||||||
((async\s*)?(
|
((async\s*)?(
|
||||||
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
|
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
|
||||||
# sure shot arrow functions even if => is on new line
|
# sure shot arrow functions even if => is on new line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
||||||
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
||||||
(
|
(
|
||||||
([)]\s*:) | # ():
|
([)]\s*:) | # ():
|
||||||
@@ -3186,9 +3244,9 @@ contexts:
|
|||||||
|
|
||||||
# arrow function possible to detect only with => on same line
|
# arrow function possible to detect only with => on same line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||||
\s*=> # arrow operator
|
\s*=> # arrow operator
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
@@ -3206,18 +3264,18 @@ contexts:
|
|||||||
))
|
))
|
||||||
)) |
|
)) |
|
||||||
(:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) |
|
(:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) |
|
||||||
(:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) |
|
(:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) |
|
||||||
(:\s*(=>|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
|
(:\s*(=>|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
|
||||||
((async\s+)?(
|
((async\s+)?(
|
||||||
(function\s*[(<*]) |
|
(function\s*[(<*]) |
|
||||||
(function\s+) |
|
(function\s+) |
|
||||||
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
||||||
)) |
|
)) |
|
||||||
((async\s*)?(
|
((async\s*)?(
|
||||||
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
|
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
|
||||||
# sure shot arrow functions even if => is on new line
|
# sure shot arrow functions even if => is on new line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
||||||
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
||||||
(
|
(
|
||||||
([)]\s*:) | # ():
|
([)]\s*:) | # ():
|
||||||
@@ -3227,9 +3285,9 @@ contexts:
|
|||||||
|
|
||||||
# arrow function possible to detect only with => on same line
|
# arrow function possible to detect only with => on same line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||||
\s*=> # arrow operator
|
\s*=> # arrow operator
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
@@ -3260,10 +3318,10 @@ contexts:
|
|||||||
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
||||||
)) |
|
)) |
|
||||||
((async\s*)?(
|
((async\s*)?(
|
||||||
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
|
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
|
||||||
# sure shot arrow functions even if => is on new line
|
# sure shot arrow functions even if => is on new line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
||||||
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
||||||
(
|
(
|
||||||
([)]\s*:) | # ():
|
([)]\s*:) | # ():
|
||||||
@@ -3273,9 +3331,9 @@ contexts:
|
|||||||
|
|
||||||
# arrow function possible to detect only with => on same line
|
# arrow function possible to detect only with => on same line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||||
\s*=> # arrow operator
|
\s*=> # arrow operator
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
@@ -3293,18 +3351,18 @@ contexts:
|
|||||||
))
|
))
|
||||||
)) |
|
)) |
|
||||||
(:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) |
|
(:\s*(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))Function(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))) |
|
||||||
(:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) |
|
(:\s*((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) |
|
||||||
(:\s*(=>|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
|
(:\s*(=>|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*(
|
||||||
((async\s+)?(
|
((async\s+)?(
|
||||||
(function\s*[(<*]) |
|
(function\s*[(<*]) |
|
||||||
(function\s+) |
|
(function\s+) |
|
||||||
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
([_$[:alpha:]][_$[:alnum:]]*\s*=>)
|
||||||
)) |
|
)) |
|
||||||
((async\s*)?(
|
((async\s*)?(
|
||||||
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{[^\{\}]*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[[^\[\]]*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
|
((<\s*$)|((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?[\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) |
|
||||||
# sure shot arrow functions even if => is on new line
|
# sure shot arrow functions even if => is on new line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?
|
||||||
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
[(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*
|
||||||
(
|
(
|
||||||
([)]\s*:) | # ():
|
([)]\s*:) | # ():
|
||||||
@@ -3314,9 +3372,9 @@ contexts:
|
|||||||
|
|
||||||
# arrow function possible to detect only with => on same line
|
# arrow function possible to detect only with => on same line
|
||||||
(
|
(
|
||||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||||
\s*=> # arrow operator
|
\s*=> # arrow operator
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
|
1239
assets/syntaxes/02_Extra/TypsecriptReact.sublime-syntax
vendored
1239
assets/syntaxes/02_Extra/TypsecriptReact.sublime-syntax
vendored
File diff suppressed because it is too large
Load Diff
2
assets/syntaxes/02_Extra/VimL
vendored
2
assets/syntaxes/02_Extra/VimL
vendored
Submodule assets/syntaxes/02_Extra/VimL updated: 7ebcaa1d98...ee85822cbe
1
assets/syntaxes/02_Extra/http-request-response
vendored
Submodule
1
assets/syntaxes/02_Extra/http-request-response
vendored
Submodule
Submodule assets/syntaxes/02_Extra/http-request-response added at 93b93261bc
116
assets/syntaxes/02_Extra/log.sublime-syntax
vendored
Normal file
116
assets/syntaxes/02_Extra/log.sublime-syntax
vendored
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
# See http://www.sublimetext.com/docs/3/syntax.html
|
||||||
|
file_extensions:
|
||||||
|
- log
|
||||||
|
scope: text.log
|
||||||
|
variables:
|
||||||
|
ipv4_part: (?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)
|
||||||
|
contexts:
|
||||||
|
main:
|
||||||
|
- match: (\w+)(=)
|
||||||
|
captures:
|
||||||
|
1: variable.parameter.log
|
||||||
|
2: keyword.operator.assignment.log
|
||||||
|
- match: (')([^']*)(')
|
||||||
|
scope: string.quoted.single.log
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.string.begin.log
|
||||||
|
3: punctuation.definition.string.end.log
|
||||||
|
- match: (")([^"]*)(")
|
||||||
|
scope: string.quoted.double.log
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.string.begin.log
|
||||||
|
3: punctuation.definition.string.end.log
|
||||||
|
- include: dates
|
||||||
|
- include: ip_addresses
|
||||||
|
- include: numbers
|
||||||
|
- match: \b(?i:fail(?:ure|ed)?|error|exception)\b
|
||||||
|
scope: markup.error.log
|
||||||
|
- match: \b(?i:warn(?:ing)?)\b
|
||||||
|
scope: markup.warning.log
|
||||||
|
#- include: scope:text.html.markdown#autolink-inet
|
||||||
|
- match: \b\w+:/{2,3}
|
||||||
|
scope: markup.underline.link.scheme.log
|
||||||
|
push: url-host
|
||||||
|
dates:
|
||||||
|
- match: \b\d{4}-\d{2}-\d{2}\b
|
||||||
|
scope: meta.date.log meta.number.integer.decimal.log constant.numeric.value.log
|
||||||
|
- match: \b\d{4}/\d{2}/\d{2}\b
|
||||||
|
scope: meta.date.log meta.number.integer.decimal.log constant.numeric.value.log
|
||||||
|
- match: \b(?:[01]\d|2[0-3]):(?:[0-5]\d):(?:[0-5]\d)(?:(\.)\d{3})?\b
|
||||||
|
scope: meta.time.log meta.number.integer.decimal.log constant.numeric.value.log
|
||||||
|
captures:
|
||||||
|
1: punctuation.separator.decimal.log
|
||||||
|
ip_addresses:
|
||||||
|
- match: \b(?=(?:{{ipv4_part}}\.){3}{{ipv4_part}}\b)
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.ipaddress.v4.log meta.number.integer.decimal.log
|
||||||
|
- match: \d+
|
||||||
|
scope: constant.numeric.value.log
|
||||||
|
- match: \.
|
||||||
|
scope: punctuation.separator.sequence.log
|
||||||
|
- match: ''
|
||||||
|
pop: true
|
||||||
|
- match: (?=(?:\h{0,4}:){2,6}\h{1,4}\b)
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.ipaddress.v6.log meta.number.integer.hexadecimal.log
|
||||||
|
- match: \h{1,4}
|
||||||
|
scope: constant.numeric.value.log
|
||||||
|
- match: ':'
|
||||||
|
scope: punctuation.separator.sequence.log
|
||||||
|
- match: ''
|
||||||
|
pop: true
|
||||||
|
numbers:
|
||||||
|
- match: \b(0x)(\h+)(?:(\.)(\h+))?\b
|
||||||
|
scope: meta.number.float.hexadecimal.log
|
||||||
|
captures:
|
||||||
|
1: constant.numeric.base.log
|
||||||
|
2: constant.numeric.value.log
|
||||||
|
3: constant.numeric.value.log punctuation.separator.decimal.log
|
||||||
|
4: constant.numeric.value.log
|
||||||
|
- match: \b\d+(\.)\d+\b
|
||||||
|
scope: meta.number.float.log constant.numeric.value.log
|
||||||
|
captures:
|
||||||
|
1: punctuation.separator.decimal.log
|
||||||
|
- match: \b\d+\b
|
||||||
|
scope: meta.number.integer.log constant.numeric.value.log
|
||||||
|
url-host:
|
||||||
|
- meta_content_scope: markup.underline.link.host.log
|
||||||
|
- match: \[
|
||||||
|
scope: punctuation.section.brackets.begin.log
|
||||||
|
push:
|
||||||
|
- match: \]
|
||||||
|
scope: punctuation.section.brackets.end.log
|
||||||
|
pop: true
|
||||||
|
- include: ip_addresses
|
||||||
|
- match: '[^:/\s]+'
|
||||||
|
- match: ''
|
||||||
|
set: url-after-host
|
||||||
|
url-after-host:
|
||||||
|
- match: (:)(\d+)
|
||||||
|
scope: markup.underline.link.port.log
|
||||||
|
captures:
|
||||||
|
1: punctuation.separator.mapping.port.log
|
||||||
|
2: constant.numeric.value.log
|
||||||
|
#- include: scope:text.html.markdown#url-escaped-chars
|
||||||
|
- match: (%)\h{2}
|
||||||
|
scope: markup.underline.link.path.log constant.character.escape.url.log
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.escape.log
|
||||||
|
# After a valid domain, zero or more non-space non-< characters may follow
|
||||||
|
- match: (?=[?!.,:*_~]*[\s<]) # Trailing punctuation (specifically, ?, !, ., ,, :, *, _, and ~) will not be considered part of the autolink, though they may be included in the interior of the link
|
||||||
|
pop: true
|
||||||
|
- match: \( # When an autolink ends in ), we scan the entire autolink for the total number of parentheses. If there is a greater number of closing parentheses than opening ones, we don’t consider the last character part of the autolink, in order to facilitate including an autolink inside a parenthesis
|
||||||
|
push:
|
||||||
|
- meta_scope: markup.underline.link.path.log
|
||||||
|
- match: (?=[?!.,:*_~]*[\s<])
|
||||||
|
pop: true
|
||||||
|
- match: \)
|
||||||
|
pop: true
|
||||||
|
- match: (?=\)[?!.,:*_~]*[\s<])
|
||||||
|
pop: true
|
||||||
|
- match: '[^?!.,:*_~\s<&()%]+|\S'
|
||||||
|
scope: markup.underline.link.path.log
|
||||||
|
- match: ''
|
||||||
|
pop: true
|
1
assets/syntaxes/02_Extra/requirementstxt
vendored
1
assets/syntaxes/02_Extra/requirementstxt
vendored
Submodule assets/syntaxes/02_Extra/requirementstxt deleted from 775e6dd62a
@@ -1,19 +0,0 @@
|
|||||||
%YAML 1.2
|
|
||||||
---
|
|
||||||
# http://www.sublimetext.com/docs/3/syntax.html
|
|
||||||
name: requirements.txt
|
|
||||||
file_extensions:
|
|
||||||
- requirements.txt
|
|
||||||
scope: source.requirementstxt
|
|
||||||
contexts:
|
|
||||||
main:
|
|
||||||
- match: (#).*$\n?
|
|
||||||
scope: comment.line.requirementstxt
|
|
||||||
captures:
|
|
||||||
1: punctuation.definition.comment.requirementstxt
|
|
||||||
- match: '(?i)^[a-z0-9_\-\.]+'
|
|
||||||
scope: string.package_name.requirementstxt
|
|
||||||
- match: (?i)==|<|<=|>=|>
|
|
||||||
scope: keyword.operator.logical.punctuation.requirementstxt
|
|
||||||
- match: '(?i)\d+\.[\da-z\-_\.]*'
|
|
||||||
scope: constant.numeric.verions.requirementstxt
|
|
2
assets/syntaxes/02_Extra/ssh-config
vendored
2
assets/syntaxes/02_Extra/ssh-config
vendored
Submodule assets/syntaxes/02_Extra/ssh-config updated: 201816b609...e1012e9f13
60
assets/syntaxes/02_Extra/syntax_test_csv.csv
vendored
Normal file
60
assets/syntaxes/02_Extra/syntax_test_csv.csv
vendored
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
# SYNTAX TEST "CSV.sublime-syntax"
|
||||||
|
Forename,Surname,House No.,Street,City,Postcode
|
||||||
|
#^^^^^^^ meta.field-1
|
||||||
|
# ^ punctuation.separator.sequence
|
||||||
|
# ^^^^^^^ meta.field-2
|
||||||
|
# ^ punctuation.separator.sequence
|
||||||
|
# ^^^^^^^^^ meta.field-3
|
||||||
|
# ^ punctuation.separator.sequence
|
||||||
|
# ^^^^^^ meta.field-4
|
||||||
|
# ^ punctuation.separator.sequence
|
||||||
|
# ^^^^ meta.field-1
|
||||||
|
# ^ punctuation.separator.sequence
|
||||||
|
# ^^^^^^^^ meta.field-2
|
||||||
|
John,Doe,87,Logon Road,Citiville,TU43 6GH
|
||||||
|
#^^^ meta.field-1
|
||||||
|
# ^ punctuation.separator.sequence
|
||||||
|
# ^^^ meta.field-2
|
||||||
|
# ^ punctuation.separator.sequence
|
||||||
|
# ^^ meta.field-3
|
||||||
|
# ^ punctuation.separator.sequence
|
||||||
|
# ^^^^^^^^^^ meta.field-4
|
||||||
|
# ^ punctuation.separator.sequence
|
||||||
|
# ^^^^^^^^^ meta.field-1
|
||||||
|
# ^ punctuation.separator.sequence
|
||||||
|
# ^^^^^^^^ meta.field-2
|
||||||
|
Jane,Doe,22,"""Fun"" Street","The City, County",FA90 1XA
|
||||||
|
#^^^ meta.field-1
|
||||||
|
# ^ punctuation.separator.sequence
|
||||||
|
# ^^^ meta.field-2
|
||||||
|
# ^ punctuation.separator.sequence
|
||||||
|
# ^^ meta.field-3
|
||||||
|
# ^ punctuation.separator.sequence
|
||||||
|
# ^^^^^^^^^^^^^^^^ meta.field-4 string.quoted.double
|
||||||
|
# ^^ constant.character.escape
|
||||||
|
# ^^ constant.character.escape
|
||||||
|
# ^ punctuation.separator.sequence
|
||||||
|
# ^ meta.field-1 string.quoted.double punctuation.definition.string.begin
|
||||||
|
# ^^^^^^^^^^^^^^^^^ meta.field-1 string.quoted.double
|
||||||
|
# ^ meta.field-1 string.quoted.double punctuation.definition.string.end
|
||||||
|
# ^ punctuation.separator.sequence
|
||||||
|
# ^^^^^^^^ meta.field-2
|
||||||
|
Fred,Bloggs,"19","Street
|
||||||
|
#^^^ meta.field-1
|
||||||
|
# ^ punctuation.separator.sequence
|
||||||
|
# ^^^^^^ meta.field-2
|
||||||
|
# ^ punctuation.separator.sequence
|
||||||
|
# ^^^ meta.field-3 string.quoted.double
|
||||||
|
# ^ punctuation.separator.sequence
|
||||||
|
# ^ meta.field-4 punctuation.definition.string.begin
|
||||||
|
# ^^^^^^^^ meta.field-4 string.quoted.double
|
||||||
|
Spanning Multiple ""
|
||||||
|
#^^^^^^^^^^^^^^^^^^^^ meta.field-4 string.quoted.double
|
||||||
|
# ^^ constant.character.escape
|
||||||
|
Lines",Citee,P0stc0d3
|
||||||
|
#^^^^^ meta.field-4 string.quoted.double
|
||||||
|
# ^ meta.field-4 punctuation.definition.string.end
|
||||||
|
# ^ punctuation.separator.sequence
|
||||||
|
# ^^^^^ meta.field-1
|
||||||
|
# ^ punctuation.separator.sequence
|
||||||
|
# ^^^^^^^^ meta.field-2
|
Can't render this file because it contains an unexpected character in line 1 and column 15.
|
60
assets/syntaxes/02_Extra/syntax_test_tsv.tsv
vendored
Normal file
60
assets/syntaxes/02_Extra/syntax_test_tsv.tsv
vendored
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
# SYNTAX TEST "CSV.sublime-syntax"
|
||||||
|
Forename Surname House No. Street City Postcode
|
||||||
|
#^^^^^^^ meta.field-1
|
||||||
|
# ^ punctuation.separator.sequence
|
||||||
|
# ^^^^^^^ meta.field-2
|
||||||
|
# ^ punctuation.separator.sequence
|
||||||
|
# ^^^^^^^^^ meta.field-3
|
||||||
|
# ^ punctuation.separator.sequence
|
||||||
|
# ^^^^^^ meta.field-4
|
||||||
|
# ^ punctuation.separator.sequence
|
||||||
|
# ^^^^ meta.field-1
|
||||||
|
# ^ punctuation.separator.sequence
|
||||||
|
# ^^^^^^^^ meta.field-2
|
||||||
|
John Doe 87 Logon Road Citiville TU43 6GH
|
||||||
|
#^^^ meta.field-1
|
||||||
|
# ^ punctuation.separator.sequence
|
||||||
|
# ^^^ meta.field-2
|
||||||
|
# ^ punctuation.separator.sequence
|
||||||
|
# ^^ meta.field-3
|
||||||
|
# ^ punctuation.separator.sequence
|
||||||
|
# ^^^^^^^^^^ meta.field-4
|
||||||
|
# ^ punctuation.separator.sequence
|
||||||
|
# ^^^^^^^^^ meta.field-1
|
||||||
|
# ^ punctuation.separator.sequence
|
||||||
|
# ^^^^^^^^ meta.field-2
|
||||||
|
Jane Doe 22 """Fun"" Street" "The City County" FA90 1XA
|
||||||
|
#^^^ meta.field-1
|
||||||
|
# ^ punctuation.separator.sequence
|
||||||
|
# ^^^ meta.field-2
|
||||||
|
# ^ punctuation.separator.sequence
|
||||||
|
# ^^ meta.field-3
|
||||||
|
# ^ punctuation.separator.sequence
|
||||||
|
# ^^^^^^^^^^^^^^^^ meta.field-4 string.quoted.double
|
||||||
|
# ^^ constant.character.escape
|
||||||
|
# ^^ constant.character.escape
|
||||||
|
# ^ punctuation.separator.sequence
|
||||||
|
# ^ meta.field-1 string.quoted.double punctuation.definition.string.begin
|
||||||
|
# ^^^^^^^^^^^^^^^^^ meta.field-1 string.quoted.double
|
||||||
|
# ^ meta.field-1 string.quoted.double punctuation.definition.string.end
|
||||||
|
# ^ punctuation.separator.sequence
|
||||||
|
# ^^^^^^^^ meta.field-2
|
||||||
|
Fred Bloggs "19" "Street
|
||||||
|
#^^^ meta.field-1
|
||||||
|
# ^ punctuation.separator.sequence
|
||||||
|
# ^^^^^^ meta.field-2
|
||||||
|
# ^ punctuation.separator.sequence
|
||||||
|
# ^^^ meta.field-3 string.quoted.double
|
||||||
|
# ^ punctuation.separator.sequence
|
||||||
|
# ^ meta.field-4 punctuation.definition.string.begin
|
||||||
|
# ^^^^^^^^ meta.field-4 string.quoted.double
|
||||||
|
Spanning Multiple ""
|
||||||
|
#^^^^^^^^^^^^^^^^^^^^ meta.field-4 string.quoted.double
|
||||||
|
# ^^ constant.character.escape
|
||||||
|
Lines" Citee P0stc0d3
|
||||||
|
#^^^^^ meta.field-4 string.quoted.double
|
||||||
|
# ^ meta.field-4 punctuation.definition.string.end
|
||||||
|
# ^ punctuation.separator.sequence
|
||||||
|
# ^^^^^ meta.field-1
|
||||||
|
# ^ punctuation.separator.sequence
|
||||||
|
# ^^^^^^^^ meta.field-2
|
Can't render this file because it contains an unexpected character in line 1 and column 15.
|
63
assets/syntaxes/02_Extra/syslog.sublime-syntax
vendored
Normal file
63
assets/syntaxes/02_Extra/syslog.sublime-syntax
vendored
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
# http://www.sublimetext.com/docs/3/syntax.html
|
||||||
|
name: syslog
|
||||||
|
file_extensions:
|
||||||
|
- syslog
|
||||||
|
scope: text.log.syslog
|
||||||
|
contexts:
|
||||||
|
main:
|
||||||
|
- match: ^(\w+\s+\d+)\s+(\d{2}:\d{2}:\d{2})
|
||||||
|
scope: meta.datetime.syslog constant.numeric.syslog
|
||||||
|
captures:
|
||||||
|
1: meta.date.syslog
|
||||||
|
2: meta.time.syslog
|
||||||
|
push: loghost
|
||||||
|
- match: ^
|
||||||
|
push: text
|
||||||
|
loghost:
|
||||||
|
- match: '[\w:.-]+'
|
||||||
|
scope: entity.other.attribute-name.loghost.syslog
|
||||||
|
set: process
|
||||||
|
process:
|
||||||
|
- match: ([\w.-]+)(?:(\[)(\d+)(\]))?([ :])
|
||||||
|
captures:
|
||||||
|
1: support.function.process.syslog
|
||||||
|
2: punctuation.separator.pid.begin.syslog
|
||||||
|
3: meta.pid.syslog meta.number.integer.syslog constant.numeric.value.syslog
|
||||||
|
4: punctuation.separator.pid.end.syslog
|
||||||
|
5: punctuation.separator.mapping.syslog
|
||||||
|
set: structured-data
|
||||||
|
structured-data:
|
||||||
|
- match: '\['
|
||||||
|
scope: punctuation.section.mapping.begin.syslog
|
||||||
|
push:
|
||||||
|
- match: \]
|
||||||
|
scope: punctuation.section.mapping.end.syslog
|
||||||
|
pop: true
|
||||||
|
- match: \w+
|
||||||
|
scope: variable.parameter.syslog
|
||||||
|
- match: =
|
||||||
|
scope: keyword.operator.assignment.syslog
|
||||||
|
push:
|
||||||
|
- match: '[^\s\]]+'
|
||||||
|
scope: constant.other.syslog
|
||||||
|
pop: true
|
||||||
|
- match: (?=\])
|
||||||
|
pop: true
|
||||||
|
- match: (?=\S)
|
||||||
|
set: text
|
||||||
|
text:
|
||||||
|
- match: $
|
||||||
|
pop: true
|
||||||
|
- match: '<\w+>'
|
||||||
|
scope: constant.language.syslog
|
||||||
|
- match: \b(CMD)\b\s+(\()
|
||||||
|
captures:
|
||||||
|
1: entity.name.label.syslog
|
||||||
|
2: punctuation.section.block.begin.syslog
|
||||||
|
embed: scope:source.shell.bash
|
||||||
|
escape: \)$
|
||||||
|
escape_captures:
|
||||||
|
0: punctuation.section.block.end.syslog
|
||||||
|
- include: scope:text.log
|
BIN
assets/themes.bin
vendored
BIN
assets/themes.bin
vendored
Binary file not shown.
1
assets/themes/visual-studio-dark-plus
vendored
Submodule
1
assets/themes/visual-studio-dark-plus
vendored
Submodule
Submodule assets/themes/visual-studio-dark-plus added at 01ee1e8e0d
2
assets/themes/zenburn
vendored
2
assets/themes/zenburn
vendored
Submodule assets/themes/zenburn updated: 7f6fb86e0d...702023d80d
10
build.rs
10
build.rs
@@ -54,11 +54,21 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
"assets/manual/bat.1.in",
|
"assets/manual/bat.1.in",
|
||||||
out_dir.join("assets/manual/bat.1"),
|
out_dir.join("assets/manual/bat.1"),
|
||||||
)?;
|
)?;
|
||||||
|
template(
|
||||||
|
&variables,
|
||||||
|
"assets/completions/bat.bash.in",
|
||||||
|
out_dir.join("assets/completions/bat.bash"),
|
||||||
|
)?;
|
||||||
template(
|
template(
|
||||||
&variables,
|
&variables,
|
||||||
"assets/completions/bat.fish.in",
|
"assets/completions/bat.fish.in",
|
||||||
out_dir.join("assets/completions/bat.fish"),
|
out_dir.join("assets/completions/bat.fish"),
|
||||||
)?;
|
)?;
|
||||||
|
template(
|
||||||
|
&variables,
|
||||||
|
"assets/completions/_bat.ps1.in",
|
||||||
|
out_dir.join("assets/completions/_bat.ps1"),
|
||||||
|
)?;
|
||||||
template(
|
template(
|
||||||
&variables,
|
&variables,
|
||||||
"assets/completions/bat.zsh.in",
|
"assets/completions/bat.zsh.in",
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="logo-header.svg" alt="bat - a cat clone with wings"><br>
|
<img src="logo-header.svg" alt="bat - a cat clone with wings"><br>
|
||||||
<a href="https://travis-ci.org/sharkdp/bat"><img src="https://travis-ci.org/sharkdp/bat.svg?branch=master" alt="Build Status"></a>
|
<a href="https://github.com/sharkdp/bat/actions?query=workflow%3ACICD"><img src="https://github.com/sharkdp/bat/workflows/CICD/badge.svg" alt="Build Status"></a>
|
||||||
<a href="https://ci.appveyor.com/project/sharkdp/bat"><img src="https://ci.appveyor.com/api/projects/status/cptsmtbiwbnr2vhf?svg=true"></a>
|
|
||||||
<img src="https://img.shields.io/crates/l/bat.svg" alt="license">
|
<img src="https://img.shields.io/crates/l/bat.svg" alt="license">
|
||||||
<a href="https://crates.io/crates/bat"><img src="https://img.shields.io/crates/v/bat.svg?colorB=319e8c" alt="Version info"></a><br>
|
<a href="https://crates.io/crates/bat"><img src="https://img.shields.io/crates/v/bat.svg?colorB=319e8c" alt="Version info"></a><br>
|
||||||
シンタックスハイライトとGitとの連携機能付きの <i>cat(1)</i> クローン。
|
シンタックスハイライトとGitとの連携機能付きの <i>cat(1)</i> クローン。
|
||||||
@@ -12,8 +11,12 @@
|
|||||||
<a href="#使い方">使い方</a> •
|
<a href="#使い方">使い方</a> •
|
||||||
<a href="#インストール">インストール</a> •
|
<a href="#インストール">インストール</a> •
|
||||||
<a href="#カスタマイズ">カスタマイズ</a> •
|
<a href="#カスタマイズ">カスタマイズ</a> •
|
||||||
<a href="#プロジェクトの目標と既存の類似したOSS">プロジェクトの目標と既存の類似したOSS</a> •
|
<a href="#プロジェクトの目標と既存の類似したOSS">プロジェクトの目標と既存の類似したOSS</a><br>
|
||||||
翻訳 [<a href="https://github.com/chinanf-boy/bat-zh">中文</a>][<a href="README-ja.md">日本語</a>][<a href="README-ko.md">한국어</a>]
|
[<a href="../README.md">English</a>]
|
||||||
|
[<a href="README-zh.md">中文</a>]
|
||||||
|
[日本語]
|
||||||
|
[<a href="README-ko.md">한국어</a>]
|
||||||
|
[<a href="README-ru.md">Русский</a>]
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
### シンタックスハイライト
|
### シンタックスハイライト
|
||||||
@@ -95,6 +98,17 @@ bat f - g # output 'f', then stdin, then 'g'.
|
|||||||
|
|
||||||
### 他のツールとの統合
|
### 他のツールとの統合
|
||||||
|
|
||||||
|
#### `fzf`
|
||||||
|
|
||||||
|
[`fzf`](https://github.com/junegunn/fzf) のプレビューウィンドウに `bat` を使用できます。
|
||||||
|
その場合、`bat` の `--color=always` オプションを用いてカラー出力を強制しなければなりません。
|
||||||
|
また、`--line-range` オプションを用いることで巨大なファイルの読み込み時間を制限できます:
|
||||||
|
```bash
|
||||||
|
fzf --preview 'bat --color=always --style=numbers --line-range=:500 {}'
|
||||||
|
```
|
||||||
|
|
||||||
|
詳しくは [`fzf` の `README`](https://github.com/junegunn/fzf#preview-window) を参照してください。
|
||||||
|
|
||||||
#### `find` or `fd`
|
#### `find` or `fd`
|
||||||
|
|
||||||
`find` の `-exec` オプションを使用して、`bat` ですべての検索結果をプレビューできます:
|
`find` の `-exec` オプションを使用して、`bat` ですべての検索結果をプレビューできます:
|
||||||
@@ -191,7 +205,7 @@ ln -s /usr/bin/batcat ~/.local/bin/bat
|
|||||||
batの最新リリースを実行する場合、または Ubuntu/Debian の古いバージョンを使用している場合は、[release page](https://github.com/sharkdp/bat/releases) から最新の `.deb` パッケージをダウンロードし、
|
batの最新リリースを実行する場合、または Ubuntu/Debian の古いバージョンを使用している場合は、[release page](https://github.com/sharkdp/bat/releases) から最新の `.deb` パッケージをダウンロードし、
|
||||||
次の方法でインストールします:
|
次の方法でインストールします:
|
||||||
```bash
|
```bash
|
||||||
sudo dpkg -i bat_0.18.0_amd64.deb # adapt version number and architecture
|
sudo dpkg -i bat_0.18.3_amd64.deb # adapt version number and architecture
|
||||||
```
|
```
|
||||||
|
|
||||||
### On Alpine Linux
|
### On Alpine Linux
|
||||||
@@ -352,7 +366,7 @@ ansible-galaxy install aeimer.install_bat
|
|||||||
### From source
|
### From source
|
||||||
|
|
||||||
|
|
||||||
`bat` をソースからビルドしたいならば、Rust 1.36 以上の環境が必要です。
|
`bat` をソースからビルドしたいならば、Rust 1.51 以上の環境が必要です。
|
||||||
`cargo` を使用してビルドすることができます:
|
`cargo` を使用してビルドすることができます:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -393,7 +407,7 @@ bat --list-themes | fzf --preview="bat --theme={} --color=always /path/to/file"
|
|||||||
|
|
||||||
### 新しい構文の追加 / 言語の定義
|
### 新しい構文の追加 / 言語の定義
|
||||||
|
|
||||||
`bat` はシンタックスハイライトのための [`syntext`](https://github.com/trishume/syntect/)
|
`bat` はシンタックスハイライトのための [`syntect`](https://github.com/trishume/syntect/)
|
||||||
という素晴らしいライブラリを使用しています。`syntect` は、
|
という素晴らしいライブラリを使用しています。`syntect` は、
|
||||||
[Sublime Text の `.sublime-syntax` ファイル](https://www.sublimetext.com/docs/3/syntax.html)
|
[Sublime Text の `.sublime-syntax` ファイル](https://www.sublimetext.com/docs/3/syntax.html)
|
||||||
とテーマを読み取ることができます。新しい構文を定義するために以下の手順を行います。
|
とテーマを読み取ることができます。新しい構文を定義するために以下の手順を行います。
|
||||||
@@ -511,7 +525,7 @@ export BAT_CONFIG_PATH="/path/to/bat.conf"
|
|||||||
# Use italic text on the terminal (not supported on all terminals)
|
# Use italic text on the terminal (not supported on all terminals)
|
||||||
--italic-text=always
|
--italic-text=always
|
||||||
|
|
||||||
# Use C++ syntax for .ino files
|
# Use C++ syntax for Arduino .ino files
|
||||||
--map-syntax "*.ino:C++"
|
--map-syntax "*.ino:C++"
|
||||||
|
|
||||||
# Use ".gitignore"-style highlighting for ".ignore" files
|
# Use ".gitignore"-style highlighting for ".ignore" files
|
||||||
@@ -630,7 +644,7 @@ cargo install --locked --force
|
|||||||
比較については [このドキュメント](alternatives.md) を参照してください。
|
比較については [このドキュメント](alternatives.md) を参照してください。
|
||||||
|
|
||||||
## ライセンス
|
## ライセンス
|
||||||
Copyright (c) 2018-2020 [bat-developers](https://github.com/sharkdp/bat).
|
Copyright (c) 2018-2021 [bat-developers](https://github.com/sharkdp/bat).
|
||||||
|
|
||||||
`bat` は MIT License 及び Apache License 2.0 の両方の条件の下で配布されています。
|
`bat` は MIT License 及び Apache License 2.0 の両方の条件の下で配布されています。
|
||||||
|
|
||||||
|
645
doc/README-ko.md
645
doc/README-ko.md
@@ -1,51 +1,64 @@
|
|||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="../doc/logo-header.svg" alt="bat - a cat clone with wings"><br>
|
<img src="logo-header.svg" alt="bat - a cat clone with wings"><br>
|
||||||
<a href="https://travis-ci.org/sharkdp/bat"><img src="https://travis-ci.org/sharkdp/bat.svg?branch=master" alt="Build Status"></a>
|
<a href="https://github.com/sharkdp/bat/actions?query=workflow%3ACICD"><img src="https://github.com/sharkdp/bat/workflows/CICD/badge.svg" alt="Build Status"></a>
|
||||||
<a href="https://ci.appveyor.com/project/sharkdp/bat"><img src="https://ci.appveyor.com/api/projects/status/cptsmtbiwbnr2vhf/branch/master?svg=true"></a>
|
|
||||||
<img src="https://img.shields.io/crates/l/bat.svg" alt="license">
|
<img src="https://img.shields.io/crates/l/bat.svg" alt="license">
|
||||||
<a href="https://crates.io/crates/bat"><img src="https://img.shields.io/crates/v/bat.svg?colorB=319e8c" alt="Version info"></a><br>
|
<a href="https://crates.io/crates/bat"><img src="https://img.shields.io/crates/v/bat.svg?colorB=319e8c" alt="Version info"></a><br>
|
||||||
|
문법 강조와 Git 통합 기능의 <i>cat(1)</i> 클론
|
||||||
문법 강조와 깃 통합 기능의 <i>cat(1)</i> 클론
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="#문법-강조">주요 기능들</a> •
|
<a href="#문법-강조">주요 기능들</a> •
|
||||||
<a href="#사용법">사용법</a> •
|
<a href="#사용법">사용법</a> •
|
||||||
<a href="#설치">설치</a> •
|
<a href="#설치">설치</a> •
|
||||||
<a href="#커스터마이즈">커스터마이즈</a> •
|
<a href="#사용자화">사용자화</a> •
|
||||||
<a href="#프로젝트-목표와-대안들">프로젝트 목표와 대안들</a> •
|
<a href="#프로젝트-목표와-대안들">프로젝트 목표와 대안들</a><br>
|
||||||
번역 [<a href="https://github.com/chinanf-boy/bat-zh">中文</a>][<a href="../doc/README-ja.md">日本語</a>]
|
[<a href="../README.md">English</a>]
|
||||||
|
[<a href="README-zh.md">中文</a>]
|
||||||
|
[<a href="README-ja.md">日本語</a>]
|
||||||
|
[한국어]
|
||||||
|
[<a href="README-ru.md">Русский</a>]
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
### 문법 강조
|
### 문법 강조
|
||||||
|
|
||||||
`bat`은 다양한 프로그래밍 언어와 마크업 언어에 대해 문법 강조(Syntax highlighting)기능을 지원하고 있습니다:
|
`bat`은 다양한 프로그래밍 및 마크업 언어의 문법 강조(syntax highlighting) 기능을
|
||||||
|
지원합니다:
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### Git 통합
|
### Git 통합
|
||||||
|
|
||||||
`bat`은 `git`을 통해 인덱스와 함께 변경분을 표시합니다 (왼쪽 바를 확인하세요):
|
`bat`은 `git`을 통해 인덱스와 함께 변경분을 표시합니다
|
||||||
|
(왼쪽 사이드바를 확인하세요):
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### 표시할 수 없는 문자 처리
|
### 비인쇄 문자 처리
|
||||||
|
|
||||||
`-A`/`--show-all` 옵션을 사용하여 표시할수 없는 문자를 시각화 해줍니다:
|
`-A`/`--show-all` 옵션을 사용하여 비인쇄 문자를 표시 및 강조할 수 있습니다:
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### 자동 페이징
|
### 자동 페이징
|
||||||
|
|
||||||
하나의 화면에 비해 출력이 너무 큰 경우, `less` 를 이용해 출력들을 연결할 수 있습니다.
|
`bat`은 기본적으로 한 화면에 비해 출력이 큰 경우 `less`와 같은 페이저(pager)로
|
||||||
|
출력을 연결(pipe)합니다.
|
||||||
|
만약 `bat`을 언제나 `cat`처럼 작동하게 하려면 (출력을 페이지하지 않기),
|
||||||
|
`--paging=never` 옵션을 커맨드 라인이나 설정 파일에 넣을 수 있습니다.
|
||||||
|
셸(shell) 설정에서 `cat`을 `bat`의 alias로 사용하려면,
|
||||||
|
`alias cat='bat --paging=never'`를 써서 기본 행동을 유지할 수 있습니다.
|
||||||
|
|
||||||
### 파일 연결
|
### 파일 연결(concatenation)
|
||||||
|
|
||||||
이 뿐만 아니라 파일을 연결할 때도 사용 할 수 있습니다. :wink: `bat`가 인터렉티브 하지 않은(non-interactive)가 감지하면 (예를 들어,다른 프로세스 혹은 파일과 파이프라인을 연결 한 경우) `bat`은 `cat`을 대신하여 동작하며 일반 파일 내용을 표기해줍니다.
|
페이저(pager)를 사용하더라도 `bat`은 파일들을 연결(concatenate)할 수 있습니다
|
||||||
|
:wink:.
|
||||||
|
`bat`이 비대화형(non-interactive) 터미널(예를 들어, 다른 프로세스나 파일에
|
||||||
|
연결(pipe)한 경우)을 감지하면, `bat`은 `--pager` 옵션의 값과 상관없이 `cat`과
|
||||||
|
동일하게 파일 내용을 그대로 출력합니다.
|
||||||
|
|
||||||
## 사용법
|
## 사용법
|
||||||
|
|
||||||
터미널에서 하나의 파일 표시하기
|
터미널에 하나의 파일 표시하기
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
> bat README.md
|
> bat README.md
|
||||||
@@ -57,19 +70,21 @@
|
|||||||
> bat src/*.rs
|
> bat src/*.rs
|
||||||
```
|
```
|
||||||
|
|
||||||
stdin에서 읽고, 자동으로 맞는 문법 강조 적용하기
|
stdin에서 읽고, 자동으로 맞는 문법 결정하기 (참고로, 문법 강조는 파일의 첫
|
||||||
|
줄만으로 문법이 결정될 수 있을 때만 작동합니다.
|
||||||
|
이는 보통 `#!/bin/sh`와 같은 셔뱅(shebang)으로 판단합니다.)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
> curl -s https://sh.rustup.rs | bat
|
> curl -s https://sh.rustup.rs | bat
|
||||||
```
|
```
|
||||||
|
|
||||||
stdin에서 읽고, 명시적으로 언어 지정하여 적용하기
|
stdin에서 읽고, 명시적으로 언어 지정하기
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
> yaml2json .travis.yml | json_pp | bat -l json
|
> yaml2json .travis.yml | json_pp | bat -l json
|
||||||
```
|
```
|
||||||
|
|
||||||
표시할 수 없는 문자 처리하기
|
비인쇄 문자 표시 및 강조하기
|
||||||
```bash
|
```bash
|
||||||
> bat -A /etc/hosts
|
> bat -A /etc/hosts
|
||||||
```
|
```
|
||||||
@@ -86,23 +101,38 @@ bat -n main.rs # show line numbers (only)
|
|||||||
bat f - g # output 'f', then stdin, then 'g'.
|
bat f - g # output 'f', then stdin, then 'g'.
|
||||||
```
|
```
|
||||||
|
|
||||||
### 다른 툴과의 통합
|
### 다른 도구들과 통합하기
|
||||||
|
|
||||||
|
#### `fzf`
|
||||||
|
|
||||||
|
`bat`을 [`fzf`](https://github.com/junegunn/fzf)의 프리뷰로 쓸 수 있습니다.
|
||||||
|
이를 위해서는 `bat`의 `--color=always` 옵션으로 항상 컬러 출력이 나오게 해야
|
||||||
|
합니다.
|
||||||
|
또한 `--line-range` 옵션으로 긴 파일의 로드 시간을 제한할 수 있습니다:
|
||||||
|
```bash
|
||||||
|
fzf --preview 'bat --color=always --style=numbers --line-range=:500 {}'
|
||||||
|
```
|
||||||
|
더 많은 정보는
|
||||||
|
[`fzf`의 `README`](https://github.com/junegunn/fzf#preview-window)를 참고하세요.
|
||||||
|
|
||||||
#### `find`와 `fd`
|
#### `find`와 `fd`
|
||||||
|
|
||||||
`find`의 `-exec` 옵션을 사용하여 `bat`의 모든 검색 결과를 미리 볼 수 있습니다:
|
`find`의 `-exec` 옵션을 사용하여 모든 검색 결과를 `bat`로 미리 볼 수 있습니다:
|
||||||
```bash
|
```bash
|
||||||
find … -exec bat {} +
|
find … -exec bat {} +
|
||||||
```
|
```
|
||||||
|
|
||||||
[`fd`](https://github.com/sharkdp/fd)를 사용하고 있는 경우, `-X`/`--exec-batch` 옵션을 이용하여 동일하게 사용할 수 있습니다:
|
[`fd`](https://github.com/sharkdp/fd)를 사용하는 경우, `-X`/`--exec-batch`
|
||||||
|
옵션을 이용하여 동일하게 사용할 수 있습니다:
|
||||||
```bash
|
```bash
|
||||||
fd … -X bat
|
fd … -X bat
|
||||||
```
|
```
|
||||||
|
|
||||||
#### `ripgrep`
|
#### `ripgrep`
|
||||||
|
|
||||||
[`batgrep`](https://github.com/eth-p/bat-extras/blob/master/doc/batgrep.md)과 함께, [`ripgrep`](https://github.com/BurntSushi/ripgrep)의 검색 결과를 `bat`을 이용하여 볼 수 있습니다.
|
[`batgrep`](https://github.com/eth-p/bat-extras/blob/master/doc/batgrep.md)을
|
||||||
|
통해 `bat`로 [`ripgrep`](https://github.com/BurntSushi/ripgrep)의 검색 결과를
|
||||||
|
출력할 수 있습니다.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
batgrep needle src/
|
batgrep needle src/
|
||||||
@@ -110,111 +140,185 @@ batgrep needle src/
|
|||||||
|
|
||||||
#### `tail -f`
|
#### `tail -f`
|
||||||
|
|
||||||
`bat` 과 `tail -f`를 함께 사용하여, 특정 파일을 문법 강조하며 지속적으로 모니터링 할 수 있습니다.
|
`bat`와 `tail -f`를 함께 사용하여 주어진 파일을 문법 강조하며 지속적으로
|
||||||
|
모니터할 수 있습니다.
|
||||||
```bash
|
```bash
|
||||||
tail -f /var/log/pacman.log | bat --paging=never -l log
|
tail -f /var/log/pacman.log | bat --paging=never -l log
|
||||||
```
|
```
|
||||||
이 작업을 하려면 페이징 기능을 꺼야합니다. 또, 자동 감지가 되지 않기 때문에, 적용되어야할 문법을 명시적(`-l log`)으로 지정해야 합니다.
|
참고로 이 작업을 하려면 페이징 기능을 꺼야 합니다.
|
||||||
|
또한 이 경우 문법을 자동 감지할 수 없기 때문에, 적용할 문법을 직접 지정해야
|
||||||
|
합니다 (`-l log`).
|
||||||
|
|
||||||
#### `git`
|
#### `git`
|
||||||
|
|
||||||
`bat`과 `git show`를 함께 사용하여 주어진 파일의 이전 기록을 문법 강조와 함께 볼 수 있습니다:
|
`bat`과 `git show`를 함께 사용하여 주어진 파일의 이전 버전을 올바른 문법 강조로
|
||||||
|
볼 수 있습니다:
|
||||||
```bash
|
```bash
|
||||||
git show v0.6.0:src/main.rs | bat -l rs
|
git show v0.6.0:src/main.rs | bat -l rs
|
||||||
```
|
```
|
||||||
|
|
||||||
diffs 내에서 문법 강조 표시는 현재 지원되지 않습니다. 이 기능은 [`delta`](https://github.com/dandavison/delta)에서 찾아 볼 수 있습니다.
|
#### `git diff`
|
||||||
|
|
||||||
|
`bat`과 `git diff`를 함께 사용하여 수정된 코드 주위의 줄들을 올바른 문법 강조로
|
||||||
|
볼 수 있습니다:
|
||||||
|
```bash
|
||||||
|
batdiff() {
|
||||||
|
git diff --name-only --diff-filter=d | xargs bat --diff
|
||||||
|
}
|
||||||
|
```
|
||||||
|
이것을 별도의 도구로 쓰고 싶다면
|
||||||
|
[`bat-extras`](https://github.com/eth-p/bat-extras)의 `batdiff`를 확인해 보세요.
|
||||||
|
|
||||||
|
Git과 diff의 더 많은 지원을 원한다면
|
||||||
|
[`delta`](https://github.com/dandavison/delta)를 확인해 보세요.
|
||||||
|
|
||||||
#### `xclip`
|
#### `xclip`
|
||||||
|
|
||||||
`bat` 출력에서 라인 넘버와 Git 수정 내역이 같이 있어 파일 내용을 복사하기가 어려울 수도 있습니다. 이 경우에는 `-p`/`--plain` 옵션을 사용 하거나 출력 시 파이프라인으로 `xclip`을 사용하면 됩니다:
|
`bat` 출력에 줄 번호와 Git 수정 내역이 포함되어서 파일의 내용을 복사하기
|
||||||
|
어려울 수 있습니다.
|
||||||
|
이 경우에는 `bat`의 `-p`/`--plain` 옵션을 사용하거나 간단히 `xclip`으로 출력을
|
||||||
|
연결(pipe)하면 됩니다:
|
||||||
```bash
|
```bash
|
||||||
bat main.cpp | xclip
|
bat main.cpp | xclip
|
||||||
```
|
```
|
||||||
`bat` 에서는 리다이렉트된 것으로 감지하여, 파일 내용만 출력합니다.
|
`bat`는 출력이 우회되고 있다는 것을 감지하여 파일 내용 그대로를 출력합니다.
|
||||||
|
|
||||||
#### `man`
|
#### `man`
|
||||||
|
|
||||||
`bat`은 `MANPAGER` 환경 변수 설정을 통해 `man`에 대하여 컬러 페이져를 사용할 수 있습니다:
|
`MANPAGER` 환경 변수 설정을 통해 `bat`을 `man`의 컬러 페이저(pager)로 쓸 수
|
||||||
|
있습니다.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
|
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
|
||||||
man 2 select
|
man 2 select
|
||||||
```
|
```
|
||||||
|
(Debian이나 Ubuntu를 사용한다면 `bat`을 `batcat`으로 치환하세요.)
|
||||||
|
|
||||||
포매팅 문제가 발생한다면, `MANROFFOPT="-c"` 설정 해야 할 수도 있습니다 .
|
포팻 문제가 발생한다면, `MANROFFOPT="-c"`을 써야 할 수 있습니다.
|
||||||
|
|
||||||
새 커맨드에서 이 번들을 사용하려면, [`batman`](https://github.com/eth-p/bat-extras/blob/master/doc/batman.md)을 이용 할 수 있습니다.
|
이 기능을 포함한 새로운 명령어를 선호한다면,
|
||||||
|
[`batman`](https://github.com/eth-p/bat-extras/blob/master/doc/batman.md)을 쓸
|
||||||
|
수도 있습니다.
|
||||||
|
|
||||||
|
참고로 [Manpage 문법](../assets/syntaxes/Manpage.sublime-syntax)은 본 저장소에서
|
||||||
|
개발 중에 있으며, 아직 더 손봐야 합니다.
|
||||||
|
|
||||||
참고 : [Manpage syntax](../assets/syntaxes/Manpage.sublime-syntax)는 이 저장소에서 개발되고 있으며, 아직 작업 중 입니다.
|
또한, 이는 Mandoc의 `man` 구현에서
|
||||||
|
[작동하지 않습니다](https://github.com/sharkdp/bat/issues/1145).
|
||||||
|
|
||||||
#### `prettier` / `shfmt` / `rustfmt`
|
#### `prettier` / `shfmt` / `rustfmt`
|
||||||
|
|
||||||
[`prettybat`](https://github.com/eth-p/bat-extras/blob/master/doc/prettybat.md) 스크립트는 코드를 포맷팅하고 `bat`으로 출력해주는 랩퍼(wrapper) 입니다.
|
[`prettybat`](https://github.com/eth-p/bat-extras/blob/master/doc/prettybat.md)
|
||||||
|
스크립트는 코드를 포맷하고 `bat`으로 출력하는 래퍼(wrapper)입니다.
|
||||||
|
|
||||||
|
|
||||||
## 설치
|
## 설치
|
||||||
|
|
||||||
[](https://repology.org/project/bat/versions)
|
[](https://repology.org/project/bat-cat/versions)
|
||||||
|
|
||||||
### On Ubuntu
|
### Ubuntu에서 (`apt` 사용)
|
||||||
*... 그리고 기타 Debian 기반의 Linux 배포판들.*
|
*... 그리고 다른 Debian 기반의 Linux 배포판들에서.*
|
||||||
|
|
||||||
Ubuntu Eoan 19.10 혹은 Debian unstable sid 이후 버전 부터는 [Ubuntu용 `bat` 패키지](https://packages.ubuntu.com/eoan/bat)나 [Debian용 `bat` 패키지](https://packages.debian.org/sid/bat) 를 설치 할 수 있습니다.
|
`bat`은 [Ubuntu](https://packages.ubuntu.com/eoan/bat)와
|
||||||
|
[Debian](https://packages.debian.org/sid/bat) 패키지 배포 과정에 도입되는 중이며,
|
||||||
|
Eoan 19.10 버전의 Ubuntu에서부터 제공됩니다.
|
||||||
|
현재 Debian에서는 불안정한 "Sid" 브랜치에서만 `bat`이 제공됩니다.
|
||||||
|
|
||||||
|
만약 충분히 최신 버전의 Ubuntu/Debian이 설치되어 있다면 간단히 다음을 실행하세요:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
apt install bat
|
apt install bat
|
||||||
```
|
```
|
||||||
|
|
||||||
만약 최근 릴리즈된 bat을 사용을 원하거나 buntu/Debian 예전 버전을 사용하는 경우, [릴리즈 페이지](https://github.com/sharkdp/bat/releases)에서 다음과 같이 `.deb` 패키지를 받아 설치 할 수도 있습니다:
|
**중요**: 만약 `bat`을 이와 같이 설치한다면, ([다른 패키지와의 이름
|
||||||
|
충돌](https://github.com/sharkdp/bat/issues/982)로 인하여) `bat` 대신에
|
||||||
|
`batcat`이라는 이름의 실행 파일로 설치될 수 있음을 참고하세요.
|
||||||
|
이에 따른 문제들과 다른 배포판들과의 일관성을 위하여 `bat -> batcat` symlink
|
||||||
|
혹은 alias를 설정할 수 있습니다:
|
||||||
``` bash
|
``` bash
|
||||||
sudo dpkg -i bat_0.18.0_amd64.deb # adapt version number and architecture
|
mkdir -p ~/.local/bin
|
||||||
|
ln -s /usr/bin/batcat ~/.local/bin/bat
|
||||||
```
|
```
|
||||||
|
|
||||||
### On Alpine Linux
|
### Ubuntu에서 (가장 최신 `.deb` 패키지들 사용)
|
||||||
|
*... 그리고 다른 Debian 기반의 Linux 배포판들에서.*
|
||||||
|
|
||||||
공식 소스를 통해 [`bat` 패키지](https://pkgs.alpinelinux.org/packages?name=bat) 를 설치 할 수 있습니다:
|
만약 여러분이 설치한 Ubuntu/Debian에 패키지가 배포되지 않거나 가장 최신 릴리즈된
|
||||||
|
`bat`을 원한다면, [릴리즈 페이지](https://github.com/sharkdp/bat/releases)에서
|
||||||
|
다음과 같이 `.deb` 패키지를 받아 설치하세요:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo dpkg -i bat_0.18.3_amd64.deb # adapt version number and architecture
|
||||||
|
```
|
||||||
|
|
||||||
|
### Alpine Linux에서
|
||||||
|
|
||||||
|
적절한 저장소가 활성화되어 있다면, 공식 소스를 통해
|
||||||
|
[`bat` 패키지](https://pkgs.alpinelinux.org/packages?name=bat)를 설치할 수
|
||||||
|
있습니다:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
apk add bat
|
apk add bat
|
||||||
```
|
```
|
||||||
|
|
||||||
### On Arch Linux
|
### Arch Linux에서
|
||||||
|
|
||||||
공식 소스를 통해 [`bat` 패키지](https://www.archlinux.org/packages/community/x86_64/bat/)를 설치할 수 있습니다:
|
공식 소스를 통해
|
||||||
|
[`bat` 패키지](https://www.archlinux.org/packages/community/x86_64/bat/)를
|
||||||
|
설치할 수 있습니다:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pacman -S bat
|
pacman -S bat
|
||||||
```
|
```
|
||||||
|
|
||||||
### On Fedora
|
### Fedora에서
|
||||||
|
|
||||||
[공식 Fedora 모듈 저장소](https://docs.fedoraproject.org/en-US/modularity/using-modules/)에서 [`bat` 패키지](https://koji.fedoraproject.org/koji/packageinfo?packageID=27506)을 설치할 수 있습니다:
|
공식
|
||||||
|
[Fedora 모듈](https://docs.fedoraproject.org/en-US/modularity/using-modules/)
|
||||||
|
저장소에서
|
||||||
|
[`bat` 패키지](https://koji.fedoraproject.org/koji/packageinfo?packageID=27506)를
|
||||||
|
설치할 수 있습니다:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
dnf install bat
|
dnf install bat
|
||||||
```
|
```
|
||||||
|
|
||||||
### On Gentoo Linux
|
### Funtoo Linux에서
|
||||||
|
|
||||||
공식 소스를 통해 [`bat` 패키지](https://packages.gentoo.org/packages/sys-apps/bat)를 설치할 수 있습니다.
|
dev-kit을 통해 [`bat` 패키지](https://github.com/funtoo/dev-kit/tree/1.4-release/sys-apps/bat)를 설치할 수 있습니다:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
emerge sys-apps/bat
|
emerge sys-apps/bat
|
||||||
```
|
```
|
||||||
|
|
||||||
### On Void Linux
|
### Gentoo Linux에서
|
||||||
|
|
||||||
xbps-install를 이용해 `bat`을 설치할 수 있습니다:
|
공식 소스를 통해
|
||||||
|
[`bat` 패키지](https://packages.gentoo.org/packages/sys-apps/bat)를 설치할 수
|
||||||
|
있습니다:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
emerge sys-apps/bat
|
||||||
|
```
|
||||||
|
|
||||||
|
### Void Linux에서
|
||||||
|
|
||||||
|
xbps-install을 이용해 `bat`을 설치할 수 있습니다:
|
||||||
```bash
|
```bash
|
||||||
xbps-install -S bat
|
xbps-install -S bat
|
||||||
```
|
```
|
||||||
|
|
||||||
### On FreeBSD
|
### Termux에서
|
||||||
|
|
||||||
pkg를 이용하여 미리 컴파일된 [`bat` 패키지](https://www.freshports.org/textproc/bat)를 설치할 수 있습니다:
|
pkg를 이용해 `bat`을 설치할 수 있습니다:
|
||||||
|
```bash
|
||||||
|
pkg install bat
|
||||||
|
```
|
||||||
|
|
||||||
|
### FreeBSD에서
|
||||||
|
|
||||||
|
pkg를 이용하여 미리 컴파일된
|
||||||
|
[`bat` 패키지](https://www.freshports.org/textproc/bat)를 설치할 수 있습니다:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pkg install bat
|
pkg install bat
|
||||||
@@ -227,133 +331,176 @@ cd /usr/ports/textproc/bat
|
|||||||
make install
|
make install
|
||||||
```
|
```
|
||||||
|
|
||||||
### Via nix
|
### nix를 써서
|
||||||
|
|
||||||
[nix package manager](https://nixos.org/nix)를 이용해 `bat`을 설치할 수 있습니다:
|
[nix package manager](https://nixos.org/nix)를 이용해 `bat`을 설치할 수
|
||||||
|
있습니다:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
nix-env -i bat
|
nix-env -i bat
|
||||||
```
|
```
|
||||||
|
|
||||||
### On openSUSE
|
### openSUSE에서
|
||||||
|
|
||||||
zypper을 이용해 `bat`을 설치할 수 있습니다:
|
zypper를 이용해 `bat`을 설치할 수 있습니다:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
zypper install bat
|
zypper install bat
|
||||||
```
|
```
|
||||||
|
|
||||||
### On macOS
|
### snap 패키지를 써서
|
||||||
|
|
||||||
[Homebrew](http://braumeister.org/formula/bat)를 이용해 `bat`을 설치할 수 있습니다:
|
지금으로서는 추천하는 snap 패키지가 없습니다.
|
||||||
|
제공되는 패키지들이 존재할 수는 있지만, 공식적으로 지원되지 않으며
|
||||||
|
[문제](https://github.com/sharkdp/bat/issues/1519)가 있을 수 있습니다.
|
||||||
|
|
||||||
|
|
||||||
|
### macOS (또는 Linux)에서 Homebrew를 써서
|
||||||
|
|
||||||
|
[macOS의 Homebrew](https://formulae.brew.sh/formula/bat) 또는
|
||||||
|
[Linux의 Homebrew](https://formulae.brew.sh/formula-linux/bat)를 이용하여
|
||||||
|
`bat`을 설치할 수 있습니다.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
brew install bat
|
brew install bat
|
||||||
```
|
```
|
||||||
|
|
||||||
또는 [MacPorts](https://ports.macports.org/port/bat/summary)를 사용할 수도 있습니다:
|
### macOS에서 MacPorts를 써서
|
||||||
|
|
||||||
|
[MacPorts](https://ports.macports.org/port/bat/summary)를 이용하여 `bat`을
|
||||||
|
설치할 수 있습니다:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
port install bat
|
port install bat
|
||||||
```
|
```
|
||||||
|
|
||||||
### On Windows
|
### Windows에서
|
||||||
|
|
||||||
Windows에서 `bat`을 설치할 수 있는 몇 가지 옵션들이 있습니다. 먼저 `bat`을 설치 한 후, ["Windows에서 사용하기"](#Windows에서-사용하기) 참고하시기 바랍니다.
|
Windows에서 `bat`을 설치할 수 있는 몇 가지 옵션들이 있습니다.
|
||||||
|
먼저 `bat`을 설치한 후,
|
||||||
|
["Windows에서 `bat` 사용하기"](#windows에서-bat-사용하기) 섹션을 살펴보세요.
|
||||||
|
|
||||||
#### With Chocolatey
|
#### 전제 조건
|
||||||
|
|
||||||
[Chocolatey](https://chocolatey.org/packages/Bat)를 이용해 `bat`을 설치할 수 있습니다:
|
[Visual C++ 재배포 가능](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads)
|
||||||
|
패키지를 설치해야 합니다.
|
||||||
|
|
||||||
|
#### Chocolatey를 써서
|
||||||
|
|
||||||
|
[Chocolatey](https://chocolatey.org/packages/Bat)를 이용해 `bat`을 설치할 수
|
||||||
|
있습니다:
|
||||||
```bash
|
```bash
|
||||||
choco install bat
|
choco install bat
|
||||||
```
|
```
|
||||||
|
|
||||||
#### With Scoop
|
#### Scoop을 써서
|
||||||
|
|
||||||
[scoop](https://scoop.sh/)을 이용해 `bat`을 설치할 수 있습니다:
|
[scoop](https://scoop.sh/)을 이용해 `bat`을 설치할 수 있습니다:
|
||||||
```bash
|
```bash
|
||||||
scoop install bat
|
scoop install bat
|
||||||
```
|
```
|
||||||
[Visual C++ Redistributable 패키지](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads)를 같이 설치해 주어야 합니다.
|
|
||||||
|
|
||||||
#### From prebuilt binaries:
|
#### 사전 빌드된 바이너리들로
|
||||||
|
|
||||||
[릴리즈 페이지](https://github.com/sharkdp/bat/releases)에서 빌드된 바이너리를 다운받을 수 있습니다.
|
[릴리즈 페이지](https://github.com/sharkdp/bat/releases)에서 사전 빌드된
|
||||||
|
바이너리를 다운받을 수 있습니다.
|
||||||
|
|
||||||
[Visual C++ Redistributable 패키지](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads)를 같이 설치해 주어야 합니다.
|
[Visual C++ 재배포 가능](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads)
|
||||||
|
패키지를 설치해야 합니다.
|
||||||
|
|
||||||
### Via Docker
|
### 바이너리들로
|
||||||
|
|
||||||
컨테이너에서 `bat`을 사용할 수 있는 [Docker image](https://hub.docker.com/r/danlynn/bat/)가 있습니다.:
|
[릴리즈 페이지](https://github.com/sharkdp/bat/releases)에서 다양한 아키텍처를
|
||||||
```bash
|
위해 사전 빌드된 버전들을 확인할 수 있습니다.
|
||||||
docker pull danlynn/bat
|
정적 링크 바이너리들은 파일 이름에 `musl` 이 포함된 아카이브들을 확인하세요.
|
||||||
alias bat='docker run -it --rm -e BAT_THEME -e BAT_STYLE -e BAT_TABS -v "$(pwd):/myapp" danlynn/bat'
|
|
||||||
```
|
|
||||||
|
|
||||||
### Via Ansible
|
### 소스에서
|
||||||
|
|
||||||
[Ansible](https://www.ansible.com/)을 사용해 `bat`을 설치할 수 있습니다:
|
`bat`의 소스를 빌드하기 위해서는, Rust 1.51 이상이 필요합니다.
|
||||||
|
`cargo`를 이용해 전부 빌드할 수 있습니다:
|
||||||
```bash
|
|
||||||
# Install role on local machine
|
|
||||||
ansible-galaxy install aeimer.install_bat
|
|
||||||
```
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
---
|
|
||||||
# Playbook to install bat
|
|
||||||
- host: all
|
|
||||||
roles:
|
|
||||||
- aeimer.install_bat
|
|
||||||
```
|
|
||||||
|
|
||||||
- [Ansible Galaxy](https://galaxy.ansible.com/aeimer/install_bat)
|
|
||||||
- [GitHub](https://github.com/aeimer/ansible-install-bat)
|
|
||||||
|
|
||||||
다음 배포판들에서 동작합니다:
|
|
||||||
- Debian/Ubuntu
|
|
||||||
- ARM (eg. Raspberry PI)
|
|
||||||
- Arch Linux
|
|
||||||
- Void Linux
|
|
||||||
- FreeBSD
|
|
||||||
- MacOS
|
|
||||||
|
|
||||||
### From binaries
|
|
||||||
|
|
||||||
[릴리즈 페이지](https://github.com/sharkdp/bat/releases)에서 다양한 환경을 위해 빌드된 버전들을 확인 할 수 있습니다. 정적 링크 바이너리들은 아카이브에서 파일 이름에 `musl` 이 포함 파일로 확인 할 수 있습니다.
|
|
||||||
|
|
||||||
### From source
|
|
||||||
|
|
||||||
`bat`의 소스를 직접 빌드하기 위해서는, Rust 1.36 이상이 필요하며 `cargo`를 이용해 빌드할 수 있습니다.
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cargo install --locked bat
|
cargo install --locked bat
|
||||||
```
|
```
|
||||||
|
|
||||||
일부 플랫폼에서는 `llvm` 그리고/또는 `libclang-dev` 설치가 필요할 수도 있습니다.
|
참고로 man 페이지나 셸 자동 완성 파일과 같은 부가 파일들은 이 방법으로 설치될 수
|
||||||
|
없습니다.
|
||||||
|
이것들은 `cargo`에 의해 생성이 되고 (`build` 밑의) cargo 타켓 폴더에서 찾을 수
|
||||||
|
있습니다.
|
||||||
|
|
||||||
## 커스터마이즈
|
## 사용자화
|
||||||
|
|
||||||
### 문법 강조 테마
|
### 문법 강조 테마
|
||||||
|
|
||||||
`bat --list-themes`을 사용하면, 현재 사용 가능한 문법 강조 테마들을 확인할 수 있습니다. `TwoDark` 테마 선택하는 경우, `--theme=TwoDark` 옵션과 함께 `bat`을 사용하거나 환경변수에서 `BAT_THEME`를 `TwoDark`로 세팅해주면 됩니다. 쉘 시작 파일에 `export BAT_THEME="TwoDark"` 를 정의해 계속 사용도 가능합니다. 이 밖에 `bat`의 [설정 파일](#설정-파일)을 이용할 수도 있습니다.
|
`bat --list-themes`을 사용하여 사용 가능한 문법 강조 테마들의 목록을 확인할 수
|
||||||
|
있습니다.
|
||||||
|
`TwoDark` 테마를 선택하려면, `--theme=TwoDark` 옵션과 함께 `bat`을 사용하거나
|
||||||
|
`BAT_THEME` 환경 변수를 `TwoDark`로 설정하세요.
|
||||||
|
셸 시작 파일에 `export BAT_THEME="TwoDark"` 를 정의해 영구적으로 설정할 수
|
||||||
|
있습니다.
|
||||||
|
이 밖에 `bat`의 [설정 파일](#설정-파일)을 이용할 수 있습니다.
|
||||||
|
|
||||||
다른 테마를 미리 보고 싶은경우 다음 명령어와 같이 사용할 수 있습니다.(이 경우 [`fzf`](https://github.com/junegunn/fzf)가 필요합니다.)
|
만약 다른 테마들을 사용하여 특정 파일을 보고 싶다면, 다음 명령어를 쓸 수
|
||||||
|
있습니다(이 경우 [`fzf`](https://github.com/junegunn/fzf)가 필요합니다.)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bat --list-themes | fzf --preview="bat --theme={} --color=always /path/to/file"
|
bat --list-themes | fzf --preview="bat --theme={} --color=always /path/to/file"
|
||||||
```
|
```
|
||||||
`bat`의 기본 테마는 어두운 배경색 터미널에 적합합니다. 만일 밝은 배경색을 사용할 경우에는 `GitHub` 이나 `OneHalfLight` 과 같은 테마가 더 잘 어울립니다. 아래 [새로운 테마 추가하기](#새로운-테마-추가하기)에 따라 커스텀 테마를 사용할수도 있습니다.
|
|
||||||
|
`bat`은 기본적으로 어두운 배경에 적합합니다.
|
||||||
|
그러나 밝은 배경의 터미널을 사용한다면 `GitHub`이나 `OneHalfLight`과 같은 테마가
|
||||||
|
더 잘 어울립니다.
|
||||||
|
아래 [새로운 테마 추가하기](#새로운-테마-추가하기) 섹션에 따라 커스텀 테마를
|
||||||
|
사용할 수도 있습니다.
|
||||||
|
|
||||||
|
### 8비트 테마
|
||||||
|
|
||||||
|
`bat`은 트루컬러 지원이 되더라도 항상
|
||||||
|
[8비트 색상](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors)을 사용하는
|
||||||
|
세 개의 테마가 있습니다.
|
||||||
|
|
||||||
|
- `ansi`는 어떤 터미널에서도 무난하게 보입니다. 이는 3비트 색상을 사용합니다:
|
||||||
|
검정, 빨강, 녹색, 노랑, 파랑, 마젠타, 시안, 하양.
|
||||||
|
- `base16`은 [base16](https://github.com/chriskempson/base16) 터미널 테마를 위해
|
||||||
|
디자인되었습니다.
|
||||||
|
이는 [base16 스타일 가이드라인](https://github.com/chriskempson/base16/blob/master/styling.md)에
|
||||||
|
따라 4비트 색상(3비트 색상에 밝은 변형 추가)을 사용합니다.
|
||||||
|
- `base16-256`는 [base16-shell](https://github.com/chriskempson/base16-shell)을
|
||||||
|
위해 디자인되었습니다.
|
||||||
|
이는 16부터 21의 일부 밝은 색상을 8비트 색상으로 대치합니다.
|
||||||
|
단지 256-색상 터미널을 쓰지만 base16-shell을 쓰지 않는다고 해서 이것을
|
||||||
|
사용하지 **마십시오**.
|
||||||
|
|
||||||
|
이들 테마는 더 제한적이지만, 트루컬러 테마에 비해 두 장점이 있습니다:
|
||||||
|
|
||||||
|
- 이들은 3비트 혹은 4비트 색상을 쓰는 다른 터미널 소프트웨어와 더 잘
|
||||||
|
어울립니다.
|
||||||
|
- 만약 터미널 테마를 바꾼다면, 이미 화면 상의 `bat`의 출력도 이에 맞추어
|
||||||
|
업데이트됩니다.
|
||||||
|
|
||||||
### 출력 스타일
|
### 출력 스타일
|
||||||
|
|
||||||
`--style` 옵션을 이용하여 `bat`의 출력 스타일을 변경 할 수 있습니다. 예를 들어, `--style=numbers,changes`는 Git 변경분과 라인 넘버에 대해서만 출력하며 눈금과 파일 헤더가 표시되지 않습니다. `BAT_STYLE` 환경 변수로 정의하여 계속해서 사용하거나`bat`의 [설정 파일](#설정-파일)을 사용할 수도 있습니다.
|
`--style` 옵션을 이용하면 `bat`의 출력 모양을 조절할 수 있습니다.
|
||||||
|
예를 들어, `--style=numbers,changes`를 통해 Git 변경분과 줄 번호는 출력하지만
|
||||||
|
격자와 파일 헤더는 출력하지 않을 수 있습니다.
|
||||||
|
`BAT_STYLE` 환경 변수를 정의하여 이러한 수정을 영구적으로 하거나 `bat`의
|
||||||
|
[설정 파일](#설정-파일)을 사용하세요.
|
||||||
|
|
||||||
### 새로운 문법 강조 / 언어 추가하기
|
### 새로운 문법 / 언어 정의 추가하기
|
||||||
|
|
||||||
`bat`은 문법 강조를 위해 [`syntect`](https://github.com/trishume/syntect/) 라이브러리를 사용하고 있습니다. `syntect`는 [Sublime Text의 `.sublime-syntax` 파일](https://www.sublimetext.com/docs/3/syntax.html)과 테마를 읽을 수 있습니다. 새로운 문법 강조를 추가하는 방법은 다음과 같습니다.
|
만약 `bat`에서 특정 문법이 지원되지 않을 경우, 다음의 절차를 통해 현재 `bat`
|
||||||
|
설치본에 새로운 문법을 쉽게 추가할 수 있습니다.
|
||||||
|
|
||||||
우선 문법 정의 파일을 넣을 폴더를 만듭니다:
|
`bat`은 문법 강조를 위해 훌륭한
|
||||||
|
[`syntect`](https://github.com/trishume/syntect/) 라이브러리를 사용합니다.
|
||||||
|
`syntect`는 임의의 [Sublime Text의 `.sublime-syntax`
|
||||||
|
파일](https://www.sublimetext.com/docs/3/syntax.html)과 테마를 읽을 수 있습니다.
|
||||||
|
|
||||||
|
[Package Control](https://packagecontrol.io/)에 Sublime 문법 패키지를 찾는
|
||||||
|
방법이 잘 정리되어 있습니다.
|
||||||
|
일단 문법을 찾았다면:
|
||||||
|
|
||||||
|
1. 문법 정의 파일들을 넣을 폴더를 만듭니다:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
mkdir -p "$(bat --config-dir)/syntaxes"
|
mkdir -p "$(bat --config-dir)/syntaxes"
|
||||||
@@ -364,23 +511,28 @@ cd "$(bat --config-dir)/syntaxes"
|
|||||||
git clone https://github.com/tellnobody1/sublime-purescript-syntax
|
git clone https://github.com/tellnobody1/sublime-purescript-syntax
|
||||||
```
|
```
|
||||||
|
|
||||||
다음 명령어를 통해 파일을 바이너리 캐시로 파싱합니다.
|
2. 이제 다음 명령어를 통해 파일들을 파싱(parse)하여 바이너리 캐시를 만듭니다.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bat cache --build
|
bat cache --build
|
||||||
```
|
```
|
||||||
|
|
||||||
마지막으로 `bat --list-languages`을 통해 새로운 언어가 사용 가능한지 확인합니다.
|
3. 마지막으로, `bat --list-languages`로 새로 추가한 언어가 사용 가능한지
|
||||||
|
확인합니다.
|
||||||
|
|
||||||
기본 설정으로 돌아가려면, 다음 명령어를 이용합니다.:
|
만약 기본 설정으로 돌아갈 일이 생긴다면, 다음 명령어를 이용합니다:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bat cache --clear
|
bat cache --clear
|
||||||
```
|
```
|
||||||
|
|
||||||
|
4. 만약 특정 문법이 `bat`에 기본적으로 포함되어 있어야 한다고 생각한다면, 방침과
|
||||||
|
절차를 [여기](../doc/assets.md)서 읽은 후 "문법 요청(syntax request)"을 열어
|
||||||
|
주세요: [문법 요청하기](https://github.com/sharkdp/bat/issues/new?labels=syntax-request&template=syntax_request.md).
|
||||||
|
|
||||||
### 새로운 테마 추가하기
|
### 새로운 테마 추가하기
|
||||||
|
|
||||||
새로운 문법 정의 추가와 매우 유사합니다.
|
이 과정은 새로운 문법 정의 추가 방식과 매우 비슷합니다.
|
||||||
|
|
||||||
먼저, 새로운 문법 강조 테마 폴더를 만듭니다.
|
먼저, 새로운 문법 강조 테마 폴더를 만듭니다.
|
||||||
```bash
|
```bash
|
||||||
@@ -394,32 +546,93 @@ git clone https://github.com/greggb/sublime-snazzy
|
|||||||
bat cache --build
|
bat cache --build
|
||||||
```
|
```
|
||||||
|
|
||||||
마지막으로 `bat --list-themes`을 통해 새로운 테마가 사용 가능한지 확인합니다.
|
마지막으로 `bat --list-themes`을 통해 새로 추가한 테마들이 사용 가능한지
|
||||||
|
확인합니다.
|
||||||
|
|
||||||
### 다른 페이져 사용하기
|
### 파일 타입 설정을 추가하거나 변경하기
|
||||||
|
|
||||||
`bat`은 환경변수 `PAGER`로 사용할 페이져를 명시합니다. 만약 이 변수가 정의되어있지 않다면 `less`가 기본입니다. 만약 다른 페이져를 사용하고 싶다면 `PAGER` 변수를 수정하거나 `BAT_PAGER` 환경 변수로 `PAGER` 대신 정의 할 수도 있습니다.
|
새로운 파일 이름 패턴을 추가하려면 (혹은 이미 존재하는 것을 변경하려면)
|
||||||
|
`--map-syntax` 커맨드 라인 옵션을 사용하세요.
|
||||||
|
이 옵션은 `pattern:syntax` 꼴의 인자를 받습니다.
|
||||||
|
이때 `pattern`은 파일 이름과 절대 파일 경로를 매치할 글로브(glob) 패턴입니다.
|
||||||
|
`syntax` 부분은 지원되는 언어의 전체 이름입니다
|
||||||
|
(`bat --list-languages`를 통해 개요를 확인하세요).
|
||||||
|
|
||||||
만약 커맨드라인 인수로 넘기려면, `PAGER`/`BAT_PAGER` 변수를 정의를 통해 사용 할 수 있습니다. :
|
참고: 이 옵션은 커맨드 라인에 넘겨 주는 것보다는 `bat`의 설정 파일에 넣는 것이
|
||||||
|
좋을 것입니다 (아래를 보세요).
|
||||||
|
|
||||||
|
예시: "INI" 문법 강조를 `.conf` 파일 확장자의 모든 파일에 적용하려면, 다음을
|
||||||
|
사용하세요:
|
||||||
|
```bash
|
||||||
|
--map-syntax='*.conf:INI'
|
||||||
|
```
|
||||||
|
|
||||||
|
예시: `.ignore`(완전 일치)이라는 이름의 모든 파일을 "Git Ignore" 문법으로
|
||||||
|
열려면, 다음을 사용하세요:
|
||||||
|
```bash
|
||||||
|
--map-syntax='.ignore:Git Ignore'
|
||||||
|
```
|
||||||
|
|
||||||
|
예시: `/etc/apache2`의 하위 폴더들에 있는 모든 `.conf` 파일들을 "Apache Conf"
|
||||||
|
문법으로 열려면, 다음을 사용하세요 (이 대응(mapping)은 이미 내장되어 있습니다):
|
||||||
|
```bash
|
||||||
|
--map-syntax='/etc/apache2/**/*.conf:Apache Conf'
|
||||||
|
```
|
||||||
|
|
||||||
|
### 다른 페이저 사용하기
|
||||||
|
|
||||||
|
`bat`은 환경 변수 `PAGER`에 명시된 페이저를 사용합니다.
|
||||||
|
이 변수가 정의되어 있지 않다면, `less`가 기본으로 사용됩니다.
|
||||||
|
만약 다른 페이저를 사용하고 싶다면, `PAGER` 변수를 수정하거나 `BAT_PAGER` 환경
|
||||||
|
변수를 설정하여 `PAGER`의 설정을 오버라이드(override)할 수 있습니다.
|
||||||
|
|
||||||
|
만약 커맨드라인 인수들을 페이저에게 넘겨 주려면, `PAGER`/`BAT_PAGER` 변수로
|
||||||
|
설정할 수 있습니다:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export BAT_PAGER="less -RF"
|
export BAT_PAGER="less -RF"
|
||||||
```
|
```
|
||||||
|
|
||||||
환경 변수 대신, `bat`의 [설정 파일](#설정-파일)에서 페이져를 설정 할 수도 있습니다.(`--pager` 옵션)
|
환경 변수를 사용하는 대신, `bat`의 [설정 파일](#설정-파일)로 페이저를 설정할
|
||||||
|
수도 있습니다 (`--pager` 옵션).
|
||||||
|
|
||||||
**참고**: 기본적으로 페이져가 `less`로 설정 되어있다면, `bat`은 다음 옵션들을 받을 수 있습니다: `-R`/`--RAW-CONTROL-CHARS`,
|
**참고**: 기본적으로, 페이저가 `less`로 설정되어 있다면 (그리고 커맨드 라인
|
||||||
`-F`/`--quit-if-one-screen` 그리고 `-X`/`--no-init`. 마지막 옵션(`-X`)은 530 이전 버전에서만 사용됩니다.
|
옵션이 지정되어 있지 않다면), `bat`은 다음 옵션들을 페이저로 넘겨줍니다:
|
||||||
|
`-R`/`--RAW-CONTROL-CHARS`, `-F`/`--quit-if-one-screen` 그리고 `-X`/`--no-init`.
|
||||||
|
마지막 옵션(`-X`)은 530 이전 버전의 `less`에만 사용됩니다.
|
||||||
|
|
||||||
`-R` 옵션은 ANSI 컬러를 올바르게 해석하기 위해 필요합니다. 두번째 옵션 (`-F`)은 출력 크기가 터미널의 세로 크기보다 작을 경우 즉시 종료되도록 합니다.
|
`-R` 옵션은 ANSI 색상을 올바르게 해석하기 위해 필요합니다.
|
||||||
페이져를 종료하기 위해 `q`를 누를 필요 없기 때문에 작은 파일을 다룰 때 용이합니다. 세번째 옵션(`-X`)는 `less` 이전 버전의 `--quit-if-one-screen` 기능과 함께 버그를 잡을 때 필요합니다. 안타깝게도, `less`의 마우스 휠 지원은 종료합니다.
|
두 번째 옵션(`-F`)은 출력 크기가 터미널의 세로 크기보다 작을 경우 less가 즉시
|
||||||
|
종료되도록 합니다.
|
||||||
|
이는 작은 파일을 다룰 때 페이저를 종료하기 위해 `q`를 누를 필요 없어서
|
||||||
|
편리합니다.
|
||||||
|
세 번째 옵션(`-X`)는 예전 버전의 `less`에 있는 `--quit-if-one-screen` 기능의
|
||||||
|
버그를 고치기 위해 필요합니다.
|
||||||
|
안타깝게도, 이는 `less`의 마우스 휠 지원과 호환되지 않습니다.
|
||||||
|
|
||||||
`less` 예전 버전에서 마우스 휠 기능을 활성화 시키려면, `-R` 옵션을 사용하면 됩니다. (위의 예제처럼, 이 옵션은 quit-if-one-screen 기능을 비활성화 시킵니다.)
|
`less`의 예전 버전에서 마우스 휠 기능을 활성화하려면, `-R` 옵션을 넘겨주세요
|
||||||
530 이하 버전에서는 그대로 사용할 수 있습니다.
|
(위의 예제처럼, 이 옵션은 quit-if-one-screen 기능을 비활성화합니다).
|
||||||
|
less 530과 이후 버전에서는 그대로 사용할 수 있습니다.
|
||||||
|
|
||||||
|
### 들여쓰기
|
||||||
|
|
||||||
|
`bat`은 페이저에 의존하지 않고 탭을 4 스페이스로 확장합니다.
|
||||||
|
이를 변경하려면 간단히 `--tabs` 인자에 표시되기를 원하는 스페이스 개수를
|
||||||
|
추가하세요.
|
||||||
|
|
||||||
|
**참고**: (`bat`의 `--pager` 인자 혹은 `less`의 `LESS` 환경 변수를 통해)
|
||||||
|
페이저의 탭 길이를 지정하는 것은 효과가 없을 것인데, 이는 페이저가 이미
|
||||||
|
스페이스로 확장된 탭을 받기 때문입니다.
|
||||||
|
이 기능은 사이드바에 의한 들여쓰기 문제를 회피하기 위해 추가되었습니다.
|
||||||
|
`bat`을 `--tabs=0`과 함께 호출하면 이를 오버라이드하여 페이저가 탭을 처리하게
|
||||||
|
합니다.
|
||||||
|
|
||||||
### 다크 모드
|
### 다크 모드
|
||||||
|
|
||||||
macOS에서 다크 모드를 사용하고 있다면, OS 테마에 따라 다른 테마를 사용하도록 `bat`의 구성할 수 있습니다. 아래 코드는 라이트 모드에서는 `default` 테마를 다크모드에서는 `Github` 테마를 사용하는 방법입니다.
|
macOS에서 다크 모드를 사용하고 있다면, `bat`가 OS 테마에 따라 다른 테마를
|
||||||
|
사용하도록 구성할 수 있습니다.
|
||||||
|
아래 스니펫은 _다크 모드_에서는 `default` 테마를, _라이트 모드_에서는 `GitHub`
|
||||||
|
테마를 사용하는 방법입니다.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
alias cat="bat --theme=\$(defaults read -globalDomain AppleInterfaceStyle &> /dev/null && echo default || echo GitHub)"
|
alias cat="bat --theme=\$(defaults read -globalDomain AppleInterfaceStyle &> /dev/null && echo default || echo GitHub)"
|
||||||
@@ -427,57 +640,89 @@ alias cat="bat --theme=\$(defaults read -globalDomain AppleInterfaceStyle &> /de
|
|||||||
|
|
||||||
## 설정 파일
|
## 설정 파일
|
||||||
|
|
||||||
`bat` 설정 파일로 커스터마이즈 할 수 있습니다. 파일의 위치는 운영 체제에 따라 다릅니다. 아래 커맨드를 통해 시스템의 기본 경로를 알 수 있습니다.
|
`bat`는 설정 파일로도 사용자화 할 수 있습니다.
|
||||||
|
설정 파일의 위치는 운영 체제에 따라 다릅니다.
|
||||||
|
아래 커맨드를 통해 시스템의 기본 경로를 확인할 수 있습니다.
|
||||||
```
|
```
|
||||||
bat --config-file
|
bat --config-file
|
||||||
```
|
```
|
||||||
|
|
||||||
또는, `BAT_CONFIG_PATH` 환경 변수를 사용하여 `bat`의 설정 파일 위치를 지정할 수 있습니다.
|
또는, `BAT_CONFIG_PATH` 환경 변수를 사용하여 `bat`가 설정 파일의 기본 경로
|
||||||
|
이외의 위치를 사용하도록 할 수 있습니다.
|
||||||
```bash
|
```bash
|
||||||
export BAT_CONFIG_PATH="/path/to/bat.conf"
|
export BAT_CONFIG_PATH="/path/to/bat.conf"
|
||||||
```
|
```
|
||||||
|
|
||||||
### 포맷
|
기본 설정 파일은 `--generate-config-file` 옵션으로 생성할 수 있습니다.
|
||||||
|
|
||||||
설정 파일은 명령어 인수들의 리스트 입니다. `bat --help`를 이용하여 가능한 옵션들과 값들을 확인해 볼 수 있습니다. 또, `#` 으로 주석을 추가할수도 있습니다.
|
|
||||||
|
|
||||||
설정 파일의 예:
|
|
||||||
```bash
|
```bash
|
||||||
# Set the theme to "TwoDark"
|
bat --generate-config-file
|
||||||
--theme="TwoDark"
|
|
||||||
|
|
||||||
# Show line numbers, Git modifications and file header (but no grid)
|
|
||||||
--style="numbers,changes,header"
|
|
||||||
|
|
||||||
# Use italic text on the terminal (not supported on all terminals)
|
|
||||||
--italic-text=always
|
|
||||||
|
|
||||||
# Use C++ syntax for .ino files
|
|
||||||
--map-syntax "*.ino:C++"
|
|
||||||
|
|
||||||
# Use ".gitignore"-style highlighting for ".ignore" files
|
|
||||||
--map-syntax ".ignore:Git Ignore"
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Windows에서 사용하기
|
### 포맷
|
||||||
|
|
||||||
`bat` 대부분의 경우 Windows에서 기본적으로 잘 작동하지만, 일부 기능에는 추가 적인 구성이 필요할 수 있습니다.
|
설정 파일은 단순히 커맨드 라인 인자들의 리스트입니다.
|
||||||
|
`bat --help`로 가능한 모든 옵션과 값들을 확인하세요.
|
||||||
|
추가적으로, 줄 앞에 `#` 문자를 추가해 주석을 넣을 수 있습니다.
|
||||||
|
|
||||||
|
설정 파일 예시:
|
||||||
|
```bash
|
||||||
|
# "TwoDark" 테마 설정하기
|
||||||
|
--theme="TwoDark"
|
||||||
|
|
||||||
|
# 줄 번호, Git 변경 내용, 파일 헤더 보이기 (격자 없이)
|
||||||
|
--style="numbers,changes,header"
|
||||||
|
|
||||||
|
# 터미널에서 이탤릭체 쓰기 (일부 터미널에서 미지원)
|
||||||
|
--italic-text=always
|
||||||
|
|
||||||
|
# Arduino .ino 파일에 C++ 문법 쓰기
|
||||||
|
--map-syntax "*.ino:C++"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Windows에서 `bat` 사용하기
|
||||||
|
|
||||||
|
`bat`는 대부분의 경우 Windows에서 기본적으로 잘 작동하지만, 일부 기능은 추가적인
|
||||||
|
구성이 필요할 수 있습니다.
|
||||||
|
|
||||||
|
#### 전제 조건
|
||||||
|
|
||||||
|
[Visual C++ 재배포 가능](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads)
|
||||||
|
패키지를 설치해야 합니다.
|
||||||
|
|
||||||
### 페이징
|
### 페이징
|
||||||
|
|
||||||
Windows는 `more` 형식의 매우 제한된 페이저만이 포함되어있습니다. `less`용 Windows 바이너리는 [이 홈페이지](http://www.greenwoodsoftware.com/less/download.html)나 [Chocolatey](https://chocolatey.org/packages/Less)에서 다운로드 받을 수 있습니다. 이를 사용하려면 바이너리를 `PATH` 디렉토리에 배치하거나 [환경 변수로 정의](#using-a-different-pager) 하세요. [Chocolatey 패키지](#on-windows)로 `less`를 자동으로 설치할 수 있습니다.
|
Windows는 `more` 형식의 매우 제한된 페이저만 포함합니다.
|
||||||
|
Windows용 `less` 바이너리는
|
||||||
|
[공식 홈페이지](http://www.greenwoodsoftware.com/less/download.html)나
|
||||||
|
[Chocolatey](https://chocolatey.org/packages/Less)를 통해 다운로드 받을 수
|
||||||
|
있습니다.
|
||||||
|
이를 사용하려면 디렉터리 안의 바이너리를 `PATH`에 넣거나
|
||||||
|
[환경 변수로 정의](#using-a-different-pager)하세요.
|
||||||
|
[Chocolatey 패키지](#on-windows)는 `less`를 자동으로 설치합니다.
|
||||||
|
|
||||||
### 색상
|
### 색상
|
||||||
|
|
||||||
Windows 10은 기본 내장기능으로 [v1511](https://en.wikipedia.org/wiki/Windows_10_version_history#Version_1511_(November_Update)) 이후의 `conhost.exe`(Command Prompt) 와 PowerShell, 그리고 최신 버전의 bash에서 색상을 지원합니다. 이전 버전의 Windows에서는, [ConEmu](https://conemu.github.io/)가 포함 된 [Cmder](http://cmder.net/)를 사용할 수 있습니다 .
|
Windows 10은
|
||||||
|
[v1511](https://en.wikipedia.org/wiki/Windows_10_version_history#Version_1511_(November_Update))부터
|
||||||
|
기본적으로 `conhost.exe`(Command Prompt)와 PowerShell에서 색상을 지원하며,
|
||||||
|
최신 버전의 bash에서도 색상을 지원합니다.
|
||||||
|
이전 버전의 Windows에서는, [ConEmu](https://conemu.github.io/)가 포함된
|
||||||
|
[Cmder](http://cmder.net/)를 사용할 수 있습니다.
|
||||||
|
|
||||||
**참고:** `less`의 Git과 MSYS 버전은 Windows에서 색상을 올바르게 해석하지 않습니다. 다른 페이져가 설치되어 있지 않은 경우, `--paging=never` 하거나 `BAT_PAGER`를 빈 문자열로 설정하여 페이징을 완전히 비활성화 할 수 있습니다 .
|
**참고:** Git과 MSYS 버전의 `less`는 Windows에서 색상을 올바르게 해석하지
|
||||||
|
않습니다.
|
||||||
|
다른 페이저가 설치되어 있지 않은 경우, `--paging=never`을 넘겨주거나
|
||||||
|
`BAT_PAGER`을 빈 문자열로 설정하여 페이징을 완전히 비활성화 할 수 있습니다.
|
||||||
|
|
||||||
### Cygwin
|
### Cygwin
|
||||||
|
|
||||||
Windows에서의 `bat`은 기본적으로 Cygwin의 unix 스타일의 경로(`/cygdrive/*`)를 지원하지 않습니다. cygwin 절대경로를 인자로 받았을 때, `bat`은 다음과 같이 오류를 반환합니다. `:The system cannot find the path specified. (os error 3)`
|
Windows에서의 `bat`은 기본적으로 Cygwin의 unix 스타일 경로(`/cygdrive/*`)를
|
||||||
|
지원하지 않습니다.
|
||||||
|
Cygwin 절대 경로를 인자로 받았을 때, `bat`은 다음과 같은 오류를 반환합니다:
|
||||||
|
`The system cannot find the path specified. (os error 3)`
|
||||||
|
|
||||||
이 경우, wrapper를 만들거나 다음 함수를 `.bash_profile`추가하여 문제를 해결하실 수 있습니다 :
|
이는 wrapper를 만들거나 다음 함수를 `.bash_profile`에 추가하여 해결할 수
|
||||||
|
있습니다:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bat() {
|
bat() {
|
||||||
@@ -493,68 +738,98 @@ bat() {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## 트러블슈팅
|
## 문제 해결
|
||||||
|
|
||||||
### 터미널과 색상
|
### 터미널과 색상
|
||||||
|
|
||||||
`bat`은 터미널 트루컬러 지원 여부와 상관없이 동작합니다. 하지만, 문법 강조 테마의 색상이 8-bit 컬러에는 최적화 되어 있지 않고 있으며, 24-bit 트루컬러 지원하는 터미널 사용하는 것을 적극 권장합니다.(`terminator`, `konsole`, `iTerm2`, ...). [이 글](https://gist.github.com/XVilka/8346728)에서 24-bit 트루컬러 지원하는 터미널들을 찾아보실 수 있습니다.
|
`bat`은 터미널의 트루컬러 지원 여부와 상관 없이 동작합니다.
|
||||||
|
그러나 대부분 문법 강조 테마의 색상은 8비트 색상에 최적화되어 있지 않습니다.
|
||||||
|
따라서 24비트 트루컬러 지원이 되는 터미널(`terminator`, `konsole`, `iTerm2`,
|
||||||
|
...)을 사용하는 것을 적극 권장합니다.
|
||||||
|
트루컬러를 지원하는 터미널들과 더 자세한 정보는
|
||||||
|
[이 글](https://gist.github.com/XVilka/8346728)에서 찾아보실 수 있습니다.
|
||||||
|
|
||||||
사용하고 있는 터미널에서 `COLORTERM`을 `truecolor` 혹은
|
사용하고 있는 트루컬러 터미널에서 `COLORTERM` 변수를 `truecolor` 혹은
|
||||||
`24bit`으로 설정 되어있는지 확인하세요. 만약 아니라면, `bat`은 24-bit escape sequence를 지원되는지 여부를 판단 할 수 없습니다. (그리고 8-bit 색상으로 돌아갑니다.)
|
`24bit`로 설정되어 있는지 확인하세요.
|
||||||
|
그렇지 않을 경우, `bat`은 24비트 확장열(escape sequence)이 지원되는지 여부를
|
||||||
|
판단할 수 없습니다 (그리고 8비트 색상을 사용합니다).
|
||||||
|
|
||||||
### 라인 숫자와 눈금이 잘 보이지 않는 경우
|
### 줄 번호와 격자가 잘 보이지 않는 경우
|
||||||
|
|
||||||
다른 테마를 사용해 보세요. (`bat --list-themes`에서 테마들을 확인해 볼 수 있습니다.) `OneHalfDark` 과 `OneHalfLight` 테마는 눈금과 선의 색을 밝게 합니다.
|
다른 테마를 사용해 보세요 (`bat --list-themes`에서 목록을 볼 수 있습니다).
|
||||||
|
`OneHalfDark`와 `OneHalfLight` 테마는 더 밝은 눈금과 선의 색상을 사용합니다.
|
||||||
|
|
||||||
### 파일 인코딩
|
### 파일 인코딩
|
||||||
|
|
||||||
`bat`은 기본적으로 UTF-8과 UTF-8을 제공합니다. 다른 파일 인코딩의 경우, 자동 감지 되지 않으므로 UTF-8로 먼저 변환해 주어야 합니다. 이렇게 할 때, `iconv`를 사용 할 수 있습니다. 예를 들어, Latin-1 (ISO-8859-1)로 인코딩된 PHP파일이라면 다음과 같이 사용할 수 있습니다.:
|
`bat`은 기본적으로 UTF-8과 UTF-16을 지원합니다.
|
||||||
|
다른 모든 종류의 파일 인코딩에 대해서는, 일반적으로 인코딩을 자동으로 판별하는
|
||||||
|
방법이 없기 때문에 먼저 UTF-8으로 변환해야 할 수 있습니다.
|
||||||
|
이를 위해 `iconv`를 사용할 수 있습니다.
|
||||||
|
예시: Latin-1(ISO-8859-1)로 인코딩된 PHP 파일은 다음과 같이 처리할 수 있습니다:
|
||||||
``` bash
|
``` bash
|
||||||
iconv -f ISO-8859-1 -t UTF-8 my-file.php | bat
|
iconv -f ISO-8859-1 -t UTF-8 my-file.php | bat
|
||||||
```
|
```
|
||||||
참고: `bat`으로 자동 감지가 되지 않는 경우에는 `-l`/`--language` 옵션을 사용할 수도 있습니다.
|
참고: `bat`으로 문법 자동 감지가 되지 않는 경우에는 `-l`/`--language` 옵션을
|
||||||
|
사용할 수 있습니다.
|
||||||
|
|
||||||
## 배포
|
## 개발
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Recursive clone to retrieve all submodules
|
# 모든 서브모듈을 받기 위해 재귀적으로 복제하기
|
||||||
git clone --recursive https://github.com/sharkdp/bat
|
git clone --recursive https://github.com/sharkdp/bat
|
||||||
|
|
||||||
# Build (debug version)
|
# (디버그 버전) 빌드
|
||||||
cd bat
|
cd bat
|
||||||
cargo build --bins
|
cargo build --bins
|
||||||
|
|
||||||
# Run unit tests and integration tests
|
# 단위 테스트와 통합 테스트 실행
|
||||||
cargo test
|
cargo test
|
||||||
|
|
||||||
# Install (release version)
|
# (배포 버전) 설치
|
||||||
cargo install --locked
|
cargo install --locked
|
||||||
|
|
||||||
# Build a bat binary with modified syntaxes and themes
|
# 수정된 문법과 테마가 적용된 bat 바이너리 빌드
|
||||||
bash assets/create.sh
|
bash assets/create.sh
|
||||||
cargo install --locked --force
|
cargo install --locked --force
|
||||||
```
|
```
|
||||||
|
|
||||||
|
`bat`의 pretty-printing 기능을 라이브러리로 사용하는 애플리케이션을 만들고
|
||||||
|
싶다면, [API 문서](https://docs.rs/bat/)를 살펴보세요.
|
||||||
|
참고로 `bat`에 라이브러리로써 의존한다면, `regex-onig`나 `regex-fancy`를
|
||||||
|
기능으로 사용해야 합니다.
|
||||||
|
|
||||||
|
## 기여하기
|
||||||
|
|
||||||
|
[`CONTRIBUTING.md`](../CONTRIBUTING.md) 가이드를 살펴보세요.
|
||||||
|
|
||||||
## 메인테이너들
|
## 메인테이너들
|
||||||
|
|
||||||
- [sharkdp](https://github.com/sharkdp)
|
- [sharkdp](https://github.com/sharkdp)
|
||||||
- [eth-p](https://github.com/eth-p)
|
- [eth-p](https://github.com/eth-p)
|
||||||
|
- [keith-hall](https://github.com/keith-hall)
|
||||||
|
- [Enselic](https://github.com/Enselic)
|
||||||
|
|
||||||
|
## 보안 취약점
|
||||||
|
|
||||||
|
만약 `bat`의 취약점을 발견하였다면, [David Peter](https://david-peter.de/)에게 메일로 연락주시기 바랍니다.
|
||||||
|
|
||||||
## 프로젝트 목표와 대안들
|
## 프로젝트 목표와 대안들
|
||||||
|
|
||||||
`bat`은 아래와 같은 목표를 달성하려고 합니다:
|
`bat`은 다음과 같은 목표를 달성하려고 합니다:
|
||||||
|
|
||||||
- 아름답고 발전된 문법 강조 기능
|
- 아름답고 발전된 문법 강조 기능 제공
|
||||||
- Git 연동을 통한 파일 수정 내역 확인
|
- Git과의 연동을 통한 파일 변경 내용 확인
|
||||||
- (POSIX) `cat`의 대체제
|
- (POSIX) `cat`의 대체제
|
||||||
- 사용자 친화적인 CLI 제공
|
- 사용자 친화적인 커맨드 라인 인터페이스 제공
|
||||||
|
|
||||||
|
비슷한 프로그램들을 찾고 있다면 많은 대안들이 있습니다.
|
||||||
비슷한 프로그램들을 찾고 있다면, 많은 대안들이 있습니다. 비교는 [이 문서]((doc/alternatives.md))를 참조해주세요.
|
비교는 [이 문서](../doc/alternatives.md)를 참조해 주세요.
|
||||||
|
|
||||||
## 라이센스
|
## 라이센스
|
||||||
Copyright (c) 2018-2020 [bat-developers](https://github.com/sharkdp/bat).
|
Copyright (c) 2018-2021 [bat-developers](https://github.com/sharkdp/bat).
|
||||||
|
|
||||||
`bat`는 MIT 라이센스 및 Apache 라이센스 2.0의 조건에 따라 배포됩니다.
|
`bat`는 여러분의 선택에 따라 MIT 라이센스 또는 Apache 라이센스 2.0의 조건에 따라
|
||||||
|
배포됩니다.
|
||||||
|
|
||||||
라이센스 세부사항은 [LICENSE-APACHE](LICENSE-APACHE)와 [LICENSE-MIT](LICENSE-MIT)를 참조하세요.
|
라이센스의 세부사항은 [LICENSE-APACHE](../LICENSE-APACHE)와
|
||||||
|
[LICENSE-MIT](../LICENSE-MIT)를 참조하세요.
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="doc/logo-header.svg" alt="bat - a cat clone with wings"><br>
|
<img src="logo-header.svg" alt="bat - a cat clone with wings"><br>
|
||||||
<a href="https://travis-ci.org/sharkdp/bat"><img src="https://travis-ci.org/sharkdp/bat.svg?branch=master" alt="Build Status"></a>
|
<a href="https://github.com/sharkdp/bat/actions?query=workflow%3ACICD"><img src="https://github.com/sharkdp/bat/workflows/CICD/badge.svg" alt="Build Status"></a>
|
||||||
<a href="https://ci.appveyor.com/project/sharkdp/bat"><img src="https://ci.appveyor.com/api/projects/status/cptsmtbiwbnr2vhf/branch/master?svg=true"></a>
|
|
||||||
<img src="https://img.shields.io/crates/l/bat.svg" alt="license">
|
<img src="https://img.shields.io/crates/l/bat.svg" alt="license">
|
||||||
<a href="https://crates.io/crates/bat"><img src="https://img.shields.io/crates/v/bat.svg?colorB=319e8c" alt="Version info"></a><br>
|
<a href="https://crates.io/crates/bat"><img src="https://img.shields.io/crates/v/bat.svg?colorB=319e8c" alt="Version info"></a><br>
|
||||||
Клон утилиты <i>cat(1)</i> с поддержкой выделения синтаксиса и Git
|
Клон утилиты <i>cat(1)</i> с поддержкой выделения синтаксиса и Git
|
||||||
@@ -12,8 +11,12 @@
|
|||||||
<a href="#как-использовать">Использование</a> •
|
<a href="#как-использовать">Использование</a> •
|
||||||
<a href="#установка">Установка</a> •
|
<a href="#установка">Установка</a> •
|
||||||
<a href="#кастомизация">Кастомизация</a> •
|
<a href="#кастомизация">Кастомизация</a> •
|
||||||
<a href="#цели-и-альтернативы">Цели и альтернативы </a> •
|
<a href="#цели-и-альтернативы">Цели и альтернативы </a><br>
|
||||||
Перевод [<a href="https://github.com/chinanf-boy/bat-zh">中文</a>][<a href="doc/README-ja.md">日本語</a>][<a href="doc/README-ko.md">한국어</a>][<a href="doc/README-ru.md">Русский</a>]
|
[<a href="../README.md">English]
|
||||||
|
[<a href="README-zh.md">中文</a>]
|
||||||
|
[<a href="README-ja.md">日本語</a>]
|
||||||
|
[<a href="README-ko.md">한국어</a>]
|
||||||
|
[Русский]
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
### Выделение синтаксиса
|
### Выделение синтаксиса
|
||||||
@@ -185,7 +188,7 @@ ln -s /usr/bin/batcat ~/.local/bin/bat
|
|||||||
[release page](https://github.com/sharkdp/bat/releases) и установить так:
|
[release page](https://github.com/sharkdp/bat/releases) и установить так:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo dpkg -i bat_0.18.0_amd64.deb # измените архитектуру и версию
|
sudo dpkg -i bat_0.18.3_amd64.deb # измените архитектуру и версию
|
||||||
```
|
```
|
||||||
|
|
||||||
### Alpine Linux
|
### Alpine Linux
|
||||||
@@ -341,7 +344,7 @@ ansible-galaxy install aeimer.install_bat
|
|||||||
|
|
||||||
### Из исходников
|
### Из исходников
|
||||||
|
|
||||||
Если вы желаете установить `bat` из исходников, вам понадобится Rust 1.42 или выше. После этого используйте `cargo`, чтобы все скомпилировать:
|
Если вы желаете установить `bat` из исходников, вам понадобится Rust 1.51 или выше. После этого используйте `cargo`, чтобы все скомпилировать:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cargo install --locked bat
|
cargo install --locked bat
|
||||||
@@ -481,7 +484,7 @@ bat --generate-config-file
|
|||||||
# Использовать курсив (поддерживается не всеми терминалами)
|
# Использовать курсив (поддерживается не всеми терминалами)
|
||||||
--italic-text=always
|
--italic-text=always
|
||||||
|
|
||||||
# Использовать синтаксис C++ для всех .ino файлов
|
# Использовать синтаксис C++ для всех Arduino .ino файлов
|
||||||
--map-syntax "*.ino:C++"
|
--map-syntax "*.ino:C++"
|
||||||
|
|
||||||
# Использовать синтаксик Git Ignore для всех файлов .ignore
|
# Использовать синтаксик Git Ignore для всех файлов .ignore
|
||||||
@@ -587,7 +590,7 @@ cargo install --locked --force
|
|||||||
Есть очень много альтернатив `bat`. Смотрите [этот документ](doc/alternatives.md) для сравнения.
|
Есть очень много альтернатив `bat`. Смотрите [этот документ](doc/alternatives.md) для сравнения.
|
||||||
|
|
||||||
## Лицензия
|
## Лицензия
|
||||||
Copyright (c) 2018-2020 [Разработчики bat](https://github.com/sharkdp/bat).
|
Copyright (c) 2018-2021 [Разработчики bat](https://github.com/sharkdp/bat).
|
||||||
|
|
||||||
`bat` распостраняется под лицензями MIT License и Apache License 2.0 (на выбор пользователя).
|
`bat` распостраняется под лицензями MIT License и Apache License 2.0 (на выбор пользователя).
|
||||||
|
|
||||||
|
678
doc/README-zh.md
Normal file
678
doc/README-zh.md
Normal file
@@ -0,0 +1,678 @@
|
|||||||
|
<p align="center">
|
||||||
|
<img src="logo-header.svg" alt="bat - a cat clone with wings"><br>
|
||||||
|
<a href="https://github.com/sharkdp/bat/actions?query=workflow%3ACICD"><img src="https://github.com/sharkdp/bat/workflows/CICD/badge.svg" alt="Build Status"></a>
|
||||||
|
<img src="https://img.shields.io/crates/l/bat.svg" alt="license">
|
||||||
|
<a href="https://crates.io/crates/bat"><img src="https://img.shields.io/crates/v/bat.svg?colorB=319e8c" alt="Version info"></a><br>
|
||||||
|
类似 <i>cat(1)</i>,但带有 git 集成和语法高亮.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<a href="#语法高亮">主要功能</a> •
|
||||||
|
<a href="#如何使用">使用方法</a> •
|
||||||
|
<a href="#安装">安装</a> •
|
||||||
|
<a href="#自定义">自定义</a> •
|
||||||
|
<a href="#project-goals-and-alternatives">项目目标和替代方案</a><br>
|
||||||
|
[<a href="../README.md">English</a>]
|
||||||
|
[中文]
|
||||||
|
[<a href="README-ja.md">日本語</a>]
|
||||||
|
[<a href="README-ko.md">한국어</a>]
|
||||||
|
[<a href="README-ru.md">Русский</a>]
|
||||||
|
</p>
|
||||||
|
|
||||||
|
### 语法高亮
|
||||||
|
|
||||||
|
`bat` 对大部分编程语言和标记语言提供语法高亮:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### Git 集成
|
||||||
|
|
||||||
|
`bat` 能从 git 中获取文件的修改并展示在边栏(见下图):
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### 不可打印(non-printable)字符可视化
|
||||||
|
|
||||||
|
添加`-A`/`--show-all`参数可以文件文件中的不可打印字符:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### 自动分页
|
||||||
|
|
||||||
|
`bat`会在一般情况下将大于屏幕可显示范围的内容输出到分页器(pager, e.g. `less`)。
|
||||||
|
|
||||||
|
你可以在调用时添加`--paging=never`参数来使`bat`不使用分页器(就像`cat`一样)。如果你想要用为`cat`使用`bat`别名,可以在 shell 配置文件(shell configuration)中添加`alias cat='bat --paging=never'`。
|
||||||
|
|
||||||
|
#### 智能输出
|
||||||
|
|
||||||
|
`bat`能够在设置了分页器选项的同时进行管道:wink:。
|
||||||
|
当`bat`检测到当前环境为非可交互终端或管道时(例如使用`bat`并将内容用管道输出到文件),`bat`会像`cat`一样,一次输出文件内容为纯文本且无视`--paging`参数。
|
||||||
|
|
||||||
|
## 如何使用
|
||||||
|
|
||||||
|
在终端中查看一个文件
|
||||||
|
|
||||||
|
```bash
|
||||||
|
> bat README.md
|
||||||
|
```
|
||||||
|
|
||||||
|
一次性展示多个文件
|
||||||
|
|
||||||
|
```bash
|
||||||
|
> bat src/*.rs
|
||||||
|
```
|
||||||
|
|
||||||
|
从`stdin`读入流,自动为内容添加语法高亮(前提是输入内容的语言可以被正确识别,通常根据内容第一行的 shebang 标记,形如`#!bin/sh`)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
> curl -s https://sh.rustup.rs | bat
|
||||||
|
```
|
||||||
|
|
||||||
|
显式指定`stdin`输入的语言
|
||||||
|
|
||||||
|
```bash
|
||||||
|
> yaml2json .travis.yml | json_pp | bat -l json
|
||||||
|
```
|
||||||
|
|
||||||
|
显示不可打印字符
|
||||||
|
|
||||||
|
```bash
|
||||||
|
> bat -A /etc/hosts
|
||||||
|
```
|
||||||
|
|
||||||
|
与`cat`的兼容性
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bat > note.md # 创建一个空文件
|
||||||
|
|
||||||
|
bat header.md content.md footer.md > document.md
|
||||||
|
|
||||||
|
bat -n main.rs # 只显示行号
|
||||||
|
|
||||||
|
bat f - g # 输出 f,接着是标准输入流,最后 g
|
||||||
|
```
|
||||||
|
|
||||||
|
### 第三方工具交互
|
||||||
|
|
||||||
|
#### `fzf`
|
||||||
|
|
||||||
|
你可以使用`bat`作为`fzf`的预览器。这需要在`bat`后添加`--color=always`选项,以及`--line-range` 选项来限制大文件的加载次数。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
fzf --preview 'bat --color=always --style=numbers --line-range=:500 {}'
|
||||||
|
```
|
||||||
|
|
||||||
|
更多信息请参阅[`fzf`的说明](https://github.com/junegunn/fzf#preview-window)。
|
||||||
|
|
||||||
|
#### `find` 或 `fd`
|
||||||
|
|
||||||
|
你可以使用`find`的`-exec`选项来用`bat`预览搜索结果:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
find … -exec bat {} +
|
||||||
|
```
|
||||||
|
|
||||||
|
亦或者在用`fd`时添加`-X`/`--exec-batch`选项:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
fd … -X bat
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `ripgrep`
|
||||||
|
|
||||||
|
`bat`也能用`batgrep`来显示`ripgrep`的搜索结果。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
batgrep needle src/
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `tail -f`
|
||||||
|
|
||||||
|
当与`tail -f`一起使用,`bat`可以持续监视文件内容并为其添加语法高亮。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
tail -f /var/log/pacman.log | bat --paging=never -l log
|
||||||
|
```
|
||||||
|
|
||||||
|
注意:这项功能需要在关闭分页时使用,同时要手动指定输入的内容语法(通过`-l log`)。
|
||||||
|
|
||||||
|
#### `git`
|
||||||
|
|
||||||
|
`bat`也能直接接受来自`git show`的输出并为其添加语法高亮(当然也需要手动指定语法):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git show v0.6.0:src/main.rs | bat -l rs
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `git diff`
|
||||||
|
|
||||||
|
`bat`也可以和`git diff`一起使用:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
batdiff() {
|
||||||
|
git diff --name-only --diff-filter=d | xargs bat --diff
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
该功能也作为一个独立工具提供,你可以在[`bat-extras`](https://github.com/eth-p/bat-extras)中找到`batdiff`。
|
||||||
|
|
||||||
|
如果你想了解更多 git 和 diff 的信息,参阅[`delta`](https://github.com/dandavison/delta)。
|
||||||
|
|
||||||
|
#### `xclip`
|
||||||
|
|
||||||
|
当需要拷贝文件内容时,行号以及 git 标记会影响输出,此时可以使用`-p`/`--plain`参数来把纯文本传递给`xclip`。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bat main.cpp | xclip
|
||||||
|
```
|
||||||
|
|
||||||
|
`bat`会检测输出是否是管道重定向来决定是否使用纯文本输出。
|
||||||
|
|
||||||
|
#### `man`
|
||||||
|
|
||||||
|
`bat`也能给`man`的输出上色。这需要设置`MANPAGER`环境变量:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
|
||||||
|
man 2 select
|
||||||
|
```
|
||||||
|
|
||||||
|
(如果你使用的是 Debian 或者 Ubuntu,使用`batcat`替换`bat`)
|
||||||
|
|
||||||
|
如果你遇到格式化问题,设置`MANROFFOPT="-c"`也许会有帮助。
|
||||||
|
|
||||||
|
`batman`能提供类似功能——作为一个独立的命令。
|
||||||
|
|
||||||
|
注意:[man page 语法](assets/syntaxes/02_Extra/Manpage.sublime-syntax) 还需要完善。在使用特定的`man`实现时该功能[无法正常工作](https://github.com/sharkdp/bat/issues/1145)。
|
||||||
|
|
||||||
|
#### `prettier` / `shfmt` / `rustfmt`
|
||||||
|
|
||||||
|
`prettybat`脚本能够格式化代码并用`bat`输出。
|
||||||
|
|
||||||
|
## 安装
|
||||||
|
|
||||||
|
[](https://repology.org/project/bat-cat/versions)
|
||||||
|
|
||||||
|
### Ubuntu (使用 `apt`)
|
||||||
|
|
||||||
|
*... 以及其他基于 Debian的发行版.*
|
||||||
|
|
||||||
|
`bat` 要求的版本: [Ubuntu 高于 20.04 ("Focal")](https://packages.ubuntu.com/search?keywords=bat&exact=1) 和 [Debian 高于 August 2021 (Debian 11 - "Bullseye")](https://packages.debian.org/bullseye/bat).
|
||||||
|
|
||||||
|
当你的发行版满足条件那么直接在终端运执行:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo apt install bat
|
||||||
|
```
|
||||||
|
|
||||||
|
重要:如果你通过这种方法安装`bat`,请留意你所安装的可执行文件是否为`batcat`(由[其他包的可执行文件名冲突](https://github.com/sharkdp/bat/issues/982)造成)。你可以创建一个`bat -> batcat`的符号链接(symlink)或别名来避免因为可执行文件不同带来的问题并与其他发行版保持一致性。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mkdir -p ~/.local/bin
|
||||||
|
ln -s /usr/bin/batcat ~/.local/bin/bat
|
||||||
|
```
|
||||||
|
|
||||||
|
### Ubuntu (使用`.deb`包)
|
||||||
|
|
||||||
|
*... 以及其他基于 Debian的发行版.*
|
||||||
|
|
||||||
|
如果你无法使用上一种方法安装,或需要用最新版的`bat`,你可以从[release 页面](https://github.com/sharkdp/bat/releases)下载最新的`.deb`包并通过下述方法安装:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo dpkg -i bat_0.18.3_amd64.deb # adapt version number and architecture
|
||||||
|
```
|
||||||
|
|
||||||
|
### Alpine Linux
|
||||||
|
|
||||||
|
你可以用下面下列命令从官方源中安装[`bat 包`](https://pkgs.alpinelinux.org/packages?name=bat):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
apk add bat
|
||||||
|
```
|
||||||
|
|
||||||
|
### Arch Linux
|
||||||
|
|
||||||
|
你可以用下面下列命令从官方源中安装[`bat`包](https://www.archlinux.org/packages/community/x86_64/bat/):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pacman -S bat
|
||||||
|
```
|
||||||
|
|
||||||
|
### Fedora
|
||||||
|
|
||||||
|
你可以使用下列命令从官方[Fedora Modular](https://docs.fedoraproject.org/en-US/modularity/using-modules/)仓库安装[`bat` 包](https://koji.fedoraproject.org/koji/packageinfo?packageID=27506):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
dnf install bat
|
||||||
|
```
|
||||||
|
|
||||||
|
### Funtoo Linux
|
||||||
|
|
||||||
|
你可以从 dev-kit 中安装[`bat` 包](https://github.com/funtoo/dev-kit/tree/1.4-release/sys-apps/bat):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
emerge sys-apps/bat
|
||||||
|
```
|
||||||
|
|
||||||
|
### Gentoo Linux
|
||||||
|
|
||||||
|
你可以使用下列命令从官方源中安装 [`bat` 包](https://packages.gentoo.org/packages/sys-apps/bat):
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
emerge sys-apps/bat
|
||||||
|
```
|
||||||
|
|
||||||
|
### Void Linux
|
||||||
|
|
||||||
|
你可以用 xbps-install 安装`bat`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
xbps-install -S bat
|
||||||
|
```
|
||||||
|
|
||||||
|
### Termux:
|
||||||
|
|
||||||
|
你可以用 pkg 安装`bat:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pkg install bat
|
||||||
|
```
|
||||||
|
|
||||||
|
### FreeBSD
|
||||||
|
|
||||||
|
你可以用 pkg 来安装一份预编译的[`bat` 包](https://www.freshports.org/textproc/bat):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pkg install bat
|
||||||
|
```
|
||||||
|
|
||||||
|
或从 FreeBSD ports 自己编译一份:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd /usr/ports/textproc/bat
|
||||||
|
make install
|
||||||
|
```
|
||||||
|
|
||||||
|
### OpenBSD
|
||||||
|
|
||||||
|
你可以用`pkg——add`安装`bat`包
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pkg_add bat
|
||||||
|
```
|
||||||
|
|
||||||
|
### 通过 nix
|
||||||
|
|
||||||
|
你可以用[nix 包管理器](https://nixos.org/nix)安装`bat`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nix-env -i bat
|
||||||
|
```
|
||||||
|
|
||||||
|
### openSUSE
|
||||||
|
|
||||||
|
你可以用 zypper 安装`bat`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
zypper install bat
|
||||||
|
```
|
||||||
|
|
||||||
|
### 通过 snap
|
||||||
|
|
||||||
|
目前还没有推荐的 snap 包可用。可以使用其他现存的包但不会受到官方支持且可能会遇到[问题](https://github.com/sharkdp/bat/issues/1519)。
|
||||||
|
|
||||||
|
### macOS (或 Linux) 通过 Homebrew
|
||||||
|
|
||||||
|
你可以用 [Homebrew on MacOS](https://formulae.brew.sh/formula/bat) 或者 [Homebrew on Linux](https://formulae.brew.sh/formula-linux/bat) 安装`bat`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
brew install bat
|
||||||
|
```
|
||||||
|
|
||||||
|
### macOS 通过 MacPorts
|
||||||
|
|
||||||
|
或用 [MacPorts](https://ports.macports.org/port/bat/summary) 安装`bat`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
port install bat
|
||||||
|
```
|
||||||
|
|
||||||
|
### Windows
|
||||||
|
|
||||||
|
在 Windows 上具有多种安装`bat`的方法。若你已完成安装,记得看看 ["在 Windows 上使用`bat`"](#在-Windows-中使用-bat) 。
|
||||||
|
|
||||||
|
#### 前置条件
|
||||||
|
|
||||||
|
你必须已安装 [Visual C++ Redistributable](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads) 包。
|
||||||
|
|
||||||
|
#### 使用 Chocolatey
|
||||||
|
|
||||||
|
你可以用[Chocolatey](https://chocolatey.org/packages/Bat) 安装`bat`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
choco install bat
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 使用 Scoop
|
||||||
|
|
||||||
|
你可以用 [scoop](https://scoop.sh/) 安装`bat`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
scoop install bat
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 使用预编译二进制版本
|
||||||
|
|
||||||
|
直接从 [Release 发布页](https://github.com/sharkdp/bat/releases) 下载已经编译好的二进制包,前提是你安装了 [Visual C++ Redistributable](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads) 包。
|
||||||
|
|
||||||
|
### 使用二进制版本
|
||||||
|
|
||||||
|
在 [Release 发布页](https://github.com/sharkdp/bat/releases) 中可以找到为多种架构构建的`bat`版本和静态编译的二进制文件(文件名带有`musl`)。
|
||||||
|
|
||||||
|
### 从源码编译
|
||||||
|
|
||||||
|
如果你想要自己构建`bat`,那么你需要安装有高于1.51版本的 Rust。
|
||||||
|
|
||||||
|
使用以下命令编译。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cargo install --locked bat
|
||||||
|
```
|
||||||
|
|
||||||
|
注意:man page或 shell 自动补全所需要的额外文件无法通过该方法安装。但你可以在`cargo`的生成目录找到这些文件(`build`目录下)。
|
||||||
|
|
||||||
|
## 自定义
|
||||||
|
|
||||||
|
### 语法高亮主题
|
||||||
|
|
||||||
|
使用 `bat --list-themes` 一份语法高亮主题的清单,然后用`--theme=TwoDark`来指定主题为`TwoDark`,也可以通过设置`BAT_THEME`环境变量来选定主题。把`export BAT_THEME="TwoDark"`添加到 shell 的启动脚本(shell startup file)来取得永久效果。或者使用`bat`的[配置文件](#c配置文件)
|
||||||
|
|
||||||
|
若想要查看所有主题在一个文件上的显示效果可以用一下命令(需要安装`fzf`):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bat --list-themes | fzf --preview="bat --theme={} --color=always /path/to/file"
|
||||||
|
```
|
||||||
|
|
||||||
|
`bat`在默认情况下能够在黑色主题背景下获得较好的效果,如果你的终端使用亮色背景,可以试试`GitHub`或`OneHalfLight`。想要添加自定义主题可以参考[添加主题](#添加主题)。
|
||||||
|
|
||||||
|
### 8-bit 主题
|
||||||
|
|
||||||
|
`bat` 自带三个 [8-bit 色彩](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors) 主题:
|
||||||
|
|
||||||
|
- `ansi` 适应于大部分终端。它使用 3-bit 色彩:黑红绿黄蓝洋红靛青白。
|
||||||
|
- `base16`专为 [base16](https://github.com/chriskempson/base16) 终端设计。它使用 4-bit 色彩(带有亮度的 3-bit 色彩)。根据 [base16 styling guidelines](https://github.com/chriskempson/base16/blob/master/styling.md) 制作。
|
||||||
|
- `base16-25`专为 [base16-shell](https://github.com/chriskempson/base16-shell) 设计。它把部分亮色替换为 8-bit 色彩。请不要直接使用该主题,除非你清楚你的256色终端是否使用 base16-shell。
|
||||||
|
|
||||||
|
尽管这些主题具有诸多限制,但具有一些 truecolor 主题不具有的三个优点:
|
||||||
|
|
||||||
|
- 享有最佳兼容性。并不是所有终端工具都支持高于 3-bit 的色彩。
|
||||||
|
- 适应终端主题。
|
||||||
|
- 视觉上和其他的终端工具更协调。
|
||||||
|
|
||||||
|
### 输出样式
|
||||||
|
|
||||||
|
你可以用`--style`参数来控制`bat`输出的样式。使用`--style=numbers,chanegs`可以只开启 Git 修改和行号显示而不添加其他内容。`BAT_STYLE`环境变量具有相同功能。
|
||||||
|
|
||||||
|
### 添加新的语言和语法
|
||||||
|
|
||||||
|
当现有的`bat`不支持某个语言或语法时你可以自己添加。
|
||||||
|
|
||||||
|
`bat`使用`syntect`库来支持语法高亮,该库使用 [Sublime Text `.sublime-syntax` 语法文件](https://www.sublimetext.com/docs/3/syntax.html)和主题。而后者中的大部分可以在 [Package Control](https://packagecontrol.io/) 找到。
|
||||||
|
|
||||||
|
当你找到一份语法文件,按照下列方法:
|
||||||
|
|
||||||
|
1. 创建包含语法描述文件的目录:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mkdir -p "$(bat --config-dir)/syntaxes"
|
||||||
|
cd "$(bat --config-dir)/syntaxes"
|
||||||
|
|
||||||
|
# Put new '.sublime-syntax' language definition files
|
||||||
|
# in this folder (or its subdirectories), for example:
|
||||||
|
git clone https://github.com/tellnobody1/sublime-purescript-syntax
|
||||||
|
```
|
||||||
|
|
||||||
|
2. 调用下面指令把文件转换为二进制缓存:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bat cache --build
|
||||||
|
```
|
||||||
|
|
||||||
|
3. 最后用`bat --list-languages`来检查新的语法是否被成功导入。如果想要回滚到最初状态,执行:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bat cache --clear
|
||||||
|
```
|
||||||
|
|
||||||
|
4. 如果你觉得`bat`有必要自带该语法支持,请在阅读[指导](doc/assets.md)后向仓库提交 [Syntax Request](https://github.com/sharkdp/bat/issues/new?labels=syntax-request&template=syntax_request.md)。
|
||||||
|
|
||||||
|
### 添加主题
|
||||||
|
|
||||||
|
类似添加语法支持,第一步也是创建一个带有语法高亮的目录
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mkdir -p "$(bat --config-dir)/themes"
|
||||||
|
cd "$(bat --config-dir)/themes"
|
||||||
|
|
||||||
|
# 下载一个主题
|
||||||
|
git clone https://github.com/greggb/sublime-snazzy
|
||||||
|
|
||||||
|
# 更新二进制缓存
|
||||||
|
bat cache --build
|
||||||
|
```
|
||||||
|
|
||||||
|
然后用`bat --list-themes`检查添加是否成功。
|
||||||
|
|
||||||
|
### 添加或修改文件关联
|
||||||
|
|
||||||
|
你可以用`--map-syntax`参数添加或修改文件名模板。它需要一个类似`pattern:syntax`的参数来指定,其中`pattern`是 glob 文件匹配模板,`syntax`则是支持的语法的完整名(使用`bat --list-languages`来查看获取一份清单)。
|
||||||
|
|
||||||
|
注意:方便起见,你可能需要把参数添加到配置文件,而不是每次都在命令行中传递该参数。
|
||||||
|
|
||||||
|
以下展示了把“INI”关联到具有`.conf`扩展名的文件
|
||||||
|
|
||||||
|
```bash
|
||||||
|
--map-syntax='*.conf:INI'
|
||||||
|
```
|
||||||
|
|
||||||
|
把`.ignore`文件与“Git Ignore”关联
|
||||||
|
|
||||||
|
```bash
|
||||||
|
--map-syntax='.ignore:Git Ignore'
|
||||||
|
```
|
||||||
|
|
||||||
|
把`/etc/apache2`内的`.conf`文件关联到“Apache Conf”语法(`bat`已默认绑定)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
--map-syntax='/etc/apache2/**/*.conf:Apache Conf'
|
||||||
|
```
|
||||||
|
|
||||||
|
### 使用自定义分页器
|
||||||
|
|
||||||
|
`bat`默认使用`PAGER`环境变量定义的分页器,如果没有定义则使用`less`。`bat`提供了`BAT_PAGER`环境变量来专为`bat`选择分页器(优先级高于`PAGER`)。
|
||||||
|
|
||||||
|
注意:当`PAGER`设置为`more`或`most`时,`bat`会使用`less`来代替以确保能提供色彩支持。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export BAT_PAGER="less -RF"
|
||||||
|
```
|
||||||
|
|
||||||
|
除了使用环境变量来改变`bat`使用的的分页器,也可以在配置文件中提供`--pager`参数。
|
||||||
|
|
||||||
|
注意:`bat`会把部分命令行参数直接传递给分页器:`-R`/`--RAW-CONTROL-CHARS`,`-F`/`--quit-if-one-screen`以及`-X`/`--no-init`(该参数仅适用于高于530版本的`less`)。其中`-R` 参数需要在解释 ANSI 标准颜色时起作用。`-F`则指示`less`在输出内容的垂直尺寸小于终端尺寸时立即退出。当文件内容可以在一个屏幕里完全显示时,就不需要按`q`键退出阅读模式,很方便就是了。`-X`则能修复`-F`在`less`的老版本中的一些bug(代价是不支持鼠标滚轮,但可以用`-R`来取消`quit-if-one-screen`功能。)。
|
||||||
|
|
||||||
|
### 缩进
|
||||||
|
|
||||||
|
`bat` 使用四个空格宽的制表符,而不受分页器影响,同时也可以用`--tabs`参数来自定义。
|
||||||
|
|
||||||
|
注意:通过其他方法针对分页器的制表符设置不会生效(例如通过`bat`的`--pager`参数传递或`less`使用的`LESS`环境变量)。因为在输出提交给分页器之前,内容中的制表符就已经被`bat`替换为了特定长度的空格以避免由于边栏导致的缩进问题。你可以用给`bat`传递`--tabs=0`参数来取消该设定并让分页器自己处理制表符。
|
||||||
|
|
||||||
|
### 暗色模式
|
||||||
|
|
||||||
|
如果你用的 macOS 处于暗色模式,你可以为`bat`启用基于系统主题的主题。如下所示操作会让`bat`在系统处于亮色模式时加载`GitHub`主题和暗色模式时加载`default`主题。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
alias cat="bat --theme=\$(defaults read -globalDomain AppleInterfaceStyle &> /dev/null && echo default || echo GitHub)"
|
||||||
|
```
|
||||||
|
|
||||||
|
## 配置文件
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bat --config-file
|
||||||
|
```
|
||||||
|
|
||||||
|
你也可以用`BAT_CONFIG_PATH`来为`bat`指定自定义位置的配置文件:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export BAT_CONFIG_PATH="/path/to/bat.conf"
|
||||||
|
```
|
||||||
|
|
||||||
|
使用`--generate-config-file`参数调用`bat`会在指定位置生成一份默认的`bat`配置文件:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bat --generate-config-file
|
||||||
|
```
|
||||||
|
|
||||||
|
### 格式
|
||||||
|
|
||||||
|
配置文件其实是一份按行分割的命令行参数列表。你可以用`bat --help`来查看所有可用的参数和适用的值。配置文件中`#`打头的行会被视为注释而不生效。
|
||||||
|
|
||||||
|
以下是一份示例:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 设置主题为 TwoDark
|
||||||
|
--theme="TwoDark"
|
||||||
|
|
||||||
|
# 显示行号和 Git 修改信息, 但没有边框
|
||||||
|
--style="numbers,changes,header"
|
||||||
|
|
||||||
|
# 在终端中以斜体输出文本(不是所有终端都支持)
|
||||||
|
--italic-text=always
|
||||||
|
|
||||||
|
# 使用 C++ 语法来给 Ardiuno 的 .ino 文件提供高亮
|
||||||
|
--map-syntax "*.ino:C++"
|
||||||
|
```
|
||||||
|
|
||||||
|
## 在 Windows 中使用 `bat`
|
||||||
|
|
||||||
|
`bat` 在 Windows 上开箱即用,除了部分功能需要额外配置。
|
||||||
|
|
||||||
|
### 前置条件
|
||||||
|
|
||||||
|
你需要先安装 [Visual C++ Redistributable](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads) 包。
|
||||||
|
|
||||||
|
### 分页
|
||||||
|
|
||||||
|
Windows 只有一个提供有限功能的分页器,你可以从[这里下载](http://www.greenwoodsoftware.com/less/download.html)或用 [Chocolatey 安装](https://chocolatey.org/packages/Less) Windows 版本的`less`。第一种方法需要你把它所在目录加入`PATH`环境变量或[定义分页器变量](#使用自定义分页器)
|
||||||
|
|
||||||
|
### 色彩
|
||||||
|
|
||||||
|
Windows 10 从 [v1511](https://en.wikipedia.org/wiki/Windows_10_version_history#Version_1511_(November_Update)) 开始 shell(`conhost.exe`,命令提示符或 Powershell)原生支持色彩。在早些版本的 Windows 中你可以用第三方终端如 [Cmder](http://cmder.net/) (使用[ConEmu](https://conemu.github.io/))。
|
||||||
|
|
||||||
|
注意:Git 和 MSYS 版本的 `less` 没法正确在 Windows 表达色彩。如果你没有安装其他分页器,你可以直接用`--paging=never`或设置`BAT_PAGER`为空字符串来关闭分页功能。
|
||||||
|
|
||||||
|
### Cygwin
|
||||||
|
|
||||||
|
Windows 上的`bat`原生不支持 Cygwin' unix-style 路径(`/cygdrive/*`)。当传递一个绝对 cygwin 路径作为参数值时,`bat`会产生`The system cannot find the path specified. (os error 3)`的错误。你可以`.bash_profile`文件中添加以下函数来解决这个问题。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bat() {
|
||||||
|
local index
|
||||||
|
local args=("$@")
|
||||||
|
for index in $(seq 0 ${#args[@]}) ; do
|
||||||
|
case "${args[index]}" in
|
||||||
|
-*) continue;;
|
||||||
|
*) [ -e "${args[index]}" ] && args[index]="$(cygpath --windows "${args[index]}")";;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
command bat "${args[@]}"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## 疑难解答
|
||||||
|
|
||||||
|
### 输出内容含糊不清
|
||||||
|
|
||||||
|
当输入文件包含颜色代码和其他 ANSI 转义符号时,`bat`会产生错误的语法高亮和文本,导致输出看起来令人无法理解。当你需要输出该文件时,请使用`--color=never --wrap=never`参数来关闭上色和文字包裹。
|
||||||
|
|
||||||
|
### 终端与色彩
|
||||||
|
|
||||||
|
`bat`会区分支持 truecolor 和不支持 truecolor 的终端。但是大部分语法高亮主题都是用了没有为 8-bit 色彩支持的颜色,因此强烈推荐使用一个支持 24-bit 色彩的终端(`terminator`,`konsole`,`iTerm2`...),或使用一个 [8-bit 主题](#8-bit-主题)来限制一些颜色。查看[这篇文章使用自定义分页器](https://gist.github.com/XVilka/8346728)了解更多支持 truecolor 的终端。你需要定义`COLORTERM`变量为`truecolor`或`24bit`来确保`bat`能够识别终端的对颜色的支持,否则会使用 8 bit 模式。
|
||||||
|
|
||||||
|
### 行号和边框很难看清
|
||||||
|
|
||||||
|
试试其他主题,说不定能有所改善(用`bat --list-themes`查看主题列表)。
|
||||||
|
|
||||||
|
### 文件编码
|
||||||
|
|
||||||
|
`bat`原生支持 UTF-8 和 UTF-16。至于其他文件你可能需要在使用`bat`之前先把编码转换到UTF-8。
|
||||||
|
|
||||||
|
这里展示了使用`iconv`来把 Latin-1(ISO-8859-1) 编码的 PHP 文件转换到 UTF-8:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
iconv -f ISO-8859-1 -t UTF-8 my-file.php | bat
|
||||||
|
```
|
||||||
|
|
||||||
|
注意: 当`bat`无法识别语言时你可能会需要`-l`/`--language`参数。
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Recursive clone to retrieve all submodules
|
||||||
|
git clone --recursive https://github.com/sharkdp/bat
|
||||||
|
|
||||||
|
# Build (debug version)
|
||||||
|
cd bat
|
||||||
|
cargo build --bins
|
||||||
|
|
||||||
|
# Run unit tests and integration tests
|
||||||
|
cargo test
|
||||||
|
|
||||||
|
# Install (release version)
|
||||||
|
cargo install --path . --locked
|
||||||
|
|
||||||
|
# Build a bat binary with modified syntaxes and themes
|
||||||
|
bash assets/create.sh
|
||||||
|
cargo install --path . --locked --force
|
||||||
|
```
|
||||||
|
|
||||||
|
If you want to build an application that uses `bat`s pretty-printing
|
||||||
|
features as a library, check out the [the API documentation](https://docs.rs/bat/).
|
||||||
|
Note that you have to use either `regex-onig` or `regex-fancy` as a feature
|
||||||
|
when you depend on `bat` as a library.
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
Take a look at the [`CONTRIBUTING.md`](CONTRIBUTING.md) guide.
|
||||||
|
|
||||||
|
## Maintainers
|
||||||
|
|
||||||
|
- [sharkdp](https://github.com/sharkdp)
|
||||||
|
- [eth-p](https://github.com/eth-p)
|
||||||
|
- [keith-hall](https://github.com/keith-hall)
|
||||||
|
- [Enselic](https://github.com/Enselic)
|
||||||
|
|
||||||
|
## Security vulnerabilities
|
||||||
|
|
||||||
|
Please contact [David Peter](https://david-peter.de/) via email if you want to report a vulnerability in `bat`.
|
||||||
|
|
||||||
|
## Project goals and alternatives
|
||||||
|
|
||||||
|
`bat` tries to achieve the following goals:
|
||||||
|
|
||||||
|
- Provide beautiful, advanced syntax highlighting
|
||||||
|
- Integrate with Git to show file modifications
|
||||||
|
- Be a drop-in replacement for (POSIX) `cat`
|
||||||
|
- Offer a user-friendly command-line interface
|
||||||
|
|
||||||
|
There are a lot of alternatives, if you are looking for similar programs. See
|
||||||
|
[this document](doc/alternatives.md) for a comparison.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Copyright (c) 2018-2021 [bat-developers](https://github.com/sharkdp/bat).
|
||||||
|
|
||||||
|
`bat` is made available under the terms of either the MIT License or the Apache License 2.0, at your option.
|
||||||
|
|
||||||
|
See the [LICENSE-APACHE](LICENSE-APACHE) and [LICENSE-MIT](LICENSE-MIT) files for license details.
|
@@ -22,3 +22,42 @@ request.
|
|||||||
Some other alternatives that are also related, but not yet included in the table:
|
Some other alternatives that are also related, but not yet included in the table:
|
||||||
- [lesspipe](https://github.com/wofr06/lesspipe)
|
- [lesspipe](https://github.com/wofr06/lesspipe)
|
||||||
- [vimpager](https://github.com/rkitover/vimpager)
|
- [vimpager](https://github.com/rkitover/vimpager)
|
||||||
|
|
||||||
|
## Benchmarks
|
||||||
|
|
||||||
|
The benchmarks above have been created with this script:
|
||||||
|
```bash
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
cd "$(dirname "${BASH_SOURCE[0]}")" || exit
|
||||||
|
|
||||||
|
if ! command -v hyperfine > /dev/null 2>&1; then
|
||||||
|
echo "'hyperfine' does not seem to be installed."
|
||||||
|
echo "You can get it here: https://github.com/sharkdp/hyperfine"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
SRC="test-src/jquery-3.3.1.js"
|
||||||
|
|
||||||
|
|
||||||
|
cmd_bat="bat --style=full --color=always --paging=never '$SRC'"
|
||||||
|
cmd_bat_simple="bat --plain --wrap=never --tabs=0 --color=always --paging=never '$SRC'"
|
||||||
|
cmd_pygmentize="pygmentize -g '$SRC'"
|
||||||
|
cmd_highlight="highlight -O truecolor '$SRC'"
|
||||||
|
cmd_ccat="ccat --color=always '$SRC'"
|
||||||
|
cmd_source_highlight="source-highlight --failsafe --infer-lang -f esc -i '$SRC'"
|
||||||
|
cmd_hicat="hicat '$SRC'"
|
||||||
|
cmd_coderay="coderay '$SRC'"
|
||||||
|
cmd_rouge="rougify '$SRC'"
|
||||||
|
|
||||||
|
hyperfine --warmup 3 \
|
||||||
|
"$cmd_bat" \
|
||||||
|
"$cmd_bat_simple" \
|
||||||
|
"$cmd_pygmentize" \
|
||||||
|
"$cmd_highlight" \
|
||||||
|
"$cmd_ccat" \
|
||||||
|
"$cmd_source_highlight" \
|
||||||
|
"$cmd_hicat" \
|
||||||
|
"$cmd_coderay" \
|
||||||
|
"$cmd_rouge" \
|
||||||
|
```
|
||||||
|
@@ -9,7 +9,9 @@ in the `.sublime-syntax` format.
|
|||||||
**Important:** Before proceeding, verify that the syntax you wish to add meets the [criteria for inclusion](#Criteria-for-inclusion-of-new-syntaxes).
|
**Important:** Before proceeding, verify that the syntax you wish to add meets the [criteria for inclusion](#Criteria-for-inclusion-of-new-syntaxes).
|
||||||
|
|
||||||
1. Find a Sublime Text syntax for the given language, preferably in a separate Git repository
|
1. Find a Sublime Text syntax for the given language, preferably in a separate Git repository
|
||||||
which can be included as a submodule (under `assets/syntaxes`).
|
which can be included as a submodule (under `assets/syntaxes`) using
|
||||||
|
`git submodule add <https github link> ./assets/syntaxes/02_Extra/<repo name>`, replacing
|
||||||
|
the contents of the angle brackets as appropriate.
|
||||||
|
|
||||||
2. If the Sublime Text syntax is only available as a `.tmLanguage` file, open the file in
|
2. If the Sublime Text syntax is only available as a `.tmLanguage` file, open the file in
|
||||||
Sublime Text and convert it to a `.sublime-syntax` file via *Tools* -> *Developer* ->
|
Sublime Text and convert it to a `.sublime-syntax` file via *Tools* -> *Developer* ->
|
||||||
@@ -26,7 +28,8 @@ in the `.sublime-syntax` format.
|
|||||||
6. Add a syntax test for the new language. See [below](#Syntax-tests) for details.
|
6. Add a syntax test for the new language. See [below](#Syntax-tests) for details.
|
||||||
|
|
||||||
7. If you send a pull request with your changes, please do *not* include the changed `syntaxes.bin`
|
7. If you send a pull request with your changes, please do *not* include the changed `syntaxes.bin`
|
||||||
file. A new binary cache file will be created once before every new release of `bat`.
|
file. A new binary cache file will be created once before every new release of `bat`. This
|
||||||
|
avoids bloating the repository size unnecessarily.
|
||||||
|
|
||||||
### Syntax tests
|
### Syntax tests
|
||||||
|
|
||||||
@@ -68,7 +71,7 @@ themes (`bat cache --clear`).
|
|||||||
|
|
||||||
## Criteria for inclusion of new syntaxes
|
## Criteria for inclusion of new syntaxes
|
||||||
|
|
||||||
* More than 10,000 downloads on packagecontrol.io/
|
* More than 10,000 downloads at [Package Control](https://packagecontrol.io)
|
||||||
|
|
||||||
### Manual modifications
|
### Manual modifications
|
||||||
|
|
||||||
|
63
doc/release-checklist.md
Normal file
63
doc/release-checklist.md
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
# Release checklist
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
See this page for a good overview: https://deps.rs/repo/github/sharkdp/bat
|
||||||
|
|
||||||
|
- [ ] Optional: update dependencies with `cargo update`. This is also done by
|
||||||
|
dependabot, so it is not strictly necessary.
|
||||||
|
- [ ] Install [cargo-outdated](https://crates.io/crates/cargo-outdated). Check
|
||||||
|
for outdated dependencies with `cargo outdated --root-deps-only` and
|
||||||
|
decide for each of them whether we want to (manually) upgrade. This will
|
||||||
|
require changes to `Cargo.toml`.
|
||||||
|
|
||||||
|
## Version bump
|
||||||
|
|
||||||
|
- [ ] Update version in `Cargo.toml`. Run `cargo build` to update `Cargo.lock`.
|
||||||
|
Make sure to `git add` the `Cargo.lock` changes as well.
|
||||||
|
- [ ] Find the current min. supported Rust version by running
|
||||||
|
`grep '^\s*MIN_SUPPORTED_RUST_VERSION' .github/workflows/CICD.yml`.
|
||||||
|
- [ ] Update the version and the min. supported Rust version in `README.md` and
|
||||||
|
`doc/README-*.md`. Check with `git grep -i 'rust.*1\.'` and
|
||||||
|
`git grep -i '1\..*rust'`.
|
||||||
|
- [ ] Update `CHANGELOG.md`. Introduce a section for the new release.
|
||||||
|
|
||||||
|
## Update syntaxes and themes (build assets)
|
||||||
|
|
||||||
|
- [ ] Install the latest master version (`cargo install -f --path .`) and make
|
||||||
|
sure that it is available on the `PATH` (`bat --version` should show the
|
||||||
|
new version).
|
||||||
|
- [ ] Run `assets/create.sh` and check in the binary asset files.
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
- [ ] Review the `-h` and `--help` texts
|
||||||
|
- [ ] Review the `man` page
|
||||||
|
|
||||||
|
## Pre-release checks
|
||||||
|
|
||||||
|
- [ ] Push all changes and wait for CI to succeed (before continuing with the
|
||||||
|
next section).
|
||||||
|
- [ ] Optional: manually test the new features and command-line options. To do
|
||||||
|
this, install the latest `bat` version again (to include the new syntaxes
|
||||||
|
and themes).
|
||||||
|
- [ ] Run `cargo publish --dry-run --allow-dirty` to make sure that it will
|
||||||
|
succeed later (after creating the GitHub release).
|
||||||
|
|
||||||
|
## Release
|
||||||
|
|
||||||
|
- [ ] Create a tag and push it: `git tag vX.Y.Z; git push origin tag vX.Y.Z`.
|
||||||
|
This will trigger the deployment via GitHub Actions.
|
||||||
|
- [ ] Go to https://github.com/sharkdp/bat/releases/new to create the new
|
||||||
|
release. Select the new tag and also use it as the release title. For the
|
||||||
|
release notes, copy the corresponding section from `CHANGELOG.md` and
|
||||||
|
possibly add additional remarks for package maintainers.
|
||||||
|
Publish the release.
|
||||||
|
- [ ] Check if the binary deployment works (archives and Debian packages should
|
||||||
|
appear when the CI run for the Git tag has finished).
|
||||||
|
- [ ] Publish to crates.io by running `cargo publish` in a *clean* repository.
|
||||||
|
The safest way to do this is to clone a fresh copy.
|
||||||
|
|
||||||
|
## Post-release
|
||||||
|
|
||||||
|
- [ ] Prepare a new (empty) "unreleased" section at the top of `CHANGELOG.md`.
|
12
doc/sponsors.md
Normal file
12
doc/sponsors.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
## Sponsors
|
||||||
|
|
||||||
|
Please note, that being sponsored does not affect the individuality of the `bat`
|
||||||
|
project or affect the maintainers' actions in any way.
|
||||||
|
We remain impartial and continue to assess pull requests solely on merit - the
|
||||||
|
features added, bugs solved, and effect on the overall complexity of the code.
|
||||||
|
No issue will have a different priority based on sponsorship status of the
|
||||||
|
reporter.
|
||||||
|
|
||||||
|
Contributions from anybody are most welcomed, please see our [`CONTRIBUTING.md`](../CONTRIBUTING.md) guide.
|
||||||
|
|
||||||
|
If you want to see our biggest sponsors, check the top of [`README.md`](../README.md#sponsors).
|
11
doc/sponsors/workos-logo-white-bg.svg
Normal file
11
doc/sponsors/workos-logo-white-bg.svg
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<svg width="1354" height="420" viewBox="0 0 1354 420" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<rect width="1354" height="420" rx="20" fill="white"/>
|
||||||
|
<path d="M434.751 133.122H466.637L489.595 227.729C493.852 245.585 494.697 256.219 494.697 256.219H495.128C495.128 256.219 496.61 245.808 500.867 227.729L522.757 133.122H558.9L582.066 227.729C586.53 246.223 587.598 256.219 587.598 256.219H588.236C588.236 256.219 588.666 246.223 592.907 227.729L615.02 133.122H646.907L606.523 288.313H571.017L546.576 194.344C541.474 173.936 541.044 164.801 541.044 164.801H540.614C540.614 164.801 540.183 173.936 535.512 194.344L512.553 288.313H475.996L434.751 133.122Z" fill="black"/>
|
||||||
|
<path d="M641.583 231.934C641.583 196.428 664.541 173.47 699.202 173.47C733.639 173.47 756.597 196.428 756.597 231.934C756.597 267.647 733.639 290.828 699.202 290.828C664.557 290.812 641.583 267.647 641.583 231.934ZM726.832 231.934C726.832 208.976 715.783 195.998 699.202 195.998C681.346 195.998 671.349 210.458 671.349 231.934C671.349 255.323 682.398 268.284 699.202 268.284C717.058 268.284 726.832 253.824 726.832 231.934Z" fill="black"/>
|
||||||
|
<path d="M770.836 175.21H799.103V196.048H799.741C804.635 185.207 816.322 174.365 836.299 174.365C839.695 174.365 841.831 174.796 843.314 175.21V203.478H842.469C842.469 203.478 839.918 202.633 832.903 202.633C811.013 202.633 799.103 215.594 799.103 239.828V288.295H770.836V175.21Z" fill="black"/>
|
||||||
|
<path d="M856.5 133.122H884.767V182.865C884.767 212.2 884.336 217.509 884.336 217.509H884.767L926.857 175.212H962.139L912.843 224.11L970.031 288.313H936.646L895.401 241.536L884.767 251.946V288.297H856.5V133.122Z" fill="black"/>
|
||||||
|
<path d="M970.444 211.285C970.444 163.455 1000.21 131.569 1044.85 131.569C1089.49 131.569 1119.26 163.455 1119.26 211.285C1119.26 259.114 1089.49 291.001 1044.85 291.001C1000.21 291.001 970.444 259.114 970.444 211.285ZM1088.42 211.285C1088.42 178.761 1071 156.855 1044.84 156.855C1018.67 156.855 1001.26 178.761 1001.26 211.285C1001.26 243.809 1018.69 265.715 1044.84 265.715C1070.98 265.715 1088.42 243.809 1088.42 211.285Z" fill="black"/>
|
||||||
|
<path d="M1130.08 236.656H1162.4C1162.4 254.943 1174.95 265.146 1194.08 265.146C1210.23 265.146 1221.29 257.063 1221.29 245.584C1221.29 232.622 1212.79 229.21 1185.79 223.901C1161.12 219.007 1134.98 210.716 1134.98 178.399C1134.98 151.408 1157.93 131 1193.01 131C1229.57 131 1252.11 150.132 1252.11 179.037H1219.79C1219.79 165.007 1208.95 156.286 1193.01 156.286C1176.86 156.286 1166.86 164.146 1166.86 175.625C1166.86 187.742 1173.88 192.413 1195.56 196.878C1227.65 203.685 1254.02 207.288 1254.02 243.001C1254.02 271.3 1229.36 290.432 1193.01 290.432C1156.02 290.432 1130.08 268.957 1130.08 236.656Z" fill="black"/>
|
||||||
|
<path d="M100 210C100 214.824 101.269 219.647 103.723 223.793L148.231 300.878C152.8 308.747 159.739 315.178 168.369 318.055C185.377 323.724 202.977 316.447 211.354 301.893L222.1 283.278L179.708 210L224.47 132.408L235.216 113.792C238.431 108.208 242.747 103.638 247.824 100H243.17H178.777C166.677 100 155.508 106.431 149.5 116.923L103.723 196.208C101.269 200.354 100 205.177 100 210Z" fill="#6363F1"/>
|
||||||
|
<path d="M353.847 210C353.847 205.177 352.578 200.353 350.124 196.207L305.024 118.107C296.647 103.638 279.047 96.3608 262.039 101.945C253.409 104.822 246.47 111.253 241.901 119.122L231.747 136.638L274.139 210L229.378 287.592L218.632 306.208C215.416 311.708 211.101 316.362 206.024 320H210.678H275.07C287.17 320 298.34 313.569 304.347 303.077L350.124 223.792C352.578 219.646 353.847 214.823 353.847 210Z" fill="#6363F1"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 3.4 KiB |
584
src/assets.rs
584
src/assets.rs
@@ -1,210 +1,207 @@
|
|||||||
use std::collections::BTreeMap;
|
|
||||||
use std::ffi::OsStr;
|
use std::ffi::OsStr;
|
||||||
use std::fs::{self, File};
|
use std::fs;
|
||||||
use std::io::BufReader;
|
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
use syntect::dumps::{dump_to_file, from_binary, from_reader};
|
use once_cell::unsync::OnceCell;
|
||||||
use syntect::highlighting::{Theme, ThemeSet};
|
|
||||||
use syntect::parsing::{SyntaxReference, SyntaxSet, SyntaxSetBuilder};
|
use syntect::highlighting::Theme;
|
||||||
|
use syntect::parsing::{SyntaxReference, SyntaxSet};
|
||||||
|
|
||||||
use path_abs::PathAbs;
|
use path_abs::PathAbs;
|
||||||
|
|
||||||
use crate::assets_metadata::AssetsMetadata;
|
|
||||||
use crate::bat_warning;
|
|
||||||
use crate::error::*;
|
use crate::error::*;
|
||||||
use crate::input::{InputReader, OpenedInput, OpenedInputKind};
|
use crate::input::{InputReader, OpenedInput};
|
||||||
use crate::syntax_mapping::{MappingTarget, SyntaxMapping};
|
use crate::syntax_mapping::ignored_suffixes::IgnoredSuffixes;
|
||||||
|
use crate::syntax_mapping::MappingTarget;
|
||||||
|
use crate::{bat_warning, SyntaxMapping};
|
||||||
|
|
||||||
|
use lazy_theme_set::LazyThemeSet;
|
||||||
|
|
||||||
|
use serialized_syntax_set::*;
|
||||||
|
|
||||||
|
#[cfg(feature = "build-assets")]
|
||||||
|
pub use crate::assets::build_assets::*;
|
||||||
|
|
||||||
|
pub(crate) mod assets_metadata;
|
||||||
|
#[cfg(feature = "build-assets")]
|
||||||
|
mod build_assets;
|
||||||
|
mod lazy_theme_set;
|
||||||
|
mod serialized_syntax_set;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct HighlightingAssets {
|
pub struct HighlightingAssets {
|
||||||
pub(crate) syntax_set: SyntaxSet,
|
syntax_set_cell: OnceCell<SyntaxSet>,
|
||||||
pub(crate) theme_set: ThemeSet,
|
serialized_syntax_set: SerializedSyntaxSet,
|
||||||
|
|
||||||
|
theme_set: LazyThemeSet,
|
||||||
fallback_theme: Option<&'static str>,
|
fallback_theme: Option<&'static str>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct SyntaxReferenceInSet<'a> {
|
||||||
|
pub syntax: &'a SyntaxReference,
|
||||||
|
pub syntax_set: &'a SyntaxSet,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Compress for size of ~700 kB instead of ~4600 kB at the cost of ~30% longer deserialization time
|
||||||
|
pub(crate) const COMPRESS_SYNTAXES: bool = true;
|
||||||
|
|
||||||
|
/// We don't want to compress our [LazyThemeSet] since the lazy-loaded themes
|
||||||
|
/// within it are already compressed, and compressing another time just makes
|
||||||
|
/// performance suffer
|
||||||
|
pub(crate) const COMPRESS_THEMES: bool = false;
|
||||||
|
|
||||||
|
/// Compress for size of ~40 kB instead of ~200 kB without much difference in
|
||||||
|
/// performance due to lazy-loading
|
||||||
|
pub(crate) const COMPRESS_LAZY_THEMES: bool = true;
|
||||||
|
|
||||||
|
/// Compress for size of ~10 kB instead of ~120 kB
|
||||||
|
pub(crate) const COMPRESS_ACKNOWLEDGEMENTS: bool = true;
|
||||||
|
|
||||||
impl HighlightingAssets {
|
impl HighlightingAssets {
|
||||||
|
fn new(serialized_syntax_set: SerializedSyntaxSet, theme_set: LazyThemeSet) -> Self {
|
||||||
|
HighlightingAssets {
|
||||||
|
syntax_set_cell: OnceCell::new(),
|
||||||
|
serialized_syntax_set,
|
||||||
|
theme_set,
|
||||||
|
fallback_theme: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn default_theme() -> &'static str {
|
pub fn default_theme() -> &'static str {
|
||||||
"Monokai Extended"
|
"Monokai Extended"
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_files(source_dir: &Path, include_integrated_assets: bool) -> Result<Self> {
|
|
||||||
let mut theme_set = if include_integrated_assets {
|
|
||||||
Self::get_integrated_themeset()
|
|
||||||
} else {
|
|
||||||
ThemeSet {
|
|
||||||
themes: BTreeMap::new(),
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
let theme_dir = source_dir.join("themes");
|
|
||||||
if theme_dir.exists() {
|
|
||||||
let res = theme_set.add_from_folder(&theme_dir);
|
|
||||||
if let Err(err) = res {
|
|
||||||
println!(
|
|
||||||
"Failed to load one or more themes from '{}' (reason: '{}')",
|
|
||||||
theme_dir.to_string_lossy(),
|
|
||||||
err,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
println!(
|
|
||||||
"No themes were found in '{}', using the default set",
|
|
||||||
theme_dir.to_string_lossy()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut syntax_set_builder = if !include_integrated_assets {
|
|
||||||
let mut builder = SyntaxSetBuilder::new();
|
|
||||||
builder.add_plain_text_syntax();
|
|
||||||
builder
|
|
||||||
} else {
|
|
||||||
Self::get_integrated_syntaxset().into_builder()
|
|
||||||
};
|
|
||||||
|
|
||||||
let syntax_dir = source_dir.join("syntaxes");
|
|
||||||
if syntax_dir.exists() {
|
|
||||||
syntax_set_builder.add_from_folder(syntax_dir, true)?;
|
|
||||||
} else {
|
|
||||||
println!(
|
|
||||||
"No syntaxes were found in '{}', using the default set.",
|
|
||||||
syntax_dir.to_string_lossy()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(HighlightingAssets {
|
|
||||||
syntax_set: syntax_set_builder.build(),
|
|
||||||
theme_set,
|
|
||||||
fallback_theme: None,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn from_cache(cache_path: &Path) -> Result<Self> {
|
pub fn from_cache(cache_path: &Path) -> Result<Self> {
|
||||||
let syntax_set_path = cache_path.join("syntaxes.bin");
|
Ok(HighlightingAssets::new(
|
||||||
let theme_set_path = cache_path.join("themes.bin");
|
SerializedSyntaxSet::FromFile(cache_path.join("syntaxes.bin")),
|
||||||
|
asset_from_cache(&cache_path.join("themes.bin"), "theme set", COMPRESS_THEMES)?,
|
||||||
let syntax_set_file = File::open(&syntax_set_path).chain_err(|| {
|
))
|
||||||
format!(
|
|
||||||
"Could not load cached syntax set '{}'",
|
|
||||||
syntax_set_path.to_string_lossy()
|
|
||||||
)
|
|
||||||
})?;
|
|
||||||
let syntax_set: SyntaxSet = from_reader(BufReader::new(syntax_set_file))
|
|
||||||
.chain_err(|| "Could not parse cached syntax set")?;
|
|
||||||
|
|
||||||
let theme_set_file = File::open(&theme_set_path).chain_err(|| {
|
|
||||||
format!(
|
|
||||||
"Could not load cached theme set '{}'",
|
|
||||||
theme_set_path.to_string_lossy()
|
|
||||||
)
|
|
||||||
})?;
|
|
||||||
let theme_set: ThemeSet = from_reader(BufReader::new(theme_set_file))
|
|
||||||
.chain_err(|| "Could not parse cached theme set")?;
|
|
||||||
|
|
||||||
Ok(HighlightingAssets {
|
|
||||||
syntax_set,
|
|
||||||
theme_set,
|
|
||||||
fallback_theme: None,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_integrated_syntaxset() -> SyntaxSet {
|
|
||||||
from_binary(include_bytes!("../assets/syntaxes.bin"))
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_integrated_themeset() -> ThemeSet {
|
|
||||||
from_binary(include_bytes!("../assets/themes.bin"))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_binary() -> Self {
|
pub fn from_binary() -> Self {
|
||||||
let syntax_set = Self::get_integrated_syntaxset();
|
HighlightingAssets::new(
|
||||||
let theme_set = Self::get_integrated_themeset();
|
SerializedSyntaxSet::FromBinary(get_serialized_integrated_syntaxset()),
|
||||||
|
get_integrated_themeset(),
|
||||||
HighlightingAssets {
|
|
||||||
syntax_set,
|
|
||||||
theme_set,
|
|
||||||
fallback_theme: None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn save_to_cache(&self, target_dir: &Path, current_version: &str) -> Result<()> {
|
|
||||||
let _ = fs::create_dir_all(target_dir);
|
|
||||||
let theme_set_path = target_dir.join("themes.bin");
|
|
||||||
let syntax_set_path = target_dir.join("syntaxes.bin");
|
|
||||||
|
|
||||||
print!(
|
|
||||||
"Writing theme set to {} ... ",
|
|
||||||
theme_set_path.to_string_lossy()
|
|
||||||
);
|
|
||||||
dump_to_file(&self.theme_set, &theme_set_path).chain_err(|| {
|
|
||||||
format!(
|
|
||||||
"Could not save theme set to {}",
|
|
||||||
theme_set_path.to_string_lossy()
|
|
||||||
)
|
)
|
||||||
})?;
|
|
||||||
println!("okay");
|
|
||||||
|
|
||||||
print!(
|
|
||||||
"Writing syntax set to {} ... ",
|
|
||||||
syntax_set_path.to_string_lossy()
|
|
||||||
);
|
|
||||||
dump_to_file(&self.syntax_set, &syntax_set_path).chain_err(|| {
|
|
||||||
format!(
|
|
||||||
"Could not save syntax set to {}",
|
|
||||||
syntax_set_path.to_string_lossy()
|
|
||||||
)
|
|
||||||
})?;
|
|
||||||
println!("okay");
|
|
||||||
|
|
||||||
print!(
|
|
||||||
"Writing metadata to folder {} ... ",
|
|
||||||
target_dir.to_string_lossy()
|
|
||||||
);
|
|
||||||
AssetsMetadata::new(current_version).save_to_folder(target_dir)?;
|
|
||||||
println!("okay");
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_fallback_theme(&mut self, theme: &'static str) {
|
pub fn set_fallback_theme(&mut self, theme: &'static str) {
|
||||||
self.fallback_theme = Some(theme);
|
self.fallback_theme = Some(theme);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Return the collection of syntect syntax definitions.
|
||||||
|
pub fn get_syntax_set(&self) -> Result<&SyntaxSet> {
|
||||||
|
self.syntax_set_cell
|
||||||
|
.get_or_try_init(|| self.serialized_syntax_set.deserialize())
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Use [Self::get_syntaxes] instead
|
||||||
|
#[deprecated]
|
||||||
pub fn syntaxes(&self) -> &[SyntaxReference] {
|
pub fn syntaxes(&self) -> &[SyntaxReference] {
|
||||||
self.syntax_set.syntaxes()
|
self.get_syntax_set()
|
||||||
|
.expect(".syntaxes() is deprecated, use .get_syntaxes() instead")
|
||||||
|
.syntaxes()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn get_syntaxes(&self) -> Result<&[SyntaxReference]> {
|
||||||
|
Ok(self.get_syntax_set()?.syntaxes())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_theme_set(&self) -> &LazyThemeSet {
|
||||||
|
&self.theme_set
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn themes(&self) -> impl Iterator<Item = &str> {
|
pub fn themes(&self) -> impl Iterator<Item = &str> {
|
||||||
self.theme_set.themes.keys().map(|s| s.as_ref())
|
self.get_theme_set().themes()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Use [Self::get_syntax_for_path] instead
|
||||||
|
#[deprecated]
|
||||||
pub fn syntax_for_file_name(
|
pub fn syntax_for_file_name(
|
||||||
&self,
|
&self,
|
||||||
file_name: impl AsRef<Path>,
|
file_name: impl AsRef<Path>,
|
||||||
mapping: &SyntaxMapping,
|
mapping: &SyntaxMapping,
|
||||||
) -> Option<&SyntaxReference> {
|
) -> Option<&SyntaxReference> {
|
||||||
let file_name = file_name.as_ref();
|
self.get_syntax_for_path(file_name, mapping)
|
||||||
match mapping.get_syntax_for(file_name) {
|
.ok()
|
||||||
Some(MappingTarget::MapToUnknown) => None,
|
.map(|syntax_in_set| syntax_in_set.syntax)
|
||||||
Some(MappingTarget::MapTo(syntax_name)) => {
|
|
||||||
self.syntax_set.find_syntax_by_name(syntax_name)
|
|
||||||
}
|
}
|
||||||
None => self.get_extension_syntax(file_name.as_os_str()),
|
|
||||||
|
/// Detect the syntax based on, in order:
|
||||||
|
/// 1. Syntax mappings with [MappingTarget::MapTo] and [MappingTarget::MapToUnknown]
|
||||||
|
/// (e.g. `/etc/profile` -> `Bourne Again Shell (bash)`)
|
||||||
|
/// 2. The file name (e.g. `Dockerfile`)
|
||||||
|
/// 3. Syntax mappings with [MappingTarget::MapExtensionToUnknown]
|
||||||
|
/// (e.g. `*.conf`)
|
||||||
|
/// 4. The file name extension (e.g. `.rs`)
|
||||||
|
///
|
||||||
|
/// When detecting syntax based on syntax mappings, the full path is taken
|
||||||
|
/// into account. When detecting syntax based on file name, no regard is
|
||||||
|
/// taken to the path of the file. Only the file name itself matters. When
|
||||||
|
/// detecting syntax based on file name extension, only the file name
|
||||||
|
/// extension itself matters.
|
||||||
|
///
|
||||||
|
/// Returns [Error::UndetectedSyntax] if it was not possible detect syntax
|
||||||
|
/// based on path/file name/extension (or if the path was mapped to
|
||||||
|
/// [MappingTarget::MapToUnknown] or [MappingTarget::MapExtensionToUnknown]).
|
||||||
|
/// In this case it is appropriate to fall back to other methods to detect
|
||||||
|
/// syntax. Such as using the contents of the first line of the file.
|
||||||
|
///
|
||||||
|
/// Returns [Error::UnknownSyntax] if a syntax mapping exist, but the mapped
|
||||||
|
/// syntax does not exist.
|
||||||
|
pub fn get_syntax_for_path(
|
||||||
|
&self,
|
||||||
|
path: impl AsRef<Path>,
|
||||||
|
mapping: &SyntaxMapping,
|
||||||
|
) -> Result<SyntaxReferenceInSet> {
|
||||||
|
let path = path.as_ref();
|
||||||
|
|
||||||
|
let syntax_match = mapping.get_syntax_for(path);
|
||||||
|
|
||||||
|
if let Some(MappingTarget::MapToUnknown) = syntax_match {
|
||||||
|
return Err(Error::UndetectedSyntax(path.to_string_lossy().into()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Some(MappingTarget::MapTo(syntax_name)) = syntax_match {
|
||||||
|
return self
|
||||||
|
.find_syntax_by_name(syntax_name)?
|
||||||
|
.ok_or_else(|| Error::UnknownSyntax(syntax_name.to_owned()));
|
||||||
|
}
|
||||||
|
|
||||||
|
let file_name = path.file_name().unwrap_or_default();
|
||||||
|
|
||||||
|
match (
|
||||||
|
self.get_syntax_for_file_name(file_name, &mapping.ignored_suffixes)?,
|
||||||
|
syntax_match,
|
||||||
|
) {
|
||||||
|
(Some(syntax), _) => Ok(syntax),
|
||||||
|
|
||||||
|
(_, Some(MappingTarget::MapExtensionToUnknown)) => {
|
||||||
|
Err(Error::UndetectedSyntax(path.to_string_lossy().into()))
|
||||||
|
}
|
||||||
|
|
||||||
|
_ => self
|
||||||
|
.get_syntax_for_file_extension(file_name, &mapping.ignored_suffixes)?
|
||||||
|
.ok_or_else(|| Error::UndetectedSyntax(path.to_string_lossy().into())),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn get_theme(&self, theme: &str) -> &Theme {
|
/// Look up a syntect theme by name.
|
||||||
match self.theme_set.themes.get(theme) {
|
pub fn get_theme(&self, theme: &str) -> &Theme {
|
||||||
|
match self.get_theme_set().get(theme) {
|
||||||
Some(theme) => theme,
|
Some(theme) => theme,
|
||||||
None => {
|
None => {
|
||||||
if theme == "ansi-light" || theme == "ansi-dark" {
|
if theme == "ansi-light" || theme == "ansi-dark" {
|
||||||
bat_warning!("Theme '{}' is deprecated, using 'ansi' instead.", theme);
|
bat_warning!("Theme '{}' is deprecated, using 'ansi' instead.", theme);
|
||||||
return self.get_theme("ansi");
|
return self.get_theme("ansi");
|
||||||
}
|
}
|
||||||
if theme != "" {
|
if !theme.is_empty() {
|
||||||
bat_warning!("Unknown theme '{}', using default.", theme)
|
bat_warning!("Unknown theme '{}', using default.", theme)
|
||||||
}
|
}
|
||||||
&self.theme_set.themes[self.fallback_theme.unwrap_or_else(|| Self::default_theme())]
|
self.get_theme_set()
|
||||||
|
.get(self.fallback_theme.unwrap_or_else(Self::default_theme))
|
||||||
|
.expect("something is very wrong if the default theme is missing")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -214,79 +211,144 @@ impl HighlightingAssets {
|
|||||||
language: Option<&str>,
|
language: Option<&str>,
|
||||||
input: &mut OpenedInput,
|
input: &mut OpenedInput,
|
||||||
mapping: &SyntaxMapping,
|
mapping: &SyntaxMapping,
|
||||||
) -> Result<&SyntaxReference> {
|
) -> Result<SyntaxReferenceInSet> {
|
||||||
if let Some(language) = language {
|
if let Some(language) = language {
|
||||||
self.syntax_set
|
let syntax_set = self.get_syntax_set()?;
|
||||||
|
return syntax_set
|
||||||
.find_syntax_by_token(language)
|
.find_syntax_by_token(language)
|
||||||
.ok_or_else(|| ErrorKind::UnknownSyntax(language.to_owned()).into())
|
.map(|syntax| SyntaxReferenceInSet { syntax, syntax_set })
|
||||||
} else {
|
.ok_or_else(|| Error::UnknownSyntax(language.to_owned()));
|
||||||
let line_syntax = self.get_first_line_syntax(&mut input.reader);
|
|
||||||
|
|
||||||
// Get the path of the file:
|
|
||||||
// If this was set by the metadata, that will take priority.
|
|
||||||
// If it wasn't, it will use the real file path (if available).
|
|
||||||
let path_str =
|
|
||||||
input
|
|
||||||
.metadata
|
|
||||||
.user_provided_name
|
|
||||||
.as_ref()
|
|
||||||
.or_else(|| match input.kind {
|
|
||||||
OpenedInputKind::OrdinaryFile(ref path) => Some(path),
|
|
||||||
_ => None,
|
|
||||||
});
|
|
||||||
|
|
||||||
if let Some(path_str) = path_str {
|
|
||||||
// If a path was provided, we try and detect the syntax based on extension mappings.
|
|
||||||
let path = Path::new(path_str);
|
|
||||||
let absolute_path = PathAbs::new(path)
|
|
||||||
.ok()
|
|
||||||
.map(|p| p.as_path().to_path_buf())
|
|
||||||
.unwrap_or_else(|| path.to_owned());
|
|
||||||
|
|
||||||
match mapping.get_syntax_for(absolute_path) {
|
|
||||||
Some(MappingTarget::MapToUnknown) => line_syntax.ok_or_else(|| {
|
|
||||||
ErrorKind::UndetectedSyntax(path.to_string_lossy().into()).into()
|
|
||||||
}),
|
|
||||||
|
|
||||||
Some(MappingTarget::MapTo(syntax_name)) => self
|
|
||||||
.syntax_set
|
|
||||||
.find_syntax_by_name(syntax_name)
|
|
||||||
.ok_or_else(|| ErrorKind::UnknownSyntax(syntax_name.to_owned()).into()),
|
|
||||||
|
|
||||||
None => {
|
|
||||||
let file_name = path.file_name().unwrap_or_default();
|
|
||||||
self.get_extension_syntax(file_name)
|
|
||||||
.or(line_syntax)
|
|
||||||
.ok_or_else(|| {
|
|
||||||
ErrorKind::UndetectedSyntax(path.to_string_lossy().into()).into()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// If a path wasn't provided, we fall back to the detect first-line syntax.
|
|
||||||
line_syntax.ok_or_else(|| ErrorKind::UndetectedSyntax("[unknown]".into()).into())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_extension_syntax(&self, file_name: &OsStr) -> Option<&SyntaxReference> {
|
let path = input.path();
|
||||||
self.syntax_set
|
let path_syntax = if let Some(path) = path {
|
||||||
.find_syntax_by_extension(file_name.to_str().unwrap_or_default())
|
self.get_syntax_for_path(
|
||||||
.or_else(|| {
|
PathAbs::new(path).map_or_else(|_| path.to_owned(), |p| p.as_path().to_path_buf()),
|
||||||
self.syntax_set.find_syntax_by_extension(
|
mapping,
|
||||||
Path::new(file_name)
|
|
||||||
.extension()
|
|
||||||
.and_then(|x| x.to_str())
|
|
||||||
.unwrap_or_default(),
|
|
||||||
)
|
)
|
||||||
})
|
} else {
|
||||||
|
Err(Error::UndetectedSyntax("[unknown]".into()))
|
||||||
|
};
|
||||||
|
|
||||||
|
match path_syntax {
|
||||||
|
// If a path wasn't provided, or if path based syntax detection
|
||||||
|
// above failed, we fall back to first-line syntax detection.
|
||||||
|
Err(Error::UndetectedSyntax(path)) => self
|
||||||
|
.get_first_line_syntax(&mut input.reader)?
|
||||||
|
.ok_or(Error::UndetectedSyntax(path)),
|
||||||
|
_ => path_syntax,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_first_line_syntax(&self, reader: &mut InputReader) -> Option<&SyntaxReference> {
|
pub(crate) fn find_syntax_by_name(
|
||||||
String::from_utf8(reader.first_line.clone())
|
&self,
|
||||||
.ok()
|
syntax_name: &str,
|
||||||
.and_then(|l| self.syntax_set.find_syntax_by_first_line(&l))
|
) -> Result<Option<SyntaxReferenceInSet>> {
|
||||||
|
let syntax_set = self.get_syntax_set()?;
|
||||||
|
Ok(syntax_set
|
||||||
|
.find_syntax_by_name(syntax_name)
|
||||||
|
.map(|syntax| SyntaxReferenceInSet { syntax, syntax_set }))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn find_syntax_by_extension(&self, e: Option<&OsStr>) -> Result<Option<SyntaxReferenceInSet>> {
|
||||||
|
let syntax_set = self.get_syntax_set()?;
|
||||||
|
let extension = e.and_then(|x| x.to_str()).unwrap_or_default();
|
||||||
|
Ok(syntax_set
|
||||||
|
.find_syntax_by_extension(extension)
|
||||||
|
.map(|syntax| SyntaxReferenceInSet { syntax, syntax_set }))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_syntax_for_file_name(
|
||||||
|
&self,
|
||||||
|
file_name: &OsStr,
|
||||||
|
ignored_suffixes: &IgnoredSuffixes,
|
||||||
|
) -> Result<Option<SyntaxReferenceInSet>> {
|
||||||
|
let mut syntax = self.find_syntax_by_extension(Some(file_name))?;
|
||||||
|
if syntax.is_none() {
|
||||||
|
syntax =
|
||||||
|
ignored_suffixes.try_with_stripped_suffix(file_name, |stripped_file_name| {
|
||||||
|
// Note: recursion
|
||||||
|
self.get_syntax_for_file_name(stripped_file_name, ignored_suffixes)
|
||||||
|
})?;
|
||||||
|
}
|
||||||
|
Ok(syntax)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_syntax_for_file_extension(
|
||||||
|
&self,
|
||||||
|
file_name: &OsStr,
|
||||||
|
ignored_suffixes: &IgnoredSuffixes,
|
||||||
|
) -> Result<Option<SyntaxReferenceInSet>> {
|
||||||
|
let mut syntax = self.find_syntax_by_extension(Path::new(file_name).extension())?;
|
||||||
|
if syntax.is_none() {
|
||||||
|
syntax =
|
||||||
|
ignored_suffixes.try_with_stripped_suffix(file_name, |stripped_file_name| {
|
||||||
|
// Note: recursion
|
||||||
|
self.get_syntax_for_file_extension(stripped_file_name, ignored_suffixes)
|
||||||
|
})?;
|
||||||
|
}
|
||||||
|
Ok(syntax)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_first_line_syntax(
|
||||||
|
&self,
|
||||||
|
reader: &mut InputReader,
|
||||||
|
) -> Result<Option<SyntaxReferenceInSet>> {
|
||||||
|
let syntax_set = self.get_syntax_set()?;
|
||||||
|
Ok(String::from_utf8(reader.first_line.clone())
|
||||||
|
.ok()
|
||||||
|
.and_then(|l| syntax_set.find_syntax_by_first_line(&l))
|
||||||
|
.map(|syntax| SyntaxReferenceInSet { syntax, syntax_set }))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn get_serialized_integrated_syntaxset() -> &'static [u8] {
|
||||||
|
include_bytes!("../assets/syntaxes.bin")
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn get_integrated_themeset() -> LazyThemeSet {
|
||||||
|
from_binary(include_bytes!("../assets/themes.bin"), COMPRESS_THEMES)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn get_acknowledgements() -> String {
|
||||||
|
from_binary(
|
||||||
|
include_bytes!("../assets/acknowledgements.bin"),
|
||||||
|
COMPRESS_ACKNOWLEDGEMENTS,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn from_binary<T: serde::de::DeserializeOwned>(v: &[u8], compressed: bool) -> T {
|
||||||
|
asset_from_contents(v, "n/a", compressed)
|
||||||
|
.expect("data integrated in binary is never faulty, but make sure `compressed` is in sync!")
|
||||||
|
}
|
||||||
|
|
||||||
|
fn asset_from_contents<T: serde::de::DeserializeOwned>(
|
||||||
|
contents: &[u8],
|
||||||
|
description: &str,
|
||||||
|
compressed: bool,
|
||||||
|
) -> Result<T> {
|
||||||
|
if compressed {
|
||||||
|
bincode::deserialize_from(flate2::read::ZlibDecoder::new(contents))
|
||||||
|
} else {
|
||||||
|
bincode::deserialize_from(contents)
|
||||||
|
}
|
||||||
|
.map_err(|_| format!("Could not parse {}", description).into())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn asset_from_cache<T: serde::de::DeserializeOwned>(
|
||||||
|
path: &Path,
|
||||||
|
description: &str,
|
||||||
|
compressed: bool,
|
||||||
|
) -> Result<T> {
|
||||||
|
let contents = fs::read(path).map_err(|_| {
|
||||||
|
format!(
|
||||||
|
"Could not load cached {} '{}'",
|
||||||
|
description,
|
||||||
|
path.to_string_lossy()
|
||||||
|
)
|
||||||
|
})?;
|
||||||
|
asset_from_contents(&contents[..], description, compressed)
|
||||||
|
.map_err(|_| format!("Could not parse cached {}", description).into())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@@ -296,7 +358,7 @@ mod tests {
|
|||||||
use std::ffi::OsStr;
|
use std::ffi::OsStr;
|
||||||
|
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::Write;
|
use std::io::{BufReader, Write};
|
||||||
use tempfile::TempDir;
|
use tempfile::TempDir;
|
||||||
|
|
||||||
use crate::input::Input;
|
use crate::input::Input;
|
||||||
@@ -316,6 +378,18 @@ mod tests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn get_syntax_name(
|
||||||
|
&self,
|
||||||
|
language: Option<&str>,
|
||||||
|
input: &mut OpenedInput,
|
||||||
|
mapping: &SyntaxMapping,
|
||||||
|
) -> String {
|
||||||
|
self.assets
|
||||||
|
.get_syntax(language, input, mapping)
|
||||||
|
.map(|syntax_in_set| syntax_in_set.syntax.name.clone())
|
||||||
|
.unwrap_or_else(|_| "!no syntax!".to_owned())
|
||||||
|
}
|
||||||
|
|
||||||
fn syntax_for_real_file_with_content_os(
|
fn syntax_for_real_file_with_content_os(
|
||||||
&self,
|
&self,
|
||||||
file_name: &OsStr,
|
file_name: &OsStr,
|
||||||
@@ -327,29 +401,21 @@ mod tests {
|
|||||||
writeln!(temp_file, "{}", first_line).unwrap();
|
writeln!(temp_file, "{}", first_line).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
let input = Input::ordinary_file(file_path.as_os_str());
|
let input = Input::ordinary_file(&file_path);
|
||||||
let dummy_stdin: &[u8] = &[];
|
let dummy_stdin: &[u8] = &[];
|
||||||
let mut opened_input = input.open(dummy_stdin, None).unwrap();
|
let mut opened_input = input.open(dummy_stdin, None).unwrap();
|
||||||
|
|
||||||
self.assets
|
self.get_syntax_name(None, &mut opened_input, &self.syntax_mapping)
|
||||||
.get_syntax(None, &mut opened_input, &self.syntax_mapping)
|
|
||||||
.unwrap_or_else(|_| self.assets.syntax_set.find_syntax_plain_text())
|
|
||||||
.name
|
|
||||||
.clone()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn syntax_for_file_with_content_os(&self, file_name: &OsStr, first_line: &str) -> String {
|
fn syntax_for_file_with_content_os(&self, file_name: &OsStr, first_line: &str) -> String {
|
||||||
let file_path = self.temp_dir.path().join(file_name);
|
let file_path = self.temp_dir.path().join(file_name);
|
||||||
let input = Input::from_reader(Box::new(BufReader::new(first_line.as_bytes())))
|
let input = Input::from_reader(Box::new(BufReader::new(first_line.as_bytes())))
|
||||||
.with_name(Some(file_path.as_os_str()));
|
.with_name(Some(&file_path));
|
||||||
let dummy_stdin: &[u8] = &[];
|
let dummy_stdin: &[u8] = &[];
|
||||||
let mut opened_input = input.open(dummy_stdin, None).unwrap();
|
let mut opened_input = input.open(dummy_stdin, None).unwrap();
|
||||||
|
|
||||||
self.assets
|
self.get_syntax_name(None, &mut opened_input, &self.syntax_mapping)
|
||||||
.get_syntax(None, &mut opened_input, &self.syntax_mapping)
|
|
||||||
.unwrap_or_else(|_| self.assets.syntax_set.find_syntax_plain_text())
|
|
||||||
.name
|
|
||||||
.clone()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
@@ -366,14 +432,10 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn syntax_for_stdin_with_content(&self, file_name: &str, content: &[u8]) -> String {
|
fn syntax_for_stdin_with_content(&self, file_name: &str, content: &[u8]) -> String {
|
||||||
let input = Input::stdin().with_name(Some(OsStr::new(file_name)));
|
let input = Input::stdin().with_name(Some(file_name));
|
||||||
let mut opened_input = input.open(content, None).unwrap();
|
let mut opened_input = input.open(content, None).unwrap();
|
||||||
|
|
||||||
self.assets
|
self.get_syntax_name(None, &mut opened_input, &self.syntax_mapping)
|
||||||
.get_syntax(None, &mut opened_input, &self.syntax_mapping)
|
|
||||||
.unwrap_or_else(|_| self.assets.syntax_set.find_syntax_plain_text())
|
|
||||||
.name
|
|
||||||
.clone()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn syntax_is_same_for_inputkinds(&self, file_name: &str, content: &str) -> bool {
|
fn syntax_is_same_for_inputkinds(&self, file_name: &str, content: &str) -> bool {
|
||||||
@@ -450,6 +512,7 @@ mod tests {
|
|||||||
assert_eq!(test.syntax_for_file("test.sass"), "Sass");
|
assert_eq!(test.syntax_for_file("test.sass"), "Sass");
|
||||||
assert_eq!(test.syntax_for_file("test.js"), "JavaScript (Babel)");
|
assert_eq!(test.syntax_for_file("test.js"), "JavaScript (Babel)");
|
||||||
assert_eq!(test.syntax_for_file("test.fs"), "F#");
|
assert_eq!(test.syntax_for_file("test.fs"), "F#");
|
||||||
|
assert_eq!(test.syntax_for_file("test.v"), "Verilog");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -481,6 +544,42 @@ mod tests {
|
|||||||
assert_eq!(test.syntax_for_file("test.h"), "C");
|
assert_eq!(test.syntax_for_file("test.h"), "C");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn syntax_detection_with_extension_mapping_to_unknown() {
|
||||||
|
let mut test = SyntaxDetectionTest::new();
|
||||||
|
|
||||||
|
// Normally, a CMakeLists.txt file shall use the CMake syntax, even if it is
|
||||||
|
// a bash script in disguise
|
||||||
|
assert_eq!(
|
||||||
|
test.syntax_for_file_with_content("CMakeLists.txt", "#!/bin/bash"),
|
||||||
|
"CMake"
|
||||||
|
);
|
||||||
|
|
||||||
|
// Other .txt files shall use the Plain Text syntax
|
||||||
|
assert_eq!(
|
||||||
|
test.syntax_for_file_with_content("some-other.txt", "#!/bin/bash"),
|
||||||
|
"Plain Text"
|
||||||
|
);
|
||||||
|
|
||||||
|
// If we setup MapExtensionToUnknown on *.txt, the match on the full
|
||||||
|
// file name of "CMakeLists.txt" shall have higher prio, and CMake shall
|
||||||
|
// still be used for it
|
||||||
|
test.syntax_mapping
|
||||||
|
.insert("*.txt", MappingTarget::MapExtensionToUnknown)
|
||||||
|
.ok();
|
||||||
|
assert_eq!(
|
||||||
|
test.syntax_for_file_with_content("CMakeLists.txt", "#!/bin/bash"),
|
||||||
|
"CMake"
|
||||||
|
);
|
||||||
|
|
||||||
|
// However, for *other* files with a .txt extension, first-line fallback
|
||||||
|
// shall now be used
|
||||||
|
assert_eq!(
|
||||||
|
test.syntax_for_file_with_content("some-other.txt", "#!/bin/bash"),
|
||||||
|
"Bourne Again Shell (bash)"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn syntax_detection_is_case_sensitive() {
|
fn syntax_detection_is_case_sensitive() {
|
||||||
let mut test = SyntaxDetectionTest::new();
|
let mut test = SyntaxDetectionTest::new();
|
||||||
@@ -521,15 +620,12 @@ mod tests {
|
|||||||
.expect("creation of directory succeeds");
|
.expect("creation of directory succeeds");
|
||||||
symlink(&file_path, &file_path_symlink).expect("creation of symbolic link succeeds");
|
symlink(&file_path, &file_path_symlink).expect("creation of symbolic link succeeds");
|
||||||
|
|
||||||
let input = Input::ordinary_file(file_path_symlink.as_os_str());
|
let input = Input::ordinary_file(&file_path_symlink);
|
||||||
let dummy_stdin: &[u8] = &[];
|
let dummy_stdin: &[u8] = &[];
|
||||||
let mut opened_input = input.open(dummy_stdin, None).unwrap();
|
let mut opened_input = input.open(dummy_stdin, None).unwrap();
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
test.assets
|
test.get_syntax_name(None, &mut opened_input, &test.syntax_mapping),
|
||||||
.get_syntax(None, &mut opened_input, &test.syntax_mapping)
|
|
||||||
.unwrap_or_else(|_| test.assets.syntax_set.find_syntax_plain_text())
|
|
||||||
.name,
|
|
||||||
"SSH Config"
|
"SSH Config"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -16,6 +16,7 @@ pub struct AssetsMetadata {
|
|||||||
const FILENAME: &str = "metadata.yaml";
|
const FILENAME: &str = "metadata.yaml";
|
||||||
|
|
||||||
impl AssetsMetadata {
|
impl AssetsMetadata {
|
||||||
|
#[cfg(feature = "build-assets")]
|
||||||
pub(crate) fn new(current_version: &str) -> AssetsMetadata {
|
pub(crate) fn new(current_version: &str) -> AssetsMetadata {
|
||||||
AssetsMetadata {
|
AssetsMetadata {
|
||||||
bat_version: Some(current_version.to_owned()),
|
bat_version: Some(current_version.to_owned()),
|
||||||
@@ -23,6 +24,7 @@ impl AssetsMetadata {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "build-assets")]
|
||||||
pub(crate) fn save_to_folder(&self, path: &Path) -> Result<()> {
|
pub(crate) fn save_to_folder(&self, path: &Path) -> Result<()> {
|
||||||
let file = File::create(path.join(FILENAME))?;
|
let file = File::create(path.join(FILENAME))?;
|
||||||
serde_yaml::to_writer(file, self)?;
|
serde_yaml::to_writer(file, self)?;
|
||||||
@@ -50,16 +52,15 @@ impl AssetsMetadata {
|
|||||||
pub fn load_from_folder(path: &Path) -> Result<Option<Self>> {
|
pub fn load_from_folder(path: &Path) -> Result<Option<Self>> {
|
||||||
match Self::try_load_from_folder(path) {
|
match Self::try_load_from_folder(path) {
|
||||||
Ok(metadata) => Ok(Some(metadata)),
|
Ok(metadata) => Ok(Some(metadata)),
|
||||||
Err(e) => match e.kind() {
|
Err(e) => {
|
||||||
ErrorKind::SerdeYamlError(_) => Err(e),
|
if let Error::SerdeYamlError(_) = e {
|
||||||
_ => {
|
Err(e)
|
||||||
if path.join("syntaxes.bin").exists() || path.join("themes.bin").exists() {
|
} else if path.join("syntaxes.bin").exists() || path.join("themes.bin").exists() {
|
||||||
Ok(Some(Self::default()))
|
Ok(Some(Self::default()))
|
||||||
} else {
|
} else {
|
||||||
Ok(None)
|
Ok(None)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
176
src/assets/build_assets.rs
Normal file
176
src/assets/build_assets.rs
Normal file
@@ -0,0 +1,176 @@
|
|||||||
|
use std::convert::TryInto;
|
||||||
|
use std::path::Path;
|
||||||
|
|
||||||
|
use syntect::highlighting::ThemeSet;
|
||||||
|
use syntect::parsing::{SyntaxSet, SyntaxSetBuilder};
|
||||||
|
|
||||||
|
use crate::assets::*;
|
||||||
|
use acknowledgements::build_acknowledgements;
|
||||||
|
|
||||||
|
mod acknowledgements;
|
||||||
|
|
||||||
|
pub fn build(
|
||||||
|
source_dir: &Path,
|
||||||
|
include_integrated_assets: bool,
|
||||||
|
include_acknowledgements: bool,
|
||||||
|
target_dir: &Path,
|
||||||
|
current_version: &str,
|
||||||
|
) -> Result<()> {
|
||||||
|
let theme_set = build_theme_set(source_dir, include_integrated_assets)?;
|
||||||
|
|
||||||
|
let syntax_set_builder = build_syntax_set_builder(source_dir, include_integrated_assets)?;
|
||||||
|
|
||||||
|
let syntax_set = syntax_set_builder.build();
|
||||||
|
|
||||||
|
let acknowledgements = build_acknowledgements(source_dir, include_acknowledgements)?;
|
||||||
|
|
||||||
|
print_unlinked_contexts(&syntax_set);
|
||||||
|
|
||||||
|
write_assets(
|
||||||
|
&theme_set,
|
||||||
|
&syntax_set,
|
||||||
|
&acknowledgements,
|
||||||
|
target_dir,
|
||||||
|
current_version,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn build_theme_set(source_dir: &Path, include_integrated_assets: bool) -> Result<LazyThemeSet> {
|
||||||
|
let mut theme_set = if include_integrated_assets {
|
||||||
|
crate::assets::get_integrated_themeset().try_into()?
|
||||||
|
} else {
|
||||||
|
ThemeSet::new()
|
||||||
|
};
|
||||||
|
|
||||||
|
let theme_dir = source_dir.join("themes");
|
||||||
|
if theme_dir.exists() {
|
||||||
|
let res = theme_set.add_from_folder(&theme_dir);
|
||||||
|
if let Err(err) = res {
|
||||||
|
println!(
|
||||||
|
"Failed to load one or more themes from '{}' (reason: '{}')",
|
||||||
|
theme_dir.to_string_lossy(),
|
||||||
|
err,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
println!(
|
||||||
|
"No themes were found in '{}', using the default set",
|
||||||
|
theme_dir.to_string_lossy()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
theme_set.try_into()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn build_syntax_set_builder(
|
||||||
|
source_dir: &Path,
|
||||||
|
include_integrated_assets: bool,
|
||||||
|
) -> Result<SyntaxSetBuilder> {
|
||||||
|
let mut syntax_set_builder = if !include_integrated_assets {
|
||||||
|
let mut builder = syntect::parsing::SyntaxSetBuilder::new();
|
||||||
|
builder.add_plain_text_syntax();
|
||||||
|
builder
|
||||||
|
} else {
|
||||||
|
from_binary::<SyntaxSet>(get_serialized_integrated_syntaxset(), COMPRESS_SYNTAXES)
|
||||||
|
.into_builder()
|
||||||
|
};
|
||||||
|
|
||||||
|
let syntax_dir = source_dir.join("syntaxes");
|
||||||
|
if syntax_dir.exists() {
|
||||||
|
syntax_set_builder.add_from_folder(syntax_dir, true)?;
|
||||||
|
} else {
|
||||||
|
println!(
|
||||||
|
"No syntaxes were found in '{}', using the default set.",
|
||||||
|
syntax_dir.to_string_lossy()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(syntax_set_builder)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn print_unlinked_contexts(syntax_set: &SyntaxSet) {
|
||||||
|
let missing_contexts = syntax_set.find_unlinked_contexts();
|
||||||
|
if !missing_contexts.is_empty() {
|
||||||
|
println!("Some referenced contexts could not be found!");
|
||||||
|
for context in missing_contexts {
|
||||||
|
println!("- {}", context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn write_assets(
|
||||||
|
theme_set: &LazyThemeSet,
|
||||||
|
syntax_set: &SyntaxSet,
|
||||||
|
acknowledgements: &Option<String>,
|
||||||
|
target_dir: &Path,
|
||||||
|
current_version: &str,
|
||||||
|
) -> Result<()> {
|
||||||
|
let _ = std::fs::create_dir_all(target_dir);
|
||||||
|
asset_to_cache(
|
||||||
|
theme_set,
|
||||||
|
&target_dir.join("themes.bin"),
|
||||||
|
"theme set",
|
||||||
|
COMPRESS_THEMES,
|
||||||
|
)?;
|
||||||
|
asset_to_cache(
|
||||||
|
syntax_set,
|
||||||
|
&target_dir.join("syntaxes.bin"),
|
||||||
|
"syntax set",
|
||||||
|
COMPRESS_SYNTAXES,
|
||||||
|
)?;
|
||||||
|
|
||||||
|
if let Some(acknowledgements) = acknowledgements {
|
||||||
|
asset_to_cache(
|
||||||
|
acknowledgements,
|
||||||
|
&target_dir.join("acknowledgements.bin"),
|
||||||
|
"acknowledgements",
|
||||||
|
COMPRESS_ACKNOWLEDGEMENTS,
|
||||||
|
)?;
|
||||||
|
}
|
||||||
|
|
||||||
|
print!(
|
||||||
|
"Writing metadata to folder {} ... ",
|
||||||
|
target_dir.to_string_lossy()
|
||||||
|
);
|
||||||
|
crate::assets_metadata::AssetsMetadata::new(current_version).save_to_folder(target_dir)?;
|
||||||
|
println!("okay");
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn asset_to_contents<T: serde::Serialize>(
|
||||||
|
asset: &T,
|
||||||
|
description: &str,
|
||||||
|
compressed: bool,
|
||||||
|
) -> Result<Vec<u8>> {
|
||||||
|
let mut contents = vec![];
|
||||||
|
if compressed {
|
||||||
|
bincode::serialize_into(
|
||||||
|
flate2::write::ZlibEncoder::new(&mut contents, flate2::Compression::best()),
|
||||||
|
asset,
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
bincode::serialize_into(&mut contents, asset)
|
||||||
|
}
|
||||||
|
.map_err(|_| format!("Could not serialize {}", description))?;
|
||||||
|
Ok(contents)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn asset_to_cache<T: serde::Serialize>(
|
||||||
|
asset: &T,
|
||||||
|
path: &Path,
|
||||||
|
description: &str,
|
||||||
|
compressed: bool,
|
||||||
|
) -> Result<()> {
|
||||||
|
print!("Writing {} to {} ... ", description, path.to_string_lossy());
|
||||||
|
let contents = asset_to_contents(asset, description, compressed)?;
|
||||||
|
std::fs::write(path, &contents[..]).map_err(|_| {
|
||||||
|
format!(
|
||||||
|
"Could not save {} to {}",
|
||||||
|
description,
|
||||||
|
path.to_string_lossy()
|
||||||
|
)
|
||||||
|
})?;
|
||||||
|
println!("okay");
|
||||||
|
Ok(())
|
||||||
|
}
|
222
src/assets/build_assets/acknowledgements.rs
Normal file
222
src/assets/build_assets/acknowledgements.rs
Normal file
@@ -0,0 +1,222 @@
|
|||||||
|
use std::fs::read_to_string;
|
||||||
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
|
use walkdir::DirEntry;
|
||||||
|
|
||||||
|
use crate::error::*;
|
||||||
|
|
||||||
|
struct PathAndStem {
|
||||||
|
path: PathBuf,
|
||||||
|
stem: String,
|
||||||
|
relative_path: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Looks for LICENSE and NOTICE files in `source_dir`, does some rudimentary
|
||||||
|
/// analysis, and compiles them together in a single string that is meant to be
|
||||||
|
/// used in the output to `--acknowledgements`
|
||||||
|
pub fn build_acknowledgements(
|
||||||
|
source_dir: &Path,
|
||||||
|
include_acknowledgements: bool,
|
||||||
|
) -> Result<Option<String>> {
|
||||||
|
if !include_acknowledgements {
|
||||||
|
return Ok(None);
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut acknowledgements = format!("{}\n\n", include_str!("../../../NOTICE"));
|
||||||
|
|
||||||
|
// Sort entries so the order is stable over time
|
||||||
|
let entries = walkdir::WalkDir::new(source_dir).sort_by(|a, b| a.path().cmp(b.path()));
|
||||||
|
for path_and_stem in entries
|
||||||
|
.into_iter()
|
||||||
|
.flatten()
|
||||||
|
.flat_map(|entry| to_path_and_stem(source_dir, entry))
|
||||||
|
{
|
||||||
|
if let Some(license_text) = handle_file(&path_and_stem)? {
|
||||||
|
append_to_acknowledgements(
|
||||||
|
&mut acknowledgements,
|
||||||
|
&path_and_stem.relative_path,
|
||||||
|
&license_text,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(Some(acknowledgements))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn to_path_and_stem(source_dir: &Path, entry: DirEntry) -> Option<PathAndStem> {
|
||||||
|
let path = entry.path();
|
||||||
|
|
||||||
|
Some(PathAndStem {
|
||||||
|
path: path.to_owned(),
|
||||||
|
stem: path.file_stem().map(|s| s.to_string_lossy().to_string())?,
|
||||||
|
relative_path: path
|
||||||
|
.strip_prefix(source_dir)
|
||||||
|
.map(|p| p.to_string_lossy().to_string())
|
||||||
|
.ok()?,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fn handle_file(path_and_stem: &PathAndStem) -> Result<Option<String>> {
|
||||||
|
if path_and_stem.stem == "NOTICE" {
|
||||||
|
handle_notice(&path_and_stem.path)
|
||||||
|
} else if path_and_stem.stem.to_ascii_uppercase() == "LICENSE" {
|
||||||
|
handle_license(&path_and_stem.path)
|
||||||
|
} else {
|
||||||
|
Ok(None)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn handle_notice(path: &Path) -> Result<Option<String>> {
|
||||||
|
// Assume NOTICE as defined by Apache License 2.0. These must be part of acknowledgements.
|
||||||
|
Ok(Some(read_to_string(path)?))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn handle_license(path: &Path) -> Result<Option<String>> {
|
||||||
|
let license_text = read_to_string(path)?;
|
||||||
|
|
||||||
|
if include_license_in_acknowledgments(&license_text) {
|
||||||
|
Ok(Some(license_text))
|
||||||
|
} else if license_not_needed_in_acknowledgements(&license_text) {
|
||||||
|
Ok(None)
|
||||||
|
} else {
|
||||||
|
Err(format!("ERROR: License is of unknown type: {:?}", path).into())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn include_license_in_acknowledgments(license_text: &str) -> bool {
|
||||||
|
let markers = vec![
|
||||||
|
// MIT
|
||||||
|
"The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.",
|
||||||
|
|
||||||
|
// BSD
|
||||||
|
"Redistributions in binary form must reproduce the above copyright notice,",
|
||||||
|
|
||||||
|
// Apache 2.0
|
||||||
|
"Apache License Version 2.0, January 2004 http://www.apache.org/licenses/",
|
||||||
|
"Licensed under the Apache License, Version 2.0 (the \"License\");",
|
||||||
|
];
|
||||||
|
|
||||||
|
license_contains_marker(license_text, &markers)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn license_not_needed_in_acknowledgements(license_text: &str) -> bool {
|
||||||
|
let markers = vec![
|
||||||
|
// Public domain
|
||||||
|
"This is free and unencumbered software released into the public domain.",
|
||||||
|
|
||||||
|
// Public domain with stronger wording than above
|
||||||
|
"DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE",
|
||||||
|
|
||||||
|
// Special license of assets/syntaxes/01_Packages/LICENSE
|
||||||
|
"Permission to copy, use, modify, sell and distribute this software is granted. This software is provided \"as is\" without express or implied warranty, and with no claim as to its suitability for any purpose."
|
||||||
|
];
|
||||||
|
|
||||||
|
license_contains_marker(license_text, &markers)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn license_contains_marker(license_text: &str, markers: &[&str]) -> bool {
|
||||||
|
let normalized_license_text = normalize_license_text(license_text);
|
||||||
|
markers.iter().any(|m| normalized_license_text.contains(m))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn append_to_acknowledgements(
|
||||||
|
acknowledgements: &mut String,
|
||||||
|
relative_path: &str,
|
||||||
|
license_text: &str,
|
||||||
|
) {
|
||||||
|
acknowledgements.push_str(&format!("## {}\n\n{}", relative_path, license_text));
|
||||||
|
|
||||||
|
// Make sure the last char is a newline to not mess up formatting later
|
||||||
|
if acknowledgements
|
||||||
|
.chars()
|
||||||
|
.last()
|
||||||
|
.expect("acknowledgements is not the empty string")
|
||||||
|
!= '\n'
|
||||||
|
{
|
||||||
|
acknowledgements.push('\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add two more newlines to make it easy to distinguish where this text ends
|
||||||
|
// and the next starts
|
||||||
|
acknowledgements.push_str("\n\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Replaces newlines with a space character, and replaces multiple spaces with one space.
|
||||||
|
/// This makes the text easier to analyze.
|
||||||
|
fn normalize_license_text(license_text: &str) -> String {
|
||||||
|
use regex::Regex;
|
||||||
|
|
||||||
|
let whitespace_and_newlines = Regex::new(r"\s").unwrap();
|
||||||
|
let as_single_line = whitespace_and_newlines.replace_all(license_text, " ");
|
||||||
|
|
||||||
|
let many_spaces = Regex::new(" +").unwrap();
|
||||||
|
many_spaces.replace_all(&as_single_line, " ").to_string()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
#[cfg(test)]
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_normalize_license_text() {
|
||||||
|
let license_text = "This is a license text with these terms:
|
||||||
|
* Complicated multi-line
|
||||||
|
term with indentation";
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
"This is a license text with these terms: * Complicated multi-line term with indentation".to_owned(),
|
||||||
|
normalize_license_text(license_text),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_normalize_license_text_with_windows_line_endings() {
|
||||||
|
let license_text = "This license text includes windows line endings\r
|
||||||
|
and we need to handle that.";
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
"This license text includes windows line endings and we need to handle that."
|
||||||
|
.to_owned(),
|
||||||
|
normalize_license_text(license_text),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_append_to_acknowledgements_adds_newline_if_missing() {
|
||||||
|
let mut acknowledgements = "preamble\n\n\n".to_owned();
|
||||||
|
|
||||||
|
append_to_acknowledgements(&mut acknowledgements, "some/path", "line without newline");
|
||||||
|
assert_eq!(
|
||||||
|
"preamble
|
||||||
|
|
||||||
|
|
||||||
|
## some/path
|
||||||
|
|
||||||
|
line without newline
|
||||||
|
|
||||||
|
|
||||||
|
",
|
||||||
|
acknowledgements
|
||||||
|
);
|
||||||
|
|
||||||
|
append_to_acknowledgements(&mut acknowledgements, "another/path", "line with newline\n");
|
||||||
|
assert_eq!(
|
||||||
|
"preamble
|
||||||
|
|
||||||
|
|
||||||
|
## some/path
|
||||||
|
|
||||||
|
line without newline
|
||||||
|
|
||||||
|
|
||||||
|
## another/path
|
||||||
|
|
||||||
|
line with newline
|
||||||
|
|
||||||
|
|
||||||
|
",
|
||||||
|
acknowledgements
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
104
src/assets/lazy_theme_set.rs
Normal file
104
src/assets/lazy_theme_set.rs
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
use super::*;
|
||||||
|
|
||||||
|
use std::collections::BTreeMap;
|
||||||
|
use std::convert::TryFrom;
|
||||||
|
|
||||||
|
use serde::Deserialize;
|
||||||
|
use serde::Serialize;
|
||||||
|
|
||||||
|
use once_cell::unsync::OnceCell;
|
||||||
|
|
||||||
|
use syntect::highlighting::{Theme, ThemeSet};
|
||||||
|
|
||||||
|
/// Same structure as a [`syntect::highlighting::ThemeSet`] but with themes
|
||||||
|
/// stored in raw serialized form, and deserialized on demand.
|
||||||
|
#[derive(Debug, Default, Serialize, Deserialize)]
|
||||||
|
pub struct LazyThemeSet {
|
||||||
|
/// This is a [`BTreeMap`] because that's what [`syntect::highlighting::ThemeSet`] uses
|
||||||
|
themes: BTreeMap<String, LazyTheme>,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Stores raw serialized data for a theme with methods to lazily deserialize
|
||||||
|
/// (load) the theme.
|
||||||
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
|
struct LazyTheme {
|
||||||
|
serialized: Vec<u8>,
|
||||||
|
|
||||||
|
#[serde(skip, default = "OnceCell::new")]
|
||||||
|
deserialized: OnceCell<syntect::highlighting::Theme>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl LazyThemeSet {
|
||||||
|
/// Lazily load the given theme
|
||||||
|
pub fn get(&self, name: &str) -> Option<&Theme> {
|
||||||
|
self.themes.get(name).and_then(|lazy_theme| {
|
||||||
|
lazy_theme
|
||||||
|
.deserialized
|
||||||
|
.get_or_try_init(|| lazy_theme.deserialize())
|
||||||
|
.ok()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns the name of all themes.
|
||||||
|
pub fn themes(&self) -> impl Iterator<Item = &str> {
|
||||||
|
self.themes.keys().map(|name| name.as_ref())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl LazyTheme {
|
||||||
|
fn deserialize(&self) -> Result<Theme> {
|
||||||
|
asset_from_contents(
|
||||||
|
&self.serialized[..],
|
||||||
|
"lazy-loaded theme",
|
||||||
|
COMPRESS_LAZY_THEMES,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl TryFrom<LazyThemeSet> for ThemeSet {
|
||||||
|
type Error = Error;
|
||||||
|
|
||||||
|
/// Since the user might want to add custom themes to bat, we need a way to
|
||||||
|
/// convert from a `LazyThemeSet` to a regular [`ThemeSet`] so that more
|
||||||
|
/// themes can be added. This function does that pretty straight-forward
|
||||||
|
/// conversion.
|
||||||
|
fn try_from(lazy_theme_set: LazyThemeSet) -> Result<Self> {
|
||||||
|
let mut theme_set = ThemeSet::default();
|
||||||
|
|
||||||
|
for (name, lazy_theme) in lazy_theme_set.themes {
|
||||||
|
theme_set.themes.insert(name, lazy_theme.deserialize()?);
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(theme_set)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "build-assets")]
|
||||||
|
impl TryFrom<ThemeSet> for LazyThemeSet {
|
||||||
|
type Error = Error;
|
||||||
|
|
||||||
|
/// To collect themes, a [`ThemeSet`] is needed. Once all desired themes
|
||||||
|
/// have been added, we need a way to convert that into [`LazyThemeSet`] so
|
||||||
|
/// that themes can be lazy-loaded later. This function does that
|
||||||
|
/// conversion.
|
||||||
|
fn try_from(theme_set: ThemeSet) -> Result<Self> {
|
||||||
|
let mut lazy_theme_set = LazyThemeSet::default();
|
||||||
|
|
||||||
|
for (name, theme) in theme_set.themes {
|
||||||
|
// All we have to do is to serialize the theme
|
||||||
|
let lazy_theme = LazyTheme {
|
||||||
|
serialized: crate::assets::build_assets::asset_to_contents(
|
||||||
|
&theme,
|
||||||
|
&format!("theme {}", name),
|
||||||
|
COMPRESS_LAZY_THEMES,
|
||||||
|
)?,
|
||||||
|
deserialized: OnceCell::new(),
|
||||||
|
};
|
||||||
|
|
||||||
|
// Ok done, now we can add it
|
||||||
|
lazy_theme_set.themes.insert(name, lazy_theme);
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(lazy_theme_set)
|
||||||
|
}
|
||||||
|
}
|
27
src/assets/serialized_syntax_set.rs
Normal file
27
src/assets/serialized_syntax_set.rs
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
|
use syntect::parsing::SyntaxSet;
|
||||||
|
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
/// A SyntaxSet in serialized form, i.e. bincoded and flate2 compressed.
|
||||||
|
/// We keep it in this format since we want to load it lazily.
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub enum SerializedSyntaxSet {
|
||||||
|
/// The data comes from a user-generated cache file.
|
||||||
|
FromFile(PathBuf),
|
||||||
|
|
||||||
|
/// The data to use is embedded into the bat binary.
|
||||||
|
FromBinary(&'static [u8]),
|
||||||
|
}
|
||||||
|
|
||||||
|
impl SerializedSyntaxSet {
|
||||||
|
pub fn deserialize(&self) -> Result<SyntaxSet> {
|
||||||
|
match self {
|
||||||
|
SerializedSyntaxSet::FromBinary(data) => Ok(from_binary(data, COMPRESS_SYNTAXES)),
|
||||||
|
SerializedSyntaxSet::FromFile(ref path) => {
|
||||||
|
asset_from_cache(path, "syntax set", COMPRESS_SYNTAXES)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -1,6 +1,6 @@
|
|||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::ffi::OsStr;
|
use std::path::Path;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
use atty::{self, Stream};
|
use atty::{self, Stream};
|
||||||
@@ -62,7 +62,7 @@ impl App {
|
|||||||
// Read arguments from bats config file
|
// Read arguments from bats config file
|
||||||
let mut args = get_args_from_env_var()
|
let mut args = get_args_from_env_var()
|
||||||
.unwrap_or_else(get_args_from_config_file)
|
.unwrap_or_else(get_args_from_config_file)
|
||||||
.chain_err(|| "Could not parse configuration file")?;
|
.map_err(|_| "Could not parse configuration file")?;
|
||||||
|
|
||||||
// Put the zero-th CLI argument (program name) first
|
// Put the zero-th CLI argument (program name) first
|
||||||
args.insert(0, cli_args.next().unwrap());
|
args.insert(0, cli_args.next().unwrap());
|
||||||
@@ -107,6 +107,12 @@ impl App {
|
|||||||
|
|
||||||
let mut syntax_mapping = SyntaxMapping::builtin();
|
let mut syntax_mapping = SyntaxMapping::builtin();
|
||||||
|
|
||||||
|
if let Some(values) = self.matches.values_of("ignored-suffix") {
|
||||||
|
for suffix in values {
|
||||||
|
syntax_mapping.insert_ignored_suffix(suffix);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(values) = self.matches.values_of("map-syntax") {
|
if let Some(values) = self.matches.values_of("map-syntax") {
|
||||||
for from_to in values {
|
for from_to in values {
|
||||||
let parts: Vec<_> = from_to.split(':').collect();
|
let parts: Vec<_> = from_to.split(':').collect();
|
||||||
@@ -158,7 +164,7 @@ impl App {
|
|||||||
WrappingMode::Character
|
WrappingMode::Character
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => unreachable!("other values for --paging are not allowed"),
|
_ => unreachable!("other values for --wrap are not allowed"),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// We don't have the tty width when piping to another program.
|
// We don't have the tty width when piping to another program.
|
||||||
@@ -234,6 +240,7 @@ impl App {
|
|||||||
.map(LineRanges::from)
|
.map(LineRanges::from)
|
||||||
.map(HighlightedLineRanges)
|
.map(HighlightedLineRanges)
|
||||||
.unwrap_or_default(),
|
.unwrap_or_default(),
|
||||||
|
use_custom_assets: !self.matches.is_present("no-custom-assets"),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -248,16 +255,19 @@ impl App {
|
|||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
let filenames: Option<Vec<&str>> = self
|
let filenames: Option<Vec<&Path>> = self
|
||||||
.matches
|
.matches
|
||||||
.values_of("file-name")
|
.values_of_os("file-name")
|
||||||
.map(|values| values.collect());
|
.map(|values| values.map(Path::new).collect());
|
||||||
|
|
||||||
let mut filenames_or_none: Box<dyn Iterator<Item = _>> = match filenames {
|
let mut filenames_or_none: Box<dyn Iterator<Item = Option<&Path>>> = match filenames {
|
||||||
Some(ref filenames) => Box::new(filenames.iter().map(|name| Some(OsStr::new(*name)))),
|
Some(filenames) => Box::new(filenames.into_iter().map(Some)),
|
||||||
None => Box::new(std::iter::repeat(None)),
|
None => Box::new(std::iter::repeat(None)),
|
||||||
};
|
};
|
||||||
let files: Option<Vec<&OsStr>> = self.matches.values_of_os("FILE").map(|vs| vs.collect());
|
let files: Option<Vec<&Path>> = self
|
||||||
|
.matches
|
||||||
|
.values_of_os("FILE")
|
||||||
|
.map(|vs| vs.map(Path::new).collect());
|
||||||
|
|
||||||
if files.is_none() {
|
if files.is_none() {
|
||||||
return Ok(vec![new_stdin_input(
|
return Ok(vec![new_stdin_input(
|
||||||
@@ -297,7 +307,7 @@ impl App {
|
|||||||
.map(|style_str| {
|
.map(|style_str| {
|
||||||
style_str
|
style_str
|
||||||
.split(',')
|
.split(',')
|
||||||
.map(|x| StyleComponent::from_str(&x))
|
.map(StyleComponent::from_str)
|
||||||
.collect::<Result<Vec<StyleComponent>>>()
|
.collect::<Result<Vec<StyleComponent>>>()
|
||||||
})
|
})
|
||||||
.transpose()?;
|
.transpose()?;
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
|
use std::io;
|
||||||
|
|
||||||
use clap::crate_version;
|
use clap::crate_version;
|
||||||
|
|
||||||
@@ -18,26 +19,14 @@ pub fn cache_dir() -> Cow<'static, str> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn clear_assets() {
|
pub fn clear_assets() {
|
||||||
let theme_set_path = PROJECT_DIRS.cache_dir().join("themes.bin");
|
clear_asset("themes.bin", "theme set cache");
|
||||||
let syntax_set_path = PROJECT_DIRS.cache_dir().join("syntaxes.bin");
|
clear_asset("syntaxes.bin", "syntax set cache");
|
||||||
let metadata_file = PROJECT_DIRS.cache_dir().join("metadata.yaml");
|
clear_asset("metadata.yaml", "metadata file");
|
||||||
|
|
||||||
print!("Clearing theme set cache ... ");
|
|
||||||
fs::remove_file(theme_set_path).ok();
|
|
||||||
println!("okay");
|
|
||||||
|
|
||||||
print!("Clearing syntax set cache ... ");
|
|
||||||
fs::remove_file(syntax_set_path).ok();
|
|
||||||
println!("okay");
|
|
||||||
|
|
||||||
print!("Clearing metadata file ... ");
|
|
||||||
fs::remove_file(metadata_file).ok();
|
|
||||||
println!("okay");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn assets_from_cache_or_binary() -> Result<HighlightingAssets> {
|
pub fn assets_from_cache_or_binary(use_custom_assets: bool) -> Result<HighlightingAssets> {
|
||||||
let cache_dir = PROJECT_DIRS.cache_dir();
|
let cache_dir = PROJECT_DIRS.cache_dir();
|
||||||
if let Some(metadata) = AssetsMetadata::load_from_folder(&cache_dir)? {
|
if let Some(metadata) = AssetsMetadata::load_from_folder(cache_dir)? {
|
||||||
if !metadata.is_compatible_with(crate_version!()) {
|
if !metadata.is_compatible_with(crate_version!()) {
|
||||||
return Err(format!(
|
return Err(format!(
|
||||||
"The binary caches for the user-customized syntaxes and themes \
|
"The binary caches for the user-customized syntaxes and themes \
|
||||||
@@ -53,6 +42,24 @@ pub fn assets_from_cache_or_binary() -> Result<HighlightingAssets> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(HighlightingAssets::from_cache(&cache_dir)
|
let custom_assets = if use_custom_assets {
|
||||||
.unwrap_or_else(|_| HighlightingAssets::from_binary()))
|
HighlightingAssets::from_cache(cache_dir).ok()
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
|
Ok(custom_assets.unwrap_or_else(HighlightingAssets::from_binary))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn clear_asset(filename: &str, description: &str) {
|
||||||
|
print!("Clearing {} ... ", description);
|
||||||
|
let path = PROJECT_DIRS.cache_dir().join(filename);
|
||||||
|
match fs::remove_file(&path) {
|
||||||
|
Err(err) if err.kind() == io::ErrorKind::NotFound => {
|
||||||
|
println!("skipped (not present)");
|
||||||
|
}
|
||||||
|
Err(err) => {
|
||||||
|
println!("could not remove the cache file {:?}: {}", &path, err);
|
||||||
|
}
|
||||||
|
Ok(_) => println!("okay"),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,21 @@
|
|||||||
use clap::{crate_name, crate_version, App as ClapApp, AppSettings, Arg, ArgGroup, SubCommand};
|
use clap::{crate_name, crate_version, App as ClapApp, AppSettings, Arg, ArgGroup, SubCommand};
|
||||||
|
use once_cell::sync::Lazy;
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
|
static VERSION: Lazy<String> = Lazy::new(|| {
|
||||||
|
#[cfg(feature = "bugreport")]
|
||||||
|
let git_version = bugreport::git_version!(fallback = "");
|
||||||
|
#[cfg(not(feature = "bugreport"))]
|
||||||
|
let git_version = "";
|
||||||
|
|
||||||
|
if git_version.is_empty() {
|
||||||
|
crate_version!().to_string()
|
||||||
|
} else {
|
||||||
|
format!("{} ({})", crate_version!(), git_version)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
||||||
let clap_color_setting = if interactive_output && env::var_os("NO_COLOR").is_none() {
|
let clap_color_setting = if interactive_output && env::var_os("NO_COLOR").is_none() {
|
||||||
AppSettings::ColoredHelp
|
AppSettings::ColoredHelp
|
||||||
@@ -10,7 +24,7 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let mut app = ClapApp::new(crate_name!())
|
let mut app = ClapApp::new(crate_name!())
|
||||||
.version(crate_version!())
|
.version(VERSION.as_str())
|
||||||
.global_setting(clap_color_setting)
|
.global_setting(clap_color_setting)
|
||||||
.global_setting(AppSettings::DeriveDisplayOrder)
|
.global_setting(AppSettings::DeriveDisplayOrder)
|
||||||
.global_setting(AppSettings::UnifiedHelpMessage)
|
.global_setting(AppSettings::UnifiedHelpMessage)
|
||||||
@@ -95,7 +109,8 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
|||||||
'--highlight-line 40' highlights line 40\n \
|
'--highlight-line 40' highlights line 40\n \
|
||||||
'--highlight-line 30:40' highlights lines 30 to 40\n \
|
'--highlight-line 30:40' highlights lines 30 to 40\n \
|
||||||
'--highlight-line :40' highlights lines 1 to 40\n \
|
'--highlight-line :40' highlights lines 1 to 40\n \
|
||||||
'--highlight-line 40:' highlights lines 40 to the end of the file",
|
'--highlight-line 40:' highlights lines 40 to the end of the file\n \
|
||||||
|
'--highlight-line 30:+10' highlights lines 30 to 40",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
@@ -294,6 +309,7 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
|||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("no-paging")
|
Arg::with_name("no-paging")
|
||||||
.short("P")
|
.short("P")
|
||||||
|
.long("no-paging")
|
||||||
.alias("no-pager")
|
.alias("no-pager")
|
||||||
.overrides_with("no-paging")
|
.overrides_with("no-paging")
|
||||||
.hidden(true)
|
.hidden(true)
|
||||||
@@ -333,6 +349,18 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
|||||||
)
|
)
|
||||||
.takes_value(true),
|
.takes_value(true),
|
||||||
)
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("ignored-suffix")
|
||||||
|
.number_of_values(1)
|
||||||
|
.multiple(true)
|
||||||
|
.takes_value(true)
|
||||||
|
.long("ignored-suffix")
|
||||||
|
.hidden_short_help(true)
|
||||||
|
.help(
|
||||||
|
"Ignore extension. For example:\n \
|
||||||
|
'bat --ignored-suffix \".dev\" my_file.json.dev' will use JSON syntax, and ignore '.dev'"
|
||||||
|
)
|
||||||
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("theme")
|
Arg::with_name("theme")
|
||||||
.long("theme")
|
.long("theme")
|
||||||
@@ -368,11 +396,19 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
|||||||
.validator(|val| {
|
.validator(|val| {
|
||||||
let mut invalid_vals = val.split(',').filter(|style| {
|
let mut invalid_vals = val.split(',').filter(|style| {
|
||||||
!&[
|
!&[
|
||||||
"auto", "full", "plain", "header", "grid", "rule", "numbers", "snip",
|
"auto",
|
||||||
|
"full",
|
||||||
|
"plain",
|
||||||
|
"header",
|
||||||
|
"header-filename",
|
||||||
|
"header-filesize",
|
||||||
|
"grid",
|
||||||
|
"rule",
|
||||||
|
"numbers",
|
||||||
|
"snip",
|
||||||
#[cfg(feature = "git")]
|
#[cfg(feature = "git")]
|
||||||
"changes",
|
"changes",
|
||||||
]
|
].contains(style)
|
||||||
.contains(style)
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if let Some(invalid) = invalid_vals.next() {
|
if let Some(invalid) = invalid_vals.next() {
|
||||||
@@ -394,11 +430,13 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
|||||||
'--style=\"..\"' option to the configuration file or export the \
|
'--style=\"..\"' option to the configuration file or export the \
|
||||||
BAT_STYLE environment variable (e.g.: export BAT_STYLE=\"..\").\n\n\
|
BAT_STYLE environment variable (e.g.: export BAT_STYLE=\"..\").\n\n\
|
||||||
Possible values:\n\n \
|
Possible values:\n\n \
|
||||||
* full: enables all available components.\n \
|
* full: enables all available components (default).\n \
|
||||||
* auto: same as 'full', unless the output is piped (default).\n \
|
* auto: same as 'full', unless the output is piped.\n \
|
||||||
* plain: disables all available components.\n \
|
* plain: disables all available components.\n \
|
||||||
* changes: show Git modification markers.\n \
|
* changes: show Git modification markers.\n \
|
||||||
* header: show filenames before the content.\n \
|
* header: alias for 'header-filename'.\n \
|
||||||
|
* header-filename: show filenames before the content.\n \
|
||||||
|
* header-filesize: show file sizes before the content.\n \
|
||||||
* grid: vertical/horizontal lines to separate side bar\n \
|
* grid: vertical/horizontal lines to separate side bar\n \
|
||||||
and the header from the content.\n \
|
and the header from the content.\n \
|
||||||
* rule: horizontal lines to delimit files.\n \
|
* rule: horizontal lines to delimit files.\n \
|
||||||
@@ -422,7 +460,8 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
|||||||
'--line-range 30:40' prints lines 30 to 40\n \
|
'--line-range 30:40' prints lines 30 to 40\n \
|
||||||
'--line-range :40' prints lines 1 to 40\n \
|
'--line-range :40' prints lines 1 to 40\n \
|
||||||
'--line-range 40:' prints lines 40 to the end of the file\n \
|
'--line-range 40:' prints lines 40 to the end of the file\n \
|
||||||
'--line-range 40' only prints line 40",
|
'--line-range 40' only prints line 40\n \
|
||||||
|
'--line-range 30:+10' prints lines 30 to 40",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
@@ -450,6 +489,12 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
|||||||
.hidden(true)
|
.hidden(true)
|
||||||
.help("Do not use the configuration file"),
|
.help("Do not use the configuration file"),
|
||||||
)
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("no-custom-assets")
|
||||||
|
.long("no-custom-assets")
|
||||||
|
.hidden(true)
|
||||||
|
.help("Do not load custom assets"),
|
||||||
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("config-file")
|
Arg::with_name("config-file")
|
||||||
.long("config-file")
|
.long("config-file")
|
||||||
@@ -485,6 +530,12 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
|||||||
.hidden_short_help(true)
|
.hidden_short_help(true)
|
||||||
.help("Show diagnostic information for bug reports.")
|
.help("Show diagnostic information for bug reports.")
|
||||||
)
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("acknowledgements")
|
||||||
|
.long("acknowledgements")
|
||||||
|
.hidden_short_help(true)
|
||||||
|
.help("Show acknowledgements."),
|
||||||
|
)
|
||||||
.help_message("Print this help message.")
|
.help_message("Print this help message.")
|
||||||
.version_message("Show version information.");
|
.version_message("Show version information.");
|
||||||
|
|
||||||
@@ -543,6 +594,12 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
|||||||
"Create completely new syntax and theme sets \
|
"Create completely new syntax and theme sets \
|
||||||
(instead of appending to the default sets).",
|
(instead of appending to the default sets).",
|
||||||
),
|
),
|
||||||
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("acknowledgements")
|
||||||
|
.long("acknowledgements")
|
||||||
|
.requires("build")
|
||||||
|
.help("Build acknowledgements.bin."),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@@ -64,7 +64,7 @@ pub fn generate_config_file() -> bat::error::Result<()> {
|
|||||||
#--pager="less --RAW-CONTROL-CHARS --quit-if-one-screen --mouse"
|
#--pager="less --RAW-CONTROL-CHARS --quit-if-one-screen --mouse"
|
||||||
|
|
||||||
# Syntax mappings: map a certain filename pattern to a language.
|
# Syntax mappings: map a certain filename pattern to a language.
|
||||||
# Example 1: use the C++ syntax for .ino files
|
# Example 1: use the C++ syntax for Arduino .ino files
|
||||||
# Example 2: Use ".gitignore"-style highlighting for ".ignore" files
|
# Example 2: Use ".gitignore"-style highlighting for ".ignore" files
|
||||||
#--map-syntax "*.ino:C++"
|
#--map-syntax "*.ino:C++"
|
||||||
#--map-syntax ".ignore:Git Ignore"
|
#--map-syntax ".ignore:Git Ignore"
|
||||||
@@ -104,7 +104,7 @@ fn get_args_from_str(content: &str) -> Result<Vec<OsString>, shell_words::ParseE
|
|||||||
.map(|line| line.trim())
|
.map(|line| line.trim())
|
||||||
.filter(|line| !line.is_empty())
|
.filter(|line| !line.is_empty())
|
||||||
.filter(|line| !line.starts_with('#'))
|
.filter(|line| !line.starts_with('#'))
|
||||||
.map(|line| shell_words::split(line))
|
.map(shell_words::split)
|
||||||
.collect::<Result<Vec<_>, _>>()?;
|
.collect::<Result<Vec<_>, _>>()?;
|
||||||
|
|
||||||
Ok(args_per_line
|
Ok(args_per_line
|
||||||
|
@@ -1,11 +1,12 @@
|
|||||||
use std::env;
|
use std::env;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
use lazy_static::lazy_static;
|
use once_cell::sync::Lazy;
|
||||||
|
|
||||||
/// Wrapper for 'dirs' that treats MacOS more like Linux, by following the XDG specification.
|
/// Wrapper for 'dirs' that treats MacOS more like Linux, by following the XDG specification.
|
||||||
/// This means that the `XDG_CACHE_HOME` and `XDG_CONFIG_HOME` environment variables are
|
/// The `XDG_CACHE_HOME` environment variable is checked first. `BAT_CONFIG_DIR`
|
||||||
/// checked first. The fallback directories are `~/.cache/bat` and `~/.config/bat`, respectively.
|
/// is then checked before the `XDG_CONFIG_HOME` environment variable.
|
||||||
|
/// The fallback directories are `~/.cache/bat` and `~/.config/bat`, respectively.
|
||||||
pub struct BatProjectDirs {
|
pub struct BatProjectDirs {
|
||||||
cache_dir: PathBuf,
|
cache_dir: PathBuf,
|
||||||
config_dir: PathBuf,
|
config_dir: PathBuf,
|
||||||
@@ -15,6 +16,12 @@ impl BatProjectDirs {
|
|||||||
fn new() -> Option<BatProjectDirs> {
|
fn new() -> Option<BatProjectDirs> {
|
||||||
let cache_dir = BatProjectDirs::get_cache_dir()?;
|
let cache_dir = BatProjectDirs::get_cache_dir()?;
|
||||||
|
|
||||||
|
// Checks whether or not $BAT_CONFIG_DIR exists. If it doesn't, set our config dir
|
||||||
|
// to our system's default configuration home.
|
||||||
|
let config_dir =
|
||||||
|
if let Some(config_dir_op) = env::var_os("BAT_CONFIG_DIR").map(PathBuf::from) {
|
||||||
|
config_dir_op
|
||||||
|
} else {
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
let config_dir_op = env::var_os("XDG_CONFIG_HOME")
|
let config_dir_op = env::var_os("XDG_CONFIG_HOME")
|
||||||
.map(PathBuf::from)
|
.map(PathBuf::from)
|
||||||
@@ -24,7 +31,8 @@ impl BatProjectDirs {
|
|||||||
#[cfg(not(target_os = "macos"))]
|
#[cfg(not(target_os = "macos"))]
|
||||||
let config_dir_op = dirs_next::config_dir();
|
let config_dir_op = dirs_next::config_dir();
|
||||||
|
|
||||||
let config_dir = config_dir_op.map(|d| d.join("bat"))?;
|
config_dir_op.map(|d| d.join("bat"))?
|
||||||
|
};
|
||||||
|
|
||||||
Some(BatProjectDirs {
|
Some(BatProjectDirs {
|
||||||
cache_dir,
|
cache_dir,
|
||||||
@@ -60,7 +68,5 @@ impl BatProjectDirs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lazy_static! {
|
pub static PROJECT_DIRS: Lazy<BatProjectDirs> =
|
||||||
pub static ref PROJECT_DIRS: BatProjectDirs =
|
Lazy::new(|| BatProjectDirs::new().expect("Could not get home directory"));
|
||||||
BatProjectDirs::new().expect("Could not get home directory");
|
|
||||||
}
|
|
||||||
|
@@ -1,15 +1,15 @@
|
|||||||
use bat::input::Input;
|
use bat::input::Input;
|
||||||
use std::ffi::OsStr;
|
use std::path::Path;
|
||||||
|
|
||||||
pub fn new_file_input<'a>(file: &'a OsStr, name: Option<&'a OsStr>) -> Input<'a> {
|
pub fn new_file_input<'a>(file: &'a Path, name: Option<&'a Path>) -> Input<'a> {
|
||||||
named(Input::ordinary_file(file), name.or(Some(file)))
|
named(Input::ordinary_file(file), name.or(Some(file)))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_stdin_input(name: Option<&OsStr>) -> Input {
|
pub fn new_stdin_input(name: Option<&Path>) -> Input {
|
||||||
named(Input::stdin(), name)
|
named(Input::stdin(), name)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn named<'a>(input: Input<'a>, name: Option<&OsStr>) -> Input<'a> {
|
fn named<'a>(input: Input<'a>, name: Option<&Path>) -> Input<'a> {
|
||||||
if let Some(provided_name) = name {
|
if let Some(provided_name) = name {
|
||||||
let mut input = input.with_name(Some(provided_name));
|
let mut input = input.with_name(Some(provided_name));
|
||||||
input.description_mut().set_kind(Some("File".to_owned()));
|
input.description_mut().set_kind(Some("File".to_owned()));
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user