handle.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. #ifndef CARBON_TOOLCHAIN_LANGUAGE_SERVER_HANDLE_H_
  5. #define CARBON_TOOLCHAIN_LANGUAGE_SERVER_HANDLE_H_
  6. #include "clang-tools-extra/clangd/Protocol.h"
  7. #include "toolchain/language_server/context.h"
  8. namespace Carbon::LanguageServer {
  9. // Stores the content of newly-opened documents.
  10. auto HandleDidChangeTextDocument(
  11. Context& context, const clang::clangd::DidChangeTextDocumentParams& params)
  12. -> void;
  13. // Closes a document.
  14. auto HandleDidCloseTextDocument(
  15. Context& context, const clang::clangd::DidCloseTextDocumentParams& params)
  16. -> void;
  17. // Updates the content of already-open documents.
  18. auto HandleDidOpenTextDocument(
  19. Context& context, const clang::clangd::DidOpenTextDocumentParams& params)
  20. -> void;
  21. // Provides information about document symbols.
  22. auto HandleDocumentSymbol(
  23. Context& context, const clang::clangd::DocumentSymbolParams& params,
  24. llvm::function_ref<
  25. auto(llvm::Expected<std::vector<clang::clangd::DocumentSymbol>>)->void>
  26. on_done) -> void;
  27. // Tells the client what features are supported.
  28. auto HandleInitialize(
  29. Context& /*context*/,
  30. const clang::clangd::NoParams& /*client_capabilities*/,
  31. llvm::function_ref<auto(llvm::Expected<llvm::json::Object>)->void> on_done)
  32. -> void;
  33. // Prepares LSP for shutdown.
  34. auto HandleShutdown(
  35. Context& /*context*/,
  36. const clang::clangd::NoParams& /*client_capabilities*/,
  37. llvm::function_ref<auto(llvm::Expected<std::nullptr_t>)->void> on_done)
  38. -> void;
  39. } // namespace Carbon::LanguageServer
  40. #endif // CARBON_TOOLCHAIN_LANGUAGE_SERVER_HANDLE_H_