mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 19:00:11 +01:00
I'm trying to make the LSP look more like the rest of the toolchain. I'm trying to separate the handlers from the transport layer, and remove the multiple inheritance aspect. Also fixing some style issues, switching to `Map`, and removing an unnecessary copt. I'm using `Context` for the central object for consistency with other portions of the toolchain. In order to get the `handle_*` files working, I'm using LLVM's registry class. It has a quirk that I can't register two registries in the same cpp file, so there are two one-line cpp files. In order to help show the delta (or lack thereof) for actual implementation, I've copied server.cpp over handle_* and undone that in two commits. See the third and fourth commits on the PR history for that.
39 lines
1.3 KiB
C++
39 lines
1.3 KiB
C++
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
|
// Exceptions. See /LICENSE for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
#ifndef CARBON_TOOLCHAIN_LANGUAGE_SERVER_HANDLE_H_
|
|
#define CARBON_TOOLCHAIN_LANGUAGE_SERVER_HANDLE_H_
|
|
|
|
#include "toolchain/language_server/context.h"
|
|
|
|
namespace Carbon::LanguageServer {
|
|
|
|
// Stores the content of newly-opened documents.
|
|
auto HandleDidChangeTextDocument(
|
|
Context& context, const clang::clangd::DidChangeTextDocumentParams& params)
|
|
-> void;
|
|
|
|
// Updates the content of already-open documents.
|
|
auto HandleDidOpenTextDocument(
|
|
Context& context, const clang::clangd::DidOpenTextDocumentParams& params)
|
|
-> void;
|
|
|
|
// Provides information about document symbols.
|
|
auto HandleDocumentSymbol(
|
|
Context& context, const clang::clangd::DocumentSymbolParams& params,
|
|
llvm::function_ref<
|
|
void(llvm::Expected<std::vector<clang::clangd::DocumentSymbol>>)>
|
|
on_done) -> void;
|
|
|
|
// Tells the client what features are supported.
|
|
auto HandleInitialize(
|
|
Context& /*context*/,
|
|
const clang::clangd::NoParams& /*client_capabilities*/,
|
|
llvm::function_ref<void(llvm::Expected<llvm::json::Object>)> on_done)
|
|
-> void;
|
|
|
|
} // namespace Carbon::LanguageServer
|
|
|
|
#endif // CARBON_TOOLCHAIN_LANGUAGE_SERVER_HANDLE_H_
|