question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Syntax colors config doesn't work

See original GitHub issue

Description

Syntax colors config in .~/config/pgcli/config doesn’t work

# Syntax Style. Possible values: manni, igor, xcode, vim, autumn, vs, rrt,
# native, perldoc, borland, tango, emacs, friendly, monokai, paraiso-dark,
# colorful, murphy, bw, pastie, paraiso-light, trac, default, fruity
syntax_style = <color scheme>

I changed the value of syntax_style but the syntax color in pgcli is always the same as “default” in https://www.pgcli.com/syntax

Your environment

Ubuntu 20.10 Server: PostgreSQL 12.4 (Ubuntu 12.4-1) Version: 3.0.0 pgcli @ git+https://github.com/dbcli/pgcli@7626d9a5f27a221d87f31dcb5bb8fc12024f6c58f57829411793929a7a installed via git Pygments==2.7.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
drselump14commented, Jan 21, 2021

Same issue here 🤚

1reaction
petobenscommented, Dec 19, 2020

I’m having the same problem. This is my config:

# vi: ft=dosini
[main]

# Enables context sensitive auto-completion. If this is disabled the all
# possible completions will be listed.
smart_completion = True

# Display the completions in several columns. (More completions will be
# visible.)
wider_completion_menu = False

# Multi-line mode allows breaking up the sql statements into multiple lines. If
# this is set to True, then the end of the statements must have a semi-colon.
# If this is set to False then sql statements can't be split into multiple
# lines. End of line (return) is considered as the end of the statement.
multi_line = True

# If multi_line_mode is set to "psql", in multi-line mode, [Enter] will execute
# the current input if the input ends in a semicolon.
# If multi_line_mode is set to "safe", in multi-line mode, [Enter] will always
# insert a newline, and [Esc] [Enter] or [Alt]-[Enter] must be used to execute
# a command.
multi_line_mode = psql

# Destructive warning mode will alert you before executing a sql statement
# that may cause harm to the database such as "drop table", "drop database"
# or "shutdown".
destructive_warning = True

# Enables expand mode, which is similar to `\x` in psql.
expand = False

# Enables auto expand mode, which is similar to `\x auto` in psql.
auto_expand = False

# If set to True, table suggestions will include a table alias
generate_aliases = False

# log_file location.
# In Unix/Linux: ~/.config/pgcli/log
# In Windows: %USERPROFILE%\AppData\Local\dbcli\pgcli\log
# %USERPROFILE% is typically C:\Users\{username}
log_file = default

# keyword casing preference. Possible values "lower", "upper", "auto"
keyword_casing = upper

# casing_file location.
# In Unix/Linux: ~/.config/pgcli/casing
# In Windows: %USERPROFILE%\AppData\Local\dbcli\pgcli\casing
# %USERPROFILE% is typically C:\Users\{username}
casing_file = default

# If generate_casing_file is set to True and there is no file in the above
# location, one will be generated based on usage in SQL/PLPGSQL functions.
generate_casing_file = False

# Casing of column headers based on the casing_file described above
case_column_headers = True

# history_file location.
# In Unix/Linux: ~/.config/pgcli/history
# In Windows: %USERPROFILE%\AppData\Local\dbcli\pgcli\history
# %USERPROFILE% is typically C:\Users\{username}
history_file = default

# Default log level. Possible values: "CRITICAL", "ERROR", "WARNING", "INFO"
# and "DEBUG". "NONE" disables logging.
log_level = INFO

# Order of columns when expanding * to column list
# Possible values: "table_order" and "alphabetic"
asterisk_column_order = table_order

# Whether to qualify with table alias/name when suggesting columns
# Possible values: "always", never" and "if_more_than_one_table"
qualify_columns = if_more_than_one_table

# When no schema is entered, only suggest objects in search_path
search_path_filter = False

# Default pager.
# By default 'PAGER' environment variable is used
# pager = less -SRXF

# Timing of sql statments and table rendering.
timing = True

# Table format. Possible values: psql, plain, simple, grid, fancy_grid, pipe,
# ascii, double, github, orgtbl, rst, mediawiki, html, latex, latex_booktabs,
# textile, moinmoin, jira, vertical, tsv, csv.
# Recommended: psql, fancy_grid and grid.
table_format = psql

# Syntax Style. Possible values: manni, igor, xcode, vim, autumn, vs, rrt,
# native, perldoc, borland, tango, emacs, friendly, monokai, paraiso-dark,
# colorful, murphy, bw, pastie, paraiso-light, trac, default, fruity
syntax_style = onedarkish

# Keybindings:
# When Vi mode is enabled you can use modal editing features offered by Vi in the REPL.
# When Vi mode is disabled emacs keybindings such as Ctrl-A for home and Ctrl-E
# for end are available in the REPL.
vi = False

# Error handling
# When one of multiple SQL statements causes an error, choose to either
# continue executing the remaining statements, or stopping
# Possible values "STOP" or "RESUME"
on_error = STOP

# Set threshold for row limit prompt. Use 0 to disable prompt.
row_limit = 1000

# Skip intro on startup and goodbye on exit
less_chatty = False

