google / vim-coverage

Apache License 2.0
101 stars 22 forks source link

Error showing coverage on modified buffer after :make #11

Open AlexHaxe opened 8 years ago

AlexHaxe commented 8 years ago

I wrote a plugin for Codecov JSON format (see https://github.com/AlexHaxe/vim-codecovjson) and it works fine until I recompile my project (https://github.com/HaxeCheckstyle/haxe-checkstyle), generating new coverage data. Unchanged files still work, but the files that have changed show an error message:

Error detected while processing function coverage#Toggle..<SNR>216_CoverageToggle..<SNR>216_CoverageShow..<SNR>216_RenderFromCache..<SNR>216_ColorSigns:
line    2:
E158: Invalid buffer name: src/checkstyle/token/TokenTreeBuilder.hx
stgpetrovic commented 8 years ago

Hey,

I am thinking we have an issue with the "sign place" command, here: https://github.com/google/vim-coverage/blob/88cab28e2df151089d49eaab30aae0c03291727c/autoload/coverage.vim#L37

sign place has strict requirements about the {fname} param, (:help :sign-fname). Maybe if we used expand('%:p') (absolute path) it would work?

AlexHaxe commented 8 years ago

Using %:p gets rid of the error message. However now after a build I get old / cached coverage data, is there a way to force a reload?

Also it seems that if I toggle Coverage off and then on again it loses info about added or deleted lines.

stgpetrovic commented 8 years ago

The data is saved per-buffer-name, so those would now be two different buffers (relative and absolute paths).

The second part is intended, and what we recommend (and we implement internally in our coverage plugin) is to check whether the file had changed since the last state the coverage is known for, and if so, don't show it.