handle.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. // Updates the content of already-open documents.
  14. auto HandleDidOpenTextDocument(
  15. Context& context, const clang::clangd::DidOpenTextDocumentParams& params)
  16. -> void;
  17. // Provides information about document symbols.
  18. auto HandleDocumentSymbol(
  19. Context& context, const clang::clangd::DocumentSymbolParams& params,
  20. llvm::function_ref<
  21. void(llvm::Expected<std::vector<clang::clangd::DocumentSymbol>>)>
  22. on_done) -> void;
  23. // Tells the client what features are supported.
  24. auto HandleInitialize(
  25. Context& /*context*/,
  26. const clang::clangd::NoParams& /*client_capabilities*/,
  27. llvm::function_ref<void(llvm::Expected<llvm::json::Object>)> on_done)
  28. -> void;
  29. } // namespace Carbon::LanguageServer
  30. #endif // CARBON_TOOLCHAIN_LANGUAGE_SERVER_HANDLE_H_