handle_shutdown.cpp 845 B

123456789101112131415161718192021222324
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. #include <cstddef>
  5. #include "toolchain/language_server/handle.h"
  6. namespace Carbon::LanguageServer {
  7. auto HandleShutdown(
  8. Context& /*context*/,
  9. const clang::clangd::NoParams& /*client_capabilities*/,
  10. llvm::function_ref<auto(llvm::Expected<std::nullptr_t>)->void> on_done)
  11. -> void {
  12. // TODO: Track that `shutdown` was called, and:
  13. // - Warn on duplicate calls.
  14. // - Make `exit` return `1` if `shutdown` wasn't called.
  15. // https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#exit
  16. // - Error on other post-`shutdown` calls.
  17. on_done(nullptr);
  18. }
  19. } // namespace Carbon::LanguageServer