arakashic / chromatica.nvim

Clang based syntax highlighting for Neovim
MIT License
300 stars 17 forks source link

Chromatica works poorly with Solarized Color Scheme #50

Open kirillbobyrev opened 6 years ago

kirillbobyrev commented 6 years ago

Hi! I've tried to setup Chromatica with my vim-colors-solarized colorscheme setup and noticed major issues:

Here is my nvim config, I only added two lines where appropriate:

Plug 'arakashic/chromatica.nvim'

and

let g:chromatica#libclang_path = '/usr/lib/libclang.so'

I also attached the screenshot. Left pane: colorscheme solarized enabled, chromatica enabled, middle pane: colorscheme solarized disabled, chromatica enabled, right pane: colorscheme solarized enabled, chromatica disabled.

chromatica

arakashic commented 6 years ago

Can you post the output of running ChromaticaShowInfo and the chromatica.log generated after running ChromaticaEnableLog.

From the first look of you screenshot, I think Chromatica may not correctly parsed your code (since using namespace std; is not correctly highlighted).

kirillbobyrev commented 6 years ago

Ah, okay, yes there is a syntax error indeed (missing ';' after struct).

:ChromaticaShowInfo:

[chromatica] libclang file: /usr/lib/libclang.so
[chromatica] Filename: /home/omtcvxyz/dev/contests/D.cpp
[chromatica] Filetype: cpp
[chromatica] .clang file: None
[chromatica] Compilation Database:
[chromatica] Compile Flags: -std=c++14
[chromatica] .clang File Search Path:
Error detected while processing function chromatica#show_info:
line    3:
error caught in request handler 'chromatica_show_info [{'bufnr': 1, 'filename': '/home/omtcvxyz/dev/contests/D.cpp', 'changedtick': 3, 'position': [1, 1], 'highlight_tick': 0, 'range': [1, 70]}]':
Traceback (most recent call last):
  File "/home/omtcvxyz/.local/share/nvim/plugged/chromatica.nvim/rplugin/python3/chromatica/__init__.py", line 73, in show_info
    self.__chromatica.show_info(context)
  File "/home/omtcvxyz/.local/share/nvim/plugged/chromatica.nvim/rplugin/python3/chromatica/chromatica.py", line 284, in show_info
    if "error" in self.ctx[filename]:
KeyError: '/home/omtcvxyz/dev/contests/D.cpp'

Log: chromatica.log

Given that it did not compile, I was expecting Chromatica to still work (since Clang is able to parse the code and suggest two modifications making it valid anyway, there are few other tools like include-fixer which operate on broken TU). However, there are other examples which seem strange to me:

clangd

So, this one compiles just fine using the compile commands specified somewhere (verified using :ChromaticaShowInfo). However, there still are some things looking pretty weird:

I'm not an experienced Chromatica user, but this seems like some inconsistency.

arakashic commented 6 years ago

Is it okay for you to upload this D.cpp? I would like to try to reproduce the problem on my side. The exception in :ChromaticaShowInfo is unexpected.

kirillbobyrev commented 6 years ago

@arakashic Yes, sure. That was a bit messy (because that's a code from a Codeforces contest problem solution) so I decided to omit it in the Issue.

I have fixed one compilation error, but I don't remember which one. I tried to find it in my screenshot (which shows the whole source file) but was unable to find it quickly enough.

https://pastebin.com/v857RGr1

arakashic commented 6 years ago

Thanks. I can reproduce the problem now. I will figure out what went wrong.