mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Add stdin to driver's streams, and refactor stream passing (#4812)
The language server needs stdin, and for tests we should be passing it around. My intent is to pass in a faux stdin to Driver for language server tests. As long as I'm adding a new parameter, I was looking at also changing the way streams are passed in to Driver for style (pointers since they're held past construction lifetime). Since these are all stored in DriverEnv, I thought it might be a net improvement to use the struct directly, getting more explicit parameter names and also removing the need for `SetFuzzing`. I'm trying here to avoid functional changes, but there are a couple additional fixes like removing an obsolete `find_insensitive` and refactoring how `ValidateOptions` handles errors (because it reduces the number of spots that operate on error_stream).
This commit is contained in:
@@ -13,14 +13,15 @@
|
||||
|
||||
namespace Carbon::LanguageServer {
|
||||
|
||||
auto Run(std::FILE* input_stream, llvm::raw_ostream& output_stream)
|
||||
-> ErrorOr<Success> {
|
||||
auto Run(FILE* input_stream, llvm::raw_ostream& output_stream,
|
||||
llvm::raw_ostream& /*error_stream*/) -> ErrorOr<Success> {
|
||||
// Set up the connection.
|
||||
std::unique_ptr<clang::clangd::Transport> transport(
|
||||
clang::clangd::newJSONTransport(input_stream, output_stream,
|
||||
/*InMirror=*/nullptr,
|
||||
/*Pretty=*/true));
|
||||
Context context;
|
||||
// TODO: Use error_stream in IncomingMessages to report dropped errors.
|
||||
IncomingMessages incoming(transport.get(), &context);
|
||||
OutgoingMessages outgoing(transport.get());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user