Skip to content

hook for custom VFS in SourceKit #24708

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 15, 2019

Conversation

marcrasi
Copy link

(working on upstreaming this in #24417; this PR is to get it into tensorflow so that we can start using it internally)

Defines a FileSystemProvider interface that can be used to implement custom filesystems.

Defines a SourceKit::addFileSystemProvider method, which is to be called after sourcekitd_initialize(), that registers new providers in the global context.

Modifies editoropen, cursorinfo, and codecomplete requests to accept new optional key.vfs.name and key.vfs.args parameters. If key.vfs.name is defined, then SourceKit asks the FileSystemProvider registered under that name to provide a filesystem. (The FileSystemProvider receives the string array key.vfs.args, so that the requester can pass context to the custom filesystem.) SourceKit then uses the returned filesystem throughout the request.

Includes tests for all the requests.

@marcrasi marcrasi requested a review from burmako May 11, 2019 01:09
Copy link

@burmako burmako left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work on a very important practical problem! This was clearly a result of a thoughtful investigation, careful design and thorough execution. I am super happy that we didn't need to resort to hacks to support this functionality.

@marcrasi
Copy link
Author

I'm going to do a small refactoring that will address a few of your comments about function signatures:

  • I will remove all the default arguments (though I will make overloads for CompilerInstance::setup, SwiftASTManager::getInvocation, and SwiftASTManager::initCompilerInvocation that allow existing callers to work unchanged, because each of those has a huge number of existing callers that would be better to deal with incrementally as we add VFS to more types of requests.)
  • I will require the FileSystem parameter to always be non-nullptr, and assert that it's non-nullptr.
  • I will put the FileSystem parameter second-to-last whenever there is an output Error parameter, or a callback parameter, because it seems to be the convention that those parameters should always be last.

@marcrasi marcrasi force-pushed the vfs-in-tensorflow-branch branch from 3506662 to 39bdcad Compare May 14, 2019 22:00
@marcrasi
Copy link
Author

@swift-ci please test tensorflow

1 similar comment
@marcrasi
Copy link
Author

@swift-ci please test tensorflow

@marcrasi
Copy link
Author

@swift-ci please test tensorflow

4 similar comments
@marcrasi
Copy link
Author

@swift-ci please test tensorflow

@marcrasi
Copy link
Author

@swift-ci please test tensorflow

@marcrasi
Copy link
Author

@swift-ci please test tensorflow

@marcrasi
Copy link
Author

@swift-ci please test tensorflow

@marcrasi
Copy link
Author

@swift-ci please test tensorflow

8 similar comments
@marcrasi
Copy link
Author

@swift-ci please test tensorflow

@marcrasi
Copy link
Author

@swift-ci please test tensorflow

@marcrasi
Copy link
Author

@swift-ci please test tensorflow

@marcrasi
Copy link
Author

@swift-ci please test tensorflow

@marcrasi
Copy link
Author

@swift-ci please test tensorflow

@marcrasi
Copy link
Author

@swift-ci please test tensorflow

@marcrasi
Copy link
Author

@swift-ci please test tensorflow

@marcrasi
Copy link
Author

@swift-ci please test tensorflow

@marcrasi marcrasi merged commit f641a58 into swiftlang:tensorflow May 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants