Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scope names: overhaul support for bat themes #17

Merged
merged 25 commits into from
Dec 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
0852965
Scope section headings as string.etc
victor-gp Sep 25, 2022
9d1d2a3
Write one scope per line
victor-gp Oct 20, 2022
96c1a39
Improve gshow util
victor-gp Oct 20, 2022
e42a163
Keep the markup.heading scope as secondary
victor-gp Oct 20, 2022
53b618d
(test) Add support.class scope to option arguments
victor-gp Oct 20, 2022
63a4151
(test) Scope option arguments as constant.other.color
victor-gp Oct 21, 2022
fcdd8bc
(test) constant.other without the .color
victor-gp Oct 21, 2022
8e8c83d
(test) Just constant
victor-gp Oct 21, 2022
10e0246
(test) storage
victor-gp Oct 21, 2022
364eddc
(test) support
victor-gp Oct 21, 2022
fcf3e86
option-argument scopes: back to the starting point
victor-gp Oct 25, 2022
9a8e945
Change arguments' scope to constant.other
victor-gp Oct 25, 2022
9a13f99
Add a task to reconsider the argument scope
victor-gp Oct 25, 2022
b0996ff
Scope the other arg-like classes as constant.other
victor-gp Oct 25, 2022
e30732e
Swap argument & subcommand scopes
victor-gp Nov 29, 2022
34bc213
Merge branch 'main' into overhaul-color-theme-support
victor-gp Nov 30, 2022
fa3a06f
Fix unchanged scope names from the recent swap
victor-gp Dec 4, 2022
6bc6429
Make the option argument scope composite
victor-gp Dec 4, 2022
e6aa01d
Update INLINE_USAGE_SCOPES
victor-gp Dec 4, 2022
2a21a60
Reorganize scope anchors
victor-gp Dec 4, 2022
fce67cd
Add ad-hoc scope to make headings golden in Monokai
victor-gp Dec 4, 2022
29de32c
Fix bug in OPTION_ARGUMENT_SCOPES
victor-gp Dec 4, 2022
dea6ad9
Add hyper-specific scope to FILE_DEF for Monokai
victor-gp Dec 5, 2022
1116f4e
Add hyper-specific scope to FILE_DEF for ansi
victor-gp Dec 5, 2022
3293a3f
CI: skip syntax & highlight tests on PRs for themes
victor-gp Dec 6, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ concurrency:
cancel-in-progress: true

jobs:
#fixme: it seems like syntax tests always pass?
syntax_tests:
name: Syntax tests
runs-on: "ubuntu-latest"
timeout-minutes: 10
if: "! startsWith(github.event.pull_request.title, 'Scope names:')"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
Expand All @@ -39,6 +41,7 @@ jobs:
name: Highlight regression tests
runs-on: "ubuntu-latest"
timeout-minutes: 10
if: "! startsWith(github.event.pull_request.title, 'Scope names:')"
steps:
- uses: actions/checkout@v3
- name: Run highlight regression tests
Expand Down
14 changes: 9 additions & 5 deletions docs/Principles.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,20 @@ scope_variables:

