o Replace the existing clangd::URI with a wrapper of FileURI which also
carries a resolved file path.
o s/FileURI/URI/
Details
Diff Detail
- Repository
- rCTE Clang Tools Extra
Event Timeline
| clangd/ClangdLSPServer.cpp | ||
|---|---|---|
| 283 | hmm, I think you want to replyerror for unexpected cases. if (ResultUri) {
if (auto U = URI::create(*Result))
reply(C, U->toString());
else
replyError(C, ErrorCode::InternalError, llvm::toString(U.takeError()));
} else
reply(C, ""); | |
| 284 | But basically I think this shows that the API is awkward. We should have a way to create a file URI from an absolute path that asserts rather than returning expected. | |
| clangd/Protocol.h | ||
| 51 | URIForFile? "withfile" doesn't really capture that they're related | |
| 51 | Hmm actually, what about just struct URIForFile { std:string AbsPath; } This also gives us the usual easy null state. | |
| clangd/URI.h | ||
| 32 | Does the struct-with-just-an-abspath idea address this? | |
| 43 | oh, sorry I missed this in the first code review... Can you change the first to be a constructor and just assert on the needed invariants? | |
Can you also remove the URI-encoding hack from the VSCode client?
| clangd/Protocol.cpp | ||
|---|---|---|
| 35 | I think you can just check that the scheme is file and pull out the path? | |
hmm, I think you want to replyerror for unexpected cases.
maybe:
if (ResultUri) { if (auto U = URI::create(*Result)) reply(C, U->toString()); else replyError(C, ErrorCode::InternalError, llvm::toString(U.takeError())); } else reply(C, "");