add custom fs to editor.open and cursorinfo

This commit is contained in:
Marc Rasi
2019-05-02 15:12:28 -07:00
parent ed3a8ec6fc
commit 7e15723805
11 changed files with 196 additions and 100 deletions

View File

@@ -1611,6 +1611,7 @@ static void resolveRange(SwiftLangSupport &Lang,
void SwiftLangSupport::getCursorInfo(
StringRef InputFile, unsigned Offset, unsigned Length, bool Actionables,
bool CancelOnSubsequentRequest, ArrayRef<const char *> Args,
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FileSystem,
std::function<void(const RequestResult<CursorInfoData> &)> Receiver) {
if (auto IFaceGenRef = IFaceGenContexts.get(InputFile)) {
@@ -1644,7 +1645,8 @@ void SwiftLangSupport::getCursorInfo(
}
std::string Error;
SwiftInvocationRef Invok = ASTMgr->getInvocation(Args, InputFile, Error);
SwiftInvocationRef Invok =
ASTMgr->getInvocation(Args, InputFile, Error, FileSystem);
if (!Invok) {
LOG_WARN_FUNC("failed to create an ASTInvocation: " << Error);
Receiver(RequestResult<CursorInfoData>::fromError(Error));
@@ -1846,6 +1848,7 @@ resolveCursorFromUSR(SwiftLangSupport &Lang, StringRef InputFile, StringRef USR,
void SwiftLangSupport::getCursorInfoFromUSR(
StringRef filename, StringRef USR, bool CancelOnSubsequentRequest,
ArrayRef<const char *> Args,
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FileSystem,
std::function<void(const RequestResult<CursorInfoData> &)> Receiver) {
if (auto IFaceGenRef = IFaceGenContexts.get(filename)) {
LOG_WARN_FUNC("Info from usr for generated interface not implemented yet.");
@@ -1857,6 +1860,7 @@ void SwiftLangSupport::getCursorInfoFromUSR(
std::string Error;
SwiftInvocationRef Invok = ASTMgr->getInvocation(Args, filename, Error);
ASTMgr->getInvocation(Args, filename, Error, FileSystem);
if (!Invok) {
LOG_WARN_FUNC("failed to create an ASTInvocation: " << Error);
Receiver(RequestResult<CursorInfoData>::fromError(Error));