This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Downrank symbols with reserved names (score *= 0.1)
ClosedPublic

Authored by sammccall on Jun 4 2018, 4:59 AM.

Diff Detail

Event Timeline

sammccall created this revision.Jun 4 2018, 4:59 AM
sammccall updated this revision to Diff 149732.Jun 4 2018, 5:01 AM

Forgot to add to debug string.

Is there a way to only downrank them if the query does not start with _? That would cover the cases when I do want the symbols starting with underscore.

Is there a way to only downrank them if the query does not start with _? That would cover the cases when I do want the symbols starting with underscore.

This is hard for a few reasons:

  • LSP's filter-in-the-editor isn't designed for this kind of case: once the server fails to return a result, it's basically gone
  • a remote index now has to know the details of this scoring function (this is true of most things that are querystring-dependent)

This is a problem though. Added a couple of FIXMEs and will ponder a bit.

sammccall updated this revision to Diff 149735.Jun 4 2018, 5:34 AM

FIXMEs pertaining to queries beginning with _, and standard _Names

After chatting offline: a FIXME mentioning some special cases seems enough here, we do improve the results in most cases (i.e. for queries that don't start with an underscore).

Another NIT:
Maybe we could add unittests for names that start with underscore, but are not considered reserved by our implementation?
I'm thinking about "_" and "_non_upper_case_leading_char".

sammccall updated this revision to Diff 150115.Jun 6 2018, 5:25 AM

Add test that _f isn't a reserved name.

@ilya-biryukov Ping, anything left for me to do here?

ilya-biryukov accepted this revision.Jun 8 2018, 2:13 AM

LGTM, sorry for the delay

This revision is now accepted and ready to land.Jun 8 2018, 2:13 AM
This revision was automatically updated to reflect the committed changes.