This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Use workspace root path as hint path for resolving URIs in workspace/symbol
ClosedPublic

Authored by ioeric on Jun 18 2018, 10:43 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

ioeric created this revision.Jun 18 2018, 10:43 AM
sammccall added inline comments.Jun 19 2018, 1:05 AM
clangd/ClangdServer.cpp
119 ↗(On Diff #151749)

why validate it?

clangd/FindSymbols.h
30 ↗(On Diff #151749)

Change to HintPath? There's no reason to couple this code to the fact that it's the workspace root in clangdserver.

30 ↗(On Diff #151749)

you sometimes pass "" here, so we should document the semantics of that

unittests/clangd/TestFS.cpp
70 ↗(On Diff #151749)

is a path relative to testRoot()

93 ↗(On Diff #151749)

why this change?

ioeric updated this revision to Diff 151869.Jun 19 2018, 2:00 AM
ioeric marked 3 inline comments as done.
  • Address review comments
clangd/ClangdServer.cpp
119 ↗(On Diff #151749)

This is the current behavior, except llvm::sys::fs::is_directory only works for real file system.

unittests/clangd/TestFS.cpp
93 ↗(On Diff #151749)

The consume_front above would not consume the second slash in /clangd-test/x.h which results in "/x.h" in the body, but that doesn't work with testPath() which requires a relative path. That's why I added a requirement that the body should be relative path.

sammccall accepted this revision.Jun 19 2018, 2:28 AM
sammccall added inline comments.
unittests/clangd/TestFS.cpp
93 ↗(On Diff #151749)

can we switch back to that path being represented by unittest:/x.h rather than unittest:x.h?
That looks more like the URI schemes we use in practice.

This revision is now accepted and ready to land.Jun 19 2018, 2:28 AM
ioeric updated this revision to Diff 151877.Jun 19 2018, 2:37 AM
  • Require '/' in front of unittest: body
This revision was automatically updated to reflect the committed changes.