mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 15:41:04 +01:00
Add a framework for LSP testing. (#4841)
Also adds tests for exit and initialize, just basic things.
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "clang-tools-extra/clangd/LSPBinder.h"
|
||||
#include "clang-tools-extra/clangd/Transport.h"
|
||||
#include "clang-tools-extra/clangd/support/Logger.h"
|
||||
#include "common/raw_string_ostream.h"
|
||||
#include "toolchain/language_server/context.h"
|
||||
#include "toolchain/language_server/incoming_messages.h"
|
||||
@@ -14,7 +15,12 @@
|
||||
namespace Carbon::LanguageServer {
|
||||
|
||||
auto Run(FILE* input_stream, llvm::raw_ostream& output_stream,
|
||||
llvm::raw_ostream& /*error_stream*/) -> ErrorOr<Success> {
|
||||
llvm::raw_ostream& error_stream) -> ErrorOr<Success> {
|
||||
// TODO: Consider implementing a custom logger that splits vlog to
|
||||
// vlog_stream when provided. For now, this disables verbose logging.
|
||||
clang::clangd::StreamLogger logger(error_stream, clang::clangd::Logger::Info);
|
||||
clang::clangd::LoggingSession logging_session(logger);
|
||||
|
||||
// Set up the connection.
|
||||
std::unique_ptr<clang::clangd::Transport> transport(
|
||||
clang::clangd::newJSONTransport(input_stream, output_stream,
|
||||
|
||||
Reference in New Issue
Block a user