<div dir="ltr">Keywords highlightings (provided by the editors) are definitely much faster than AST-based ones (which can take minutes in bad cases).<div>Editors highlightings are also much more reliable, i.e. they never "blink".</div><div><br></div><div>IMO one should definitely prefer the editor-based implementation when possible. The semantic highlightings are always much more "sluggish".</div><div><br></div><div>Given that, I think we should prefer to not interfere with the editor highlightings if we can.</div><div><br></div><div>I think we should prefer the failure mode of "editor highlights override as a keyword and clangd will re-highlight as a variable eventually" to "editor does not highlight override until clangd produces highlighting".</div><div>But I can see how other people can have different opinions here.</div><div><br></div><div>Not highlighting 'int' and 'void' in clangd is probably a no-brainer, though.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Oct 25, 2019 at 5:38 PM Duncan P. N. Exon Smith <<a href="mailto:dexonsmith@apple.com">dexonsmith@apple.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Frankly I doubt `final` is tremendously rare as an identifier; it seems similar to `result` as a catch-all variable name.<br>
<br>
> On Oct 25, 2019, at 08:36, Nathan Ridge via clangd-dev <<a href="mailto:clangd-dev@lists.llvm.org" target="_blank">clangd-dev@lists.llvm.org</a>> wrote:<br>
> <br>
> I guess it depends how much one values accuracy :) In Eclipse, for example, we decided we did not want to keyword-highlight "override" as "final" if they occur as identifiers, even if that's rare, so we added them to the semantic coloring engine rather than the lexical one. In the LSP model, that would be a server-side highlighting.<br>
> <br>
> ________________________________________<br>
> From: Ilya Biryukov <<a href="mailto:ibiryukov@google.com" target="_blank">ibiryukov@google.com</a>><br>
> Sent: October 25, 2019 2:31 PM<br>
> To: Nathan Ridge<br>
> Cc: Haojian Wu; via clangd-dev<br>
> Subject: Re: [clangd-dev] Syntax highlighting of keywords<br>
> <br>
> They're rare as identifiers, though, so I don't see why editors wouldn't just always highlight them as keywords.<br>
> <br>
> On Fri, Oct 25, 2019 at 4:30 PM Nathan Ridge <<a href="mailto:zeratul976@hotmail.com" target="_blank">zeratul976@hotmail.com</a><mailto:<a href="mailto:zeratul976@hotmail.com" target="_blank">zeratul976@hotmail.com</a>>> wrote:<br>
> It would be useful if clangd highlighted context-sensitive keywords, such as "override" and "final" (and, in C++20, likely "import" and "module"). Because of their context-sensitivity, clients can't highlight those as easily as hard keywords.<br>
> <br>
> ________________________________________<br>
> From: clangd-dev <<a href="mailto:clangd-dev-bounces@lists.llvm.org" target="_blank">clangd-dev-bounces@lists.llvm.org</a><mailto:<a href="mailto:clangd-dev-bounces@lists.llvm.org" target="_blank">clangd-dev-bounces@lists.llvm.org</a>>> on behalf of Ilya Biryukov via clangd-dev <<a href="mailto:clangd-dev@lists.llvm.org" target="_blank">clangd-dev@lists.llvm.org</a><mailto:<a href="mailto:clangd-dev@lists.llvm.org" target="_blank">clangd-dev@lists.llvm.org</a>>><br>
> Sent: October 25, 2019 9:55 AM<br>
> To: Haojian Wu<br>
> Cc: via clangd-dev<br>
> Subject: Re: [clangd-dev] Syntax highlighting of keywords<br>
> <br>
> Highlighting typedefs to primitive types in a special manner seems ok, I was referring specifically to highlightings of keywords.<br>
> <br>
> So unless anyone objects, I'll send a patch to remove highlightings of keywords. Typedefs to simple types will still be highlighted with 'primitive' highlighting type.<br>
> <br>
> On Fri, Oct 25, 2019 at 10:21 AM Haojian Wu <<a href="mailto:hokein@google.com" target="_blank">hokein@google.com</a><mailto:<a href="mailto:hokein@google.com" target="_blank">hokein@google.com</a>><mailto:<a href="mailto:hokein@google.com" target="_blank">hokein@google.com</a><mailto:<a href="mailto:hokein@google.com" target="_blank">hokein@google.com</a>>>> wrote:<br>
> I agree editors handle keyword highlightings very well, but they don't have sufficient knowledge to highlight typealias/typedefs for primitive types.<br>
> <br>
> // We want to highlight A, B as primitive types.<br>
> using A = int;<br>
> typedef int B;<br>
> <br>
> <br>
> On Fri, Oct 25, 2019 at 9:59 AM Ilya Biryukov <<a href="mailto:ibiryukov@google.com" target="_blank">ibiryukov@google.com</a><mailto:<a href="mailto:ibiryukov@google.com" target="_blank">ibiryukov@google.com</a>><mailto:<a href="mailto:ibiryukov@google.com" target="_blank">ibiryukov@google.com</a><mailto:<a href="mailto:ibiryukov@google.com" target="_blank">ibiryukov@google.com</a>>>> wrote:<br>
> Hi clangd-dev,<br>
> <br>
> I was wondering whether there's any value in the highlighting for "primitive" types being added on keywords like 'void', 'int', etc?<br>
> <br>
> - Any editor handles those with default syntax highlight.<br>
> - It's trivial and does not require actual semantic knowledge.<br>
> <br>
> With that in mind, I wonder whether we should drop this completely and just let the editors handle the keywords?<br>
> What do people think?<br>
> <br>
> --<br>
> Regards,<br>
> Ilya Biryukov<br>
> <br>
> <br>
> --<br>
> Regards,<br>
> Ilya Biryukov<br>
> <br>
> <br>
> --<br>
> Regards,<br>
> Ilya Biryukov<br>
> _______________________________________________<br>
> clangd-dev mailing list<br>
> <a href="mailto:clangd-dev@lists.llvm.org" target="_blank">clangd-dev@lists.llvm.org</a><br>
> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/clangd-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/clangd-dev</a><br>
<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Regards,</div><div>Ilya Biryukov</div></div></div></div></div>