[PATCH] D75604: [clangd] Round WorkDoneProgressBegin.percentage down

Kirill Bobyrev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 5 01:09:01 PST 2020


kbobyrev abandoned this revision.
kbobyrev marked an inline comment as done.
kbobyrev added inline comments.


================
Comment at: clang-tools-extra/clangd/ClangdLSPServer.cpp:1409
                           (Stats.Enqueued - Stats.LastIdle);
+      // Round down to 2 decimal places for readability.
+      Report.percentage = std::floor(*Report.percentage * 100.0) / 100.0;
----------------
sammccall wrote:
> Yikes, rounding a float value in the protocol is pretty weird and would deserve more of a comment.
> 
> Also this seems like a fairly... improbable bug, in that it's trivial to fix in the editor and would usually be visible if the implementer tried the feature even once.
> 
> Which editors specifically are you seeing bad display in? Can we just send them a PR?
Okay, makes sense. I saw this in coc.nvim and I can just fix it there, but I thought it might also happen in other editors. I also thought we do not care too much about precision here, but I'm OK with fixing it on the editor side.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75604/new/

https://reviews.llvm.org/D75604





More information about the cfe-commits mailing list