This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Cleanup: stop passing around list of supported URI schemes.
ClosedPublic

Authored by ioeric on Nov 21 2018, 7:27 AM.

Details

Summary

Instead of passing around a list of supported URI schemes in clangd, we
expose an interface to convert a path to URI using any compatible scheme
that has been registered. It favors customized schemes and falls
back to "file" when no other scheme works.

Changes in this patch are:

  • URI::create(AbsPath, URISchemes) -> URI::create(AbsPath). The new API finds a

compatible scheme from the registry.

  • Remove URISchemes option everywhere (ClangdServer, SymbolCollecter, FileIndex etc).
  • Unit tests will use "unittest" by default.
  • Move "test" scheme from ClangdLSPServer to ClangdMain.cpp, and only

register the test scheme when lit-test or enable-lit-scheme is set.
(The new flag is added to make lit protocol.test work; I wonder if there
is alternative here.)

Diff Detail

Event Timeline

ioeric created this revision.Nov 21 2018, 7:27 AM
ioeric updated this revision to Diff 174929.Nov 21 2018, 7:28 AM
  • remove unused include
sammccall accepted this revision.Nov 22 2018, 2:39 AM

Awesome!

clangd/URI.cpp
202

for (auto& Entry : URISchemeRegistry::entries())

clangd/tool/ClangdMain.cpp
93

EnableTestScheme

should the flag include "uri"?

test/clangd/did-change-configuration-params.test
6 ↗(On Diff #174929)

what's up with this change? :-)

This revision is now accepted and ready to land.Nov 22 2018, 2:39 AM
ioeric updated this revision to Diff 175048.Nov 22 2018, 6:47 AM
ioeric marked 3 inline comments as done.
  • address review comments
This revision was automatically updated to reflect the committed changes.