# Postgres prompt
# \t - Current date and time
# \u - Username
# \h - Short hostname of the server (up to first '.')
# \H - Hostname of the server
# \d - Database name
# \p - Database port
# \i - Postgres PID
# \# - "@" sign if logged in as superuser, '>' in other case
# \n - Newline
# \dsn_alias - name of dsn alias if -D option is used (empty otherwise)
prompt = '\u@\h:\d> '

# Number of lines to reserve for the suggestion menu
min_num_menu_lines = 4

# Character used to left pad multi-line queries to match the prompt size.
multiline_continuation_char = ''

# The string used in place of a null value.
null_string = '<null>'

# manage pager on startup
enable_pager = True

# Use keyring to automatically save and load password in a secure manner
keyring = True

# Custom colors for the completion menu, toolbar, etc.
[colors]
completion-menu.completion.current = 'bg:#61afef #24272e'
completion-menu.completion = 'bg:#333841 #abb2bf'
completion-menu.meta.completion.current = 'bg:#61afef #24272e'
completion-menu.meta.completion = 'bg:#333841 #abb2bf'
completion-menu.multi-column-meta = 'bg:#333841 #abb2bf'
scrollbar.arrow = 'bg:#333841 #abb2bf'
scrollbar = 'bg:#333841 #abb2bf'
selected = '#ffffff bg:#6666aa'
search = '#ffffff bg:#4444aa'
search.current = '#ffffff bg:#44aa44'
bottom-toolbar = 'bg:#282c34 #abb2bf'
bottom-toolbar.off = 'bg:#282c34 #5c6370'
bottom-toolbar.on = 'bg:#282c34 #abb2bf'
search-toolbar = 'noinherit bold'
search-toolbar.text = 'nobold'
system-toolbar = 'noinherit bold'
arg-toolbar = 'noinherit bold'
arg-toolbar.text = 'nobold'
bottom-toolbar.transaction.valid = 'bg:#222222 #00ff5f bold'
bottom-toolbar.transaction.failed = 'bg:#222222 #ff005f bold'

# style classes for colored table output
output.header = "bold"
output.odd-row = ""
output.even-row = ""

# Named queries are queries you can execute by name.
[named queries]

# DSN to call by -D option
[alias_dsn]
# example_dsn = postgresql://[user[:password]@][netloc][:port][/dbname]

# Format for number representation
# for decimal "d" - 12345678, ",d" - 12,345,678
# for float "g" - 123456.78, ",g" - 123,456.78
[data_formats]
decimal = ""
float = ""

Where onedarkish is defined as:

from pygments.style import Style
from pygments.token import (
    Comment,
    Error,
    Keyword,
    Literal,
    Name,
    Number,
    Operator,
    String,
    Text,
)

white = '#abb2bf'
mono_2 = '#828997'
comment_grey = '#5c6370'
mono_4 = '#4b5263'
cyan = '#56b6c2'
light_blue = '#61afef'
blue = '#528bff'
purple = '#c678dd'
green = '#98c379'
red = '#e06c75'
dark_red = '#be5046'
dark_yellow = '#d19a66'
yellow = '#e5c07b'
black = '#24272e'
cursor_grey = '#282c34'
gutter_fg_grey = '#636d83'
special_grey = '#3b4048'
visual_grey = '#3e4452'
pmenu = '#333841'
syntax_fg = white
syntax_fold_bg = comment_grey


class OnedarkishStyle(Style):
    default_style = ''

    styles = {
        Text: syntax_fg,
        Error: red,
        Comment: comment_grey,
        Keyword: f'{purple} nobold',
        Keyword.Constant: green,
        Keyword.Namespace: purple,
        Name.Namespace: f'{syntax_fg} nobold',
        Name.Builtin: yellow,
        Name.Function: light_blue,
        Name.Class: f'{light_blue} nobold',
        Name.Decorator: light_blue,
        Name.Exception: yellow,
        Number: dark_yellow,
        Operator: purple,
        Operator.Word: f'{purple} nobold',
        Literal: green,
        Literal.String.Doc: f'{green} noitalic',
        Literal.String.Interpol: f'{light_blue} nobold',
        Literal.String.Escape: f'{light_blue} nobold',
        String: green,
    }

The log simply shows:

2020-12-19 12:43:28,689 (1137531/MainThread) pgcli.main INFO - No default pager found in environment. Using os default pager
2020-12-19 12:43:28,690 (1137531/MainThread) pgcli.main WARNING - import keyring failed: ModuleNotFoundError("No module named 'keyring'").

I triedu using some of the native colorschems (i.e xcode, vim) and none of them work.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Highlighting config not working well · Issue #37 - GitHub
Hi there, I've noticed that "Highlighting config" doesn't work well to be able to highlight the code when we use It does not...
Read more >
Syntax highlighting doesn't work after adding a file ... - YouTrack
Syntax highlighting doesn't work after adding a file and manually setting the PHP extension. From the project tab, if I right click in...
Read more >
Vim Syntax Highlighting does not work - Stack Overflow
Another reason syntax highlighting won't work is you might have a theme/colorscheme set that VIM cannot find.
Read more >
Turn On or Off Color Syntax Highlighting In vim Editor - nixCraft
Describes how to turn on or off color syntax highlighter option under vim text editor running on a Linux, macOS, BSD and Unix-like...
Read more >
Color syntax highlighting working on one system but not the ...
Here is the full nanorc file on pastebin.com. configuration · editors · syntax-highlighting · nano · rc · Share.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found