mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +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.
27 lines
792 B
C++
27 lines
792 B
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_CONTEXT_H_
|
|
#define CARBON_TOOLCHAIN_LANGUAGE_SERVER_CONTEXT_H_
|
|
|
|
#include "clang-tools-extra/clangd/Protocol.h"
|
|
#include "clang-tools-extra/clangd/support/Function.h"
|
|
#include "common/map.h"
|
|
|
|
namespace Carbon::LanguageServer {
|
|
|
|
// Context for LSP call handling.
|
|
class Context {
|
|
public:
|
|
auto files() -> Map<std::string, std::string>& { return files_; }
|
|
|
|
private:
|
|
// Content of files managed by the language client.
|
|
Map<std::string, std::string> files_;
|
|
};
|
|
|
|
} // namespace Carbon::LanguageServer
|
|
|
|
#endif // CARBON_TOOLCHAIN_LANGUAGE_SERVER_CONTEXT_H_
|