Merge pull request #1289 from ZyX-I/fix-lint-hl-groups
Fix highlight groups linting
This commit is contained in:
commit
cddfc364c1
|
@ -1,13 +1,19 @@
|
|||
{
|
||||
"name": "Default",
|
||||
"groups": {
|
||||
"information:additional": { "fg": "gray9", "bg": "gray4", "attrs": [] },
|
||||
"information:regular": { "fg": "gray10", "bg": "gray4", "attrs": ["bold"] },
|
||||
"information:highlighted": { "fg": "white", "bg": "gray4", "attrs": [] },
|
||||
"information:priority": { "fg": "brightyellow", "bg": "mediumorange", "attrs": [] },
|
||||
"critical:failure": { "fg": "white", "bg": "darkestred", "attrs": [] },
|
||||
"critical:success": { "fg": "white", "bg": "darkestgreen", "attrs": [] },
|
||||
"background": { "fg": "white", "bg": "gray0", "attrs": [] },
|
||||
"background:divider": { "fg": "gray5", "bg": "gray0", "attrs": [] },
|
||||
"session": { "fg": "black", "bg": "gray10", "attrs": ["bold"] },
|
||||
"date": { "fg": "gray8", "bg": "gray2", "attrs": [] },
|
||||
"time": { "fg": "gray10", "bg": "gray2", "attrs": ["bold"] },
|
||||
"time:divider": { "fg": "gray5", "bg": "gray2", "attrs": [] },
|
||||
"email_alert": { "fg": "white", "bg": "brightred", "attrs": ["bold"] },
|
||||
"email_alert": "warning:regular",
|
||||
"email_alert_gradient": { "fg": "white", "bg": "yellow_orange_red", "attrs": ["bold"] },
|
||||
"hostname": { "fg": "black", "bg": "gray10", "attrs": ["bold"] },
|
||||
"weather": { "fg": "gray8", "bg": "gray0", "attrs": [] },
|
||||
|
@ -31,13 +37,12 @@
|
|||
"battery_empty": { "fg": "white", "bg": "gray0", "attrs": [] },
|
||||
"player": { "fg": "gray10", "bg": "black", "attrs": [] },
|
||||
"user": { "fg": "white", "bg": "darkblue", "attrs": ["bold"] },
|
||||
"superuser": { "fg": "white", "bg": "brightred", "attrs": ["bold"] },
|
||||
"branch": { "fg": "gray9", "bg": "gray2", "attrs": [] },
|
||||
"branch_dirty": { "fg": "brightyellow", "bg": "gray2", "attrs": [] },
|
||||
"branch_clean": { "fg": "gray9", "bg": "gray2", "attrs": [] },
|
||||
"branch:divider": { "fg": "gray7", "bg": "gray2", "attrs": [] },
|
||||
"cwd": { "fg": "gray9", "bg": "gray4", "attrs": [] },
|
||||
"cwd:current_folder": { "fg": "gray10", "bg": "gray4", "attrs": ["bold"] },
|
||||
"cwd": "information:additional",
|
||||
"cwd:current_folder": "information:regular",
|
||||
"cwd:divider": { "fg": "gray7", "bg": "gray4", "attrs": [] },
|
||||
"virtualenv": { "fg": "white", "bg": "darkcyan", "attrs": [] },
|
||||
"attached_clients": { "fg": "gray8", "bg": "gray0", "attrs": [] }
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"groups": {
|
||||
"prompt": "information:additional",
|
||||
"prompt_count": "information:highlighted"
|
||||
}
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"name": "Default color scheme for IPython prompt",
|
||||
"groups": {
|
||||
"prompt": { "fg": "gray9", "bg": "gray4", "attrs": [] },
|
||||
"prompt_count": { "fg": "white", "bg": "gray4", "attrs": [] }
|
||||
}
|
||||
}
|
|
@ -1,6 +1,10 @@
|
|||
{
|
||||
"groups": {
|
||||
"continuation": "cwd",
|
||||
"continuation:current": "cwd:current_folder"
|
||||
"continuation:current": "cwd:current_folder",
|
||||
"exit_fail": "critical:failure",
|
||||
"exit_success": "critical:success",
|
||||
"jobnum": "information:priority",
|
||||
"superuser": "warning:regular"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,9 +2,6 @@
|
|||
"name": "Default color scheme for shell prompts",
|
||||
"groups": {
|
||||
"hostname": { "fg": "brightyellow", "bg": "mediumorange", "attrs": [] },
|
||||
"jobnum": { "fg": "brightyellow", "bg": "mediumorange", "attrs": [] },
|
||||
"exit_fail": { "fg": "white", "bg": "darkestred", "attrs": [] },
|
||||
"exit_success": { "fg": "white", "bg": "darkestgreen", "attrs": [] },
|
||||
"environment": { "fg": "white", "bg": "darkestgreen", "attrs": [] },
|
||||
"mode": { "fg": "darkestgreen", "bg": "brightgreen", "attrs": ["bold"] },
|
||||
"attached_clients": { "fg": "white", "bg": "darkestgreen", "attrs": [] }
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
{
|
||||
"name": "Solarized dark for shell",
|
||||
"groups": {
|
||||
"jobnum": { "fg": "solarized:base3", "bg": "solarized:base01", "attrs": [] },
|
||||
"exit_fail": { "fg": "solarized:base3", "bg": "solarized:red", "attrs": [] },
|
||||
"exit_success": { "fg": "solarized:base3", "bg": "solarized:green", "attrs": [] },
|
||||
"mode": { "fg": "solarized:base3", "bg": "solarized:green", "attrs": ["bold"] }
|
||||
"mode": { "fg": "solarized:base3", "bg": "solarized:green", "attrs": ["bold"] }
|
||||
},
|
||||
"mode_translations": {
|
||||
"vicmd": {
|
||||
|
|
|
@ -1,18 +1,34 @@
|
|||
{
|
||||
"name": "Solarized dark",
|
||||
"groups": {
|
||||
"background": { "fg": "solarized:base3", "bg": "solarized:base02", "attrs": [] },
|
||||
"user": { "fg": "solarized:base3", "bg": "solarized:blue", "attrs": ["bold"] },
|
||||
"superuser": { "fg": "solarized:base3", "bg": "solarized:red", "attrs": ["bold"] },
|
||||
"virtualenv": { "fg": "solarized:base3", "bg": "solarized:green", "attrs": [] },
|
||||
"branch": { "fg": "solarized:base1", "bg": "solarized:base02", "attrs": [] },
|
||||
"branch_dirty": { "fg": "solarized:yellow", "bg": "solarized:base02", "attrs": [] },
|
||||
"branch_clean": { "fg": "solarized:base1", "bg": "solarized:base02", "attrs": [] },
|
||||
"cwd": { "fg": "solarized:base2", "bg": "solarized:base01", "attrs": [] },
|
||||
"cwd:current_folder": { "fg": "solarized:base3", "bg": "solarized:base01", "attrs": ["bold"] },
|
||||
"cwd:divider": { "fg": "solarized:base1", "bg": "solarized:base01", "attrs": [] },
|
||||
"hostname": { "fg": "solarized:base3", "bg": "solarized:base01", "attrs": [] },
|
||||
"environment": { "fg": "solarized:base3", "bg": "solarized:green", "attrs": [] },
|
||||
"attached_clients": { "fg": "solarized:base3", "bg": "solarized:green", "attrs": [] }
|
||||
"information:additional": { "fg": "solarized:base2", "bg": "solarized:base01", "attrs": [] },
|
||||
"information:regular": { "fg": "solarized:base3", "bg": "solarized:base01", "attrs": ["bold"] },
|
||||
"information:highlighted": { "fg": "solarized:base3", "bg": "solarized:base01", "attrs": ["bold"]},
|
||||
"information:priority": { "fg": "solarized:base3", "bg": "solarized:yellow", "attrs": [] },
|
||||
"warning:regular": { "fg": "solarized:base3", "bg": "solarized:red", "attrs": [] },
|
||||
"critical:failure": { "fg": "solarized:base3", "bg": "solarized:red", "attrs": [] },
|
||||
"critical:success": { "fg": "solarized:base3", "bg": "solarized:green", "attrs": [] },
|
||||
"background": { "fg": "solarized:base3", "bg": "solarized:base02", "attrs": [] },
|
||||
"background:divider": { "fg": "solarized:base1", "bg": "solarized:base02", "attrs": [] },
|
||||
"user": { "fg": "solarized:base3", "bg": "solarized:blue", "attrs": ["bold"] },
|
||||
"virtualenv": { "fg": "solarized:base3", "bg": "solarized:green", "attrs": [] },
|
||||
"branch": { "fg": "solarized:base1", "bg": "solarized:base02", "attrs": [] },
|
||||
"branch_dirty": { "fg": "solarized:yellow", "bg": "solarized:base02", "attrs": [] },
|
||||
"branch_clean": { "fg": "solarized:base1", "bg": "solarized:base02", "attrs": [] },
|
||||
"email_alert_gradient": { "fg": "solarized:base3", "bg": "yellow_orange_red", "attrs": [] },
|
||||
"email_alert": "warning:regular",
|
||||
"cwd": "information:additional",
|
||||
"cwd:current_folder": "information:regular",
|
||||
"cwd:divider": { "fg": "solarized:base1", "bg": "solarized:base01", "attrs": [] },
|
||||
"hostname": { "fg": "solarized:base3", "bg": "solarized:base01", "attrs": [] },
|
||||
"environment": { "fg": "solarized:base3", "bg": "solarized:green", "attrs": [] },
|
||||
"attached_clients": { "fg": "solarized:base3", "bg": "solarized:green", "attrs": [] },
|
||||
"date": { "fg": "solarized:base1", "bg": "solarized:base02", "attrs": [] },
|
||||
"time": { "fg": "solarized:base1", "bg": "solarized:base02", "attrs": ["bold"] },
|
||||
"time:divider": { "fg": "solarized:base1", "bg": "solarized:base02", "attrs": [] },
|
||||
"system_load": { "fg": "solarized:base1", "bg": "solarized:base03", "attrs": [] },
|
||||
"weather_temp_gradient": { "fg": "blue_red", "bg": "solarized:base03", "attrs": [] },
|
||||
"weather": { "fg": "solarized:base1", "bg": "solarized:base03", "attrs": [] },
|
||||
"uptime": { "fg": "solarized:base1", "bg": "solarized:base03", "attrs": [] }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -233,6 +233,7 @@ segment_spec = Spec(
|
|||
segments=sub_segments_spec,
|
||||
).func(check_full_segment_data)
|
||||
sub_segments_spec.optional().list(segment_spec)
|
||||
del sub_segments_spec
|
||||
segments_spec = Spec().optional().list(segment_spec).copy
|
||||
segdict_spec = Spec(
|
||||
left=segments_spec().context_message('Error while loading segments from left side (key {key})'),
|
||||
|
@ -546,6 +547,8 @@ def check(paths=None, debug=False, echoerr=echoerr, require_ext=None):
|
|||
econfigs.get('__main__'),
|
||||
ecconfigs,
|
||||
)
|
||||
if not (mconfigs[0] or mconfigs[2]):
|
||||
continue
|
||||
config = None
|
||||
for mconfig in mconfigs:
|
||||
if not mconfig:
|
||||
|
@ -554,7 +557,7 @@ def check(paths=None, debug=False, echoerr=echoerr, require_ext=None):
|
|||
config = mergedicts_copy(config, mconfig)
|
||||
else:
|
||||
config = mconfig
|
||||
colorscheme_configs[colorscheme] = config
|
||||
colorscheme_configs[ext][colorscheme] = config
|
||||
|
||||
theme_configs = dict2(loaded_configs['themes'])
|
||||
top_theme_configs = dict(loaded_configs['top_themes'])
|
||||
|
|
|
@ -499,6 +499,56 @@ def check_segment_function(function_name, data, context, echoerr):
|
|||
return True, False, False
|
||||
|
||||
|
||||
def hl_group_in_colorscheme(hl_group, cconfig, allow_gradients, data, context, echoerr):
|
||||
havemarks(hl_group, cconfig)
|
||||
if hl_group not in cconfig.get('groups', {}):
|
||||
return False
|
||||
elif not allow_gradients or allow_gradients == 'force':
|
||||
group_config = cconfig['groups'][hl_group]
|
||||
while isinstance(group_config, unicode):
|
||||
try:
|
||||
group_config = cconfig['groups'][group_config]
|
||||
except KeyError:
|
||||
# No such group. Error was already reported when checking
|
||||
# colorschemes.
|
||||
return True
|
||||
havemarks(group_config)
|
||||
hadgradient = False
|
||||
for ckey in ('fg', 'bg'):
|
||||
color = group_config.get(ckey)
|
||||
if not color:
|
||||
# No color. Error was already reported when checking
|
||||
# colorschemes.
|
||||
return True
|
||||
havemarks(color)
|
||||
# Gradients are only allowed for function segments. Note that
|
||||
# whether *either* color or gradient exists should have been
|
||||
# already checked
|
||||
hascolor = color in data['colors_config'].get('colors', {})
|
||||
hasgradient = color in data['colors_config'].get('gradients', {})
|
||||
if hasgradient:
|
||||
hadgradient = True
|
||||
if allow_gradients is False and not hascolor and hasgradient:
|
||||
echoerr(
|
||||
context='Error while checking highlight group in theme (key {key})'.format(
|
||||
key=context.key),
|
||||
context_mark=hl_group.mark,
|
||||
problem='group {0} is using gradient {1} instead of a color'.format(hl_group, color),
|
||||
problem_mark=color.mark
|
||||
)
|
||||
return False
|
||||
if allow_gradients == 'force' and not hadgradient:
|
||||
echoerr(
|
||||
context='Error while checking highlight group in theme (key {key})'.format(
|
||||
key=context.key),
|
||||
context_mark=hl_group.mark,
|
||||
problem='group {0} should have at least one gradient color, but it has no'.format(hl_group),
|
||||
problem_mark=group_config.mark
|
||||
)
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def hl_exists(hl_group, data, context, echoerr, allow_gradients=False):
|
||||
havemarks(hl_group)
|
||||
ext = data['ext']
|
||||
|
@ -507,45 +557,14 @@ def hl_exists(hl_group, data, context, echoerr, allow_gradients=False):
|
|||
# twice
|
||||
return []
|
||||
r = []
|
||||
found = False
|
||||
for colorscheme, cconfig in data['colorscheme_configs'][ext].items():
|
||||
if hl_group not in cconfig.get('groups', {}):
|
||||
if hl_group_in_colorscheme(hl_group, cconfig, allow_gradients, data, context, echoerr):
|
||||
found = True
|
||||
else:
|
||||
r.append(colorscheme)
|
||||
elif not allow_gradients or allow_gradients == 'force':
|
||||
group_config = cconfig['groups'][hl_group]
|
||||
havemarks(group_config)
|
||||
hadgradient = False
|
||||
for ckey in ('fg', 'bg'):
|
||||
color = group_config.get(ckey)
|
||||
if not color:
|
||||
# No color. Error was already reported.
|
||||
continue
|
||||
havemarks(color)
|
||||
# Gradients are only allowed for function segments. Note that
|
||||
# whether *either* color or gradient exists should have been
|
||||
# already checked
|
||||
hascolor = color in data['colors_config'].get('colors', {})
|
||||
hasgradient = color in data['colors_config'].get('gradients', {})
|
||||
if hasgradient:
|
||||
hadgradient = True
|
||||
if allow_gradients is False and not hascolor and hasgradient:
|
||||
echoerr(
|
||||
context='Error while checking highlight group in theme (key {key})'.format(
|
||||
key=context.key),
|
||||
context_mark=hl_group.mark,
|
||||
problem='group {0} is using gradient {1} instead of a color'.format(hl_group, color),
|
||||
problem_mark=color.mark
|
||||
)
|
||||
r.append(colorscheme)
|
||||
continue
|
||||
if allow_gradients == 'force' and not hadgradient:
|
||||
echoerr(
|
||||
context='Error while checking highlight group in theme (key {key})'.format(
|
||||
key=context.key),
|
||||
context_mark=hl_group.mark,
|
||||
problem='group {0} should have at least one gradient color, but it has no'.format(hl_group),
|
||||
problem_mark=group_config.mark
|
||||
)
|
||||
r.append(colorscheme)
|
||||
if not found:
|
||||
pass
|
||||
return r
|
||||
|
||||
|
||||
|
|
|
@ -50,6 +50,8 @@ def finder(pl):
|
|||
$command_t to add them). All Command-T finders have ``CommandT::`` module
|
||||
prefix, but it is stripped out (actually, any ``CommandT::`` substring will
|
||||
be stripped out).
|
||||
|
||||
Highlight groups used: ``commandt:finder``.
|
||||
'''
|
||||
initialize()
|
||||
vim.command('ruby $powerline.commandt_set_active_finder')
|
||||
|
@ -80,6 +82,8 @@ def path(pl):
|
|||
$command_t.active_finder is required in order to omit displaying path for
|
||||
finders ``MRUBufferFinder``, ``BufferFinder``, ``TagFinder`` and
|
||||
``JumpFinder`` (pretty much any finder, except ``FileFinder``).
|
||||
|
||||
Highlight groups used: ``commandt:path``.
|
||||
'''
|
||||
initialize()
|
||||
vim.command('ruby $powerline.commandt_set_active_finder')
|
||||
|
|
Loading…
Reference in New Issue