Skip to content

Commit

Permalink
initialize: implement serverInfo (LSP 3.15.0)
Browse files Browse the repository at this point in the history
Return serverInfo for an initialize request. This helps clients to
identify ccls even when they just connect to a TCP port and allows them
to easily implement server specific functionalities like $ccls/navigate.
  • Loading branch information
nemethf authored and MaskRay committed Nov 11, 2019
1 parent 468a2fb commit bd609e8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -240,3 +240,5 @@ endif()

set_property(SOURCE src/main.cc APPEND PROPERTY
COMPILE_DEFINITIONS CCLS_VERSION=\"${CCLS_VERSION}\")
set_property(SOURCE src/messages/initialize.cc APPEND PROPERTY
COMPILE_DEFINITIONS CCLS_VERSION=\"${CCLS_VERSION}\")
7 changes: 6 additions & 1 deletion src/messages/initialize.cc
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,13 @@ REFLECT_STRUCT(InitializeParam, rootUri, capabilities, trace, workspaceFolders);

struct InitializeResult {
ServerCap capabilities;
struct ServerInfo {
const char *name = "ccls";
const char *version = CCLS_VERSION;
} serverInfo;
};
REFLECT_STRUCT(InitializeResult, capabilities);
REFLECT_STRUCT(InitializeResult::ServerInfo, name, version);
REFLECT_STRUCT(InitializeResult, capabilities, serverInfo);

struct FileSystemWatcher {
std::string globPattern = "**/*";
Expand Down

0 comments on commit bd609e8

Please sign in to comment.