handle_shutdown.cpp 825 B

12345678910111213141516171819202122
  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 "toolchain/language_server/handle.h"
  5. namespace Carbon::LanguageServer {
  6. auto HandleShutdown(
  7. Context& /*context*/,
  8. const clang::clangd::NoParams& /*client_capabilities*/,
  9. llvm::function_ref<auto(llvm::Expected<std::nullptr_t>)->void> on_done)
  10. -> void {
  11. // TODO: Track that `shutdown` was called, and:
  12. // - Warn on duplicate calls.
  13. // - Make `exit` return `1` if `shutdown` wasn't called.
  14. // https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#exit
  15. // - Error on other post-`shutdown` calls.
  16. on_done(nullptr);
  17. }
  18. } // namespace Carbon::LanguageServer