Just know that [there's a convention for scope names](https://www.sublimetext.com/docs/scope_naming.html), and syntax themes target those names.

### Constraint on Monokai
### Constraints on Monokai

There is a constraint I would like to preserve.
There are a couple of constraints I would like to preserve.

The help messages generated with the `clap` Rust library were the original inspiration for this project.
They paint **headings in yellow and option definitions in green.**
The help messages generated with the `clap` Rust library were the original inspiration for this project\*.
They painted **headings in yellow\*\* and option definitions in green.**

I'd like those two properties to hold for the default Monokai theme.

Everything else is fair game. And even that constraint is bound to drop if you make a compelling case otherwise.
Everything else is fair game. Even that constraint is bound to drop if you make a compelling case otherwise.

\* Before clap v4, which ditched colors for style (bold, underlined) in help messages.

\*\* In the theme I use in my terminal (srcery), yellow means golden. So favor e.g. golden orange over pale yellow.

## Coding style

Expand Down
5 changes: 4 additions & 1 deletion scripts/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ function gdiffs {
# to exclude e.g. THEME-italics, do:
# gdiff -- ":^*-italics*"

alias gshow='GIT_PAGER="LESS=R less" git diff HEAD^ HEAD -- tests/{highlighted,theme}'
function gshow {
GIT_PAGER="LESS=R less" git show "$@" -- tests/{highlighted,theme}
}

alias git0='GIT_CONFIG=/dev/null git'

debug() {
Expand Down
53 changes: 29 additions & 24 deletions syntaxes/cmd-help.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -46,36 +46,41 @@ variables:

scope_variables: # last scope is matched first
- &SECTION_HEADING_SCOPES
constant.section-heading.cmd-help string.section-heading.cmd-help
markup.heading.cmd-help entity.name.section.cmd-help
constant.section-heading.cmd-help
markup.heading.cmd-help
string.section-heading.cmd-help
meta.constructor.argument.css.section-heading.cmd-help
- &INLINE_USAGE_SCOPES
constant.section-heading.cmd-help string.inline-usage.cmd-help
markup.heading.inline-usage.cmd-help entity.name.section.inline-usage.cmd-help
constant.section-heading.inline-usage.cmd-help
markup.heading.inline-usage.cmd-help
string.section-heading.inline-usage.cmd-help
meta.constructor.argument.css.section-heading.inline-usage.cmd-help

- &OPTION_DEF_SCOPES
entity.name.function.option.cmd-help
- &PLUS_OPTION_DEF_SCOPES
entity.name.function.option.plus.cmd-help
- &END_OF_OPTIONS_SCOPE
constant.other.end-of-options.cmd-help

- &OPTION_ARGUMENT_SCOPES
string.option-argument.cmd-help variable.other.option-argument.cmd-help
variable.parameter.option-argument.cmd-help

# argument definitions (99% confidence)
- &ARGUMENT_DEF_SCOPES # =~ option argument
string.argument.cmd-help variable.other.argument.cmd-help
variable.parameter.argument.cmd-help
# mostly all-caps definitions. usually environment variables or arguments
- &OTHER_VAL_DEF_SCOPES # =~ option argument
string.other-value.cmd-help variable.other.other-value.cmd-help
variable.parameter.other-value.cmd-help
entity.name.function.option.cmd-help
keyword.other.argument.cmd-help
# argument definitions (99% confidence) =~ OPTION_ARGUMENT
- &ARGUMENT_DEF_SCOPES
keyword.other.argument.cmd-help
# mostly all-caps definitions. usually envs or args =~ OPTION_ARGUMENT
- &OTHER_VAL_DEF_SCOPES
keyword.other.value.cmd-help

# non all-caps definitions: subcommands, argument enums, etc.
- &OTHER_DEF_SCOPES
keyword.other.def.cmd-help # support.function variable.function ?
constant.other.def.cmd-help

- &FILE_DEF_SCOPES
constant.file.cmd-help
# variable.other.readwrite.file.cmd-help string.file.cmd-help
constant.character.escape.file.cmd-help
variable.parameter.file.cmd-help
meta.function.block.start.handlebars.file.cmd-help


contexts:
Expand Down Expand Up @@ -123,8 +128,8 @@ contexts:
- match: ''
pop: true

de-scope-match:
- clear_scopes: 1
de-scope-option-arg:
- clear_scopes: 2
- include: then-pop

sink:
Expand Down Expand Up @@ -196,7 +201,7 @@ contexts:

option-def-specials:
- match: --(?=\s)
scope: keyword.control.end-of-options.cmd-help
scope: *END_OF_OPTIONS_SCOPE
set: then-pop
- match: \+(?=[\s<[:alpha:]])
scope: *PLUS_OPTION_DEF_SCOPES
Expand Down Expand Up @@ -282,7 +287,7 @@ contexts:
option-def+square-bracket:
- meta_content_scope: *OPTION_ARGUMENT_SCOPES
- match: '\|'
push: de-scope-match
push: de-scope-option-arg
- match: (?=])
set:
- match: ']'
Expand All @@ -304,7 +309,7 @@ contexts:
- meta_content_scope: *OPTION_ARGUMENT_SCOPES
# match ',' or '|'
- match: ',|\|'
push: de-scope-match
push: de-scope-option-arg
- match: (?=})
set:
- match: '}'
Expand Down Expand Up @@ -360,7 +365,7 @@ contexts:
- meta_content_scope: *ARGUMENT_DEF_SCOPES
# match ',' or '|'
- match: ',|\|'
push: de-scope-match
push: de-scope-option-arg
- match: (?=})
set:
- match: '}'
Expand Down
10 changes: 5 additions & 5 deletions tests/theme/brief-1337.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions tests/theme/brief-Coldark-Cold.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions tests/theme/brief-Coldark-Dark.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions tests/theme/brief-DarkNeon.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions tests/theme/brief-Dracula.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions tests/theme/brief-GitHub.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions tests/theme/brief-Monokai Extended Bright.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions tests/theme/brief-Monokai Extended Light.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions tests/theme/brief-Monokai Extended Origin.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions tests/theme/brief-Monokai Extended.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions tests/theme/brief-Nord.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions tests/theme/brief-OneHalfDark.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions tests/theme/brief-OneHalfLight.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions tests/theme/brief-Solarized (dark).txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading