From 26829640394b13cb6ae629e69a4ef16f65b555e9 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Tue, 3 Jul 2018 10:44:03 -0700 Subject: [PATCH] Rename message files (e.g. ccls_call_hierarchy.cc -> ccls_callHierarchy.cc) --- CMakeLists.txt | 44 +++++++++---------- ...all_hierarchy.cc => ccls_callHierarchy.cc} | 0 .../{ccls_file_info.cc => ccls_fileInfo.cc} | 0 ..._freshen_index.cc => ccls_freshenIndex.cc} | 0 ...rarchy.cc => ccls_inheritanceHierarchy.cc} | 0 ...r_hierarchy.cc => ccls_memberHierarchy.cc} | 0 ..._code_lens.cc => textDocument_codeLens.cc} | 0 ...mpletion.cc => textDocument_completion.cc} | 0 ...finition.cc => textDocument_definition.cc} | 0 ...id_change.cc => textDocument_didChange.cc} | 0 ..._did_close.cc => textDocument_didClose.cc} | 0 ...nt_did_open.cc => textDocument_didOpen.cc} | 0 ...nt_did_save.cc => textDocument_didSave.cc} | 0 ...t.cc => textDocument_documentHighlight.cc} | 0 ...mbol.cc => textDocument_documentSymbol.cc} | 38 ++++++++++------ ...ocument_hover.cc => textDocument_hover.cc} | 0 ...tion.cc => textDocument_implementation.cc} | 0 ...ferences.cc => textDocument_references.cc} | 0 ...ument_rename.cc => textDocument_rename.cc} | 0 ..._help.cc => textDocument_signatureHelp.cc} | 0 ...tion.cc => textDocument_typeDefinition.cc} | 0 ...cc => workspace_didChangeConfiguration.cc} | 0 ....cc => workspace_didChangeWatchedFiles.cc} | 0 ...command.cc => workspace_executeCommand.cc} | 0 24 files changed, 47 insertions(+), 35 deletions(-) rename src/messages/{ccls_call_hierarchy.cc => ccls_callHierarchy.cc} (100%) rename src/messages/{ccls_file_info.cc => ccls_fileInfo.cc} (100%) rename src/messages/{ccls_freshen_index.cc => ccls_freshenIndex.cc} (100%) rename src/messages/{ccls_inheritance_hierarchy.cc => ccls_inheritanceHierarchy.cc} (100%) rename src/messages/{ccls_member_hierarchy.cc => ccls_memberHierarchy.cc} (100%) rename src/messages/{text_document_code_lens.cc => textDocument_codeLens.cc} (100%) rename src/messages/{text_document_completion.cc => textDocument_completion.cc} (100%) rename src/messages/{text_document_definition.cc => textDocument_definition.cc} (100%) rename src/messages/{text_document_did_change.cc => textDocument_didChange.cc} (100%) rename src/messages/{text_document_did_close.cc => textDocument_didClose.cc} (100%) rename src/messages/{text_document_did_open.cc => textDocument_didOpen.cc} (100%) rename src/messages/{text_document_did_save.cc => textDocument_didSave.cc} (100%) rename src/messages/{text_document_document_highlight.cc => textDocument_documentHighlight.cc} (100%) rename src/messages/{text_document_document_symbol.cc => textDocument_documentSymbol.cc} (70%) rename src/messages/{text_document_hover.cc => textDocument_hover.cc} (100%) rename src/messages/{text_document_implementation.cc => textDocument_implementation.cc} (100%) rename src/messages/{text_document_references.cc => textDocument_references.cc} (100%) rename src/messages/{text_document_rename.cc => textDocument_rename.cc} (100%) rename src/messages/{text_document_signature_help.cc => textDocument_signatureHelp.cc} (100%) rename src/messages/{text_document_type_definition.cc => textDocument_typeDefinition.cc} (100%) rename src/messages/{workspace_did_change_configuration.cc => workspace_didChangeConfiguration.cc} (100%) rename src/messages/{workspace_did_change_watched_files.cc => workspace_didChangeWatchedFiles.cc} (100%) rename src/messages/{workspace_execute_command.cc => workspace_executeCommand.cc} (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index b35acd4a..cfabeb32 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -220,32 +220,32 @@ target_sources(ccls PRIVATE target_sources(ccls PRIVATE src/messages/ccls_base.cc - src/messages/ccls_call_hierarchy.cc + src/messages/ccls_callHierarchy.cc src/messages/ccls_callers.cc - src/messages/ccls_file_info.cc - src/messages/ccls_freshen_index.cc - src/messages/ccls_inheritance_hierarchy.cc - src/messages/ccls_member_hierarchy.cc + src/messages/ccls_fileInfo.cc + src/messages/ccls_freshenIndex.cc + src/messages/ccls_inheritanceHierarchy.cc + src/messages/ccls_memberHierarchy.cc src/messages/ccls_vars.cc src/messages/exit.cc src/messages/initialize.cc src/messages/shutdown.cc - src/messages/text_document_code_lens.cc - src/messages/text_document_completion.cc - src/messages/text_document_definition.cc - src/messages/text_document_did_change.cc - src/messages/text_document_did_close.cc - src/messages/text_document_did_open.cc - src/messages/text_document_did_save.cc - src/messages/text_document_document_highlight.cc - src/messages/text_document_document_symbol.cc - src/messages/text_document_hover.cc - src/messages/text_document_implementation.cc - src/messages/text_document_references.cc - src/messages/text_document_rename.cc - src/messages/text_document_signature_help.cc - src/messages/text_document_type_definition.cc - src/messages/workspace_did_change_configuration.cc - src/messages/workspace_did_change_watched_files.cc + src/messages/textDocument_codeLens.cc + src/messages/textDocument_completion.cc + src/messages/textDocument_definition.cc + src/messages/textDocument_didChange.cc + src/messages/textDocument_didClose.cc + src/messages/textDocument_didOpen.cc + src/messages/textDocument_didSave.cc + src/messages/textDocument_documentHighlight.cc + src/messages/textDocument_documentSymbol.cc + src/messages/textDocument_hover.cc + src/messages/textDocument_implementation.cc + src/messages/textDocument_references.cc + src/messages/textDocument_rename.cc + src/messages/textDocument_signatureHelp.cc + src/messages/textDocument_typeDefinition.cc + src/messages/workspace_didChangeConfiguration.cc + src/messages/workspace_didChangeWatchedFiles.cc src/messages/workspace_symbol.cc ) diff --git a/src/messages/ccls_call_hierarchy.cc b/src/messages/ccls_callHierarchy.cc similarity index 100% rename from src/messages/ccls_call_hierarchy.cc rename to src/messages/ccls_callHierarchy.cc diff --git a/src/messages/ccls_file_info.cc b/src/messages/ccls_fileInfo.cc similarity index 100% rename from src/messages/ccls_file_info.cc rename to src/messages/ccls_fileInfo.cc diff --git a/src/messages/ccls_freshen_index.cc b/src/messages/ccls_freshenIndex.cc similarity index 100% rename from src/messages/ccls_freshen_index.cc rename to src/messages/ccls_freshenIndex.cc diff --git a/src/messages/ccls_inheritance_hierarchy.cc b/src/messages/ccls_inheritanceHierarchy.cc similarity index 100% rename from src/messages/ccls_inheritance_hierarchy.cc rename to src/messages/ccls_inheritanceHierarchy.cc diff --git a/src/messages/ccls_member_hierarchy.cc b/src/messages/ccls_memberHierarchy.cc similarity index 100% rename from src/messages/ccls_member_hierarchy.cc rename to src/messages/ccls_memberHierarchy.cc diff --git a/src/messages/text_document_code_lens.cc b/src/messages/textDocument_codeLens.cc similarity index 100% rename from src/messages/text_document_code_lens.cc rename to src/messages/textDocument_codeLens.cc diff --git a/src/messages/text_document_completion.cc b/src/messages/textDocument_completion.cc similarity index 100% rename from src/messages/text_document_completion.cc rename to src/messages/textDocument_completion.cc diff --git a/src/messages/text_document_definition.cc b/src/messages/textDocument_definition.cc similarity index 100% rename from src/messages/text_document_definition.cc rename to src/messages/textDocument_definition.cc diff --git a/src/messages/text_document_did_change.cc b/src/messages/textDocument_didChange.cc similarity index 100% rename from src/messages/text_document_did_change.cc rename to src/messages/textDocument_didChange.cc diff --git a/src/messages/text_document_did_close.cc b/src/messages/textDocument_didClose.cc similarity index 100% rename from src/messages/text_document_did_close.cc rename to src/messages/textDocument_didClose.cc diff --git a/src/messages/text_document_did_open.cc b/src/messages/textDocument_didOpen.cc similarity index 100% rename from src/messages/text_document_did_open.cc rename to src/messages/textDocument_didOpen.cc diff --git a/src/messages/text_document_did_save.cc b/src/messages/textDocument_didSave.cc similarity index 100% rename from src/messages/text_document_did_save.cc rename to src/messages/textDocument_didSave.cc diff --git a/src/messages/text_document_document_highlight.cc b/src/messages/textDocument_documentHighlight.cc similarity index 100% rename from src/messages/text_document_document_highlight.cc rename to src/messages/textDocument_documentHighlight.cc diff --git a/src/messages/text_document_document_symbol.cc b/src/messages/textDocument_documentSymbol.cc similarity index 70% rename from src/messages/text_document_document_symbol.cc rename to src/messages/textDocument_documentSymbol.cc index 450155e9..a66ffec2 100644 --- a/src/messages/text_document_document_symbol.cc +++ b/src/messages/textDocument_documentSymbol.cc @@ -20,6 +20,21 @@ struct In_TextDocumentDocumentSymbol : public RequestInMessage { MAKE_REFLECT_STRUCT(In_TextDocumentDocumentSymbol, id, params); REGISTER_IN_MESSAGE(In_TextDocumentDocumentSymbol); +struct lsSimpleLocation { + lsRange range; +}; +MAKE_REFLECT_STRUCT(lsSimpleLocation, range); +struct lsSimpleSymbolInformation { + lsSimpleLocation location; +}; +MAKE_REFLECT_STRUCT(lsSimpleSymbolInformation, location); +struct Out_SimpleDocumentSymbol + : public lsOutMessage { + lsRequestId id; + std::vector result; +}; +MAKE_REFLECT_STRUCT(Out_SimpleDocumentSymbol, jsonrpc, id, result); + struct Out_TextDocumentDocumentSymbol : public lsOutMessage { lsRequestId id; @@ -32,8 +47,6 @@ struct Handler_TextDocumentDocumentSymbol MethodType GetMethodType() const override { return kMethodType; } void Run(In_TextDocumentDocumentSymbol* request) override { auto& params = request->params; - Out_TextDocumentDocumentSymbol out; - out.id = request->id; QueryFile* file; int file_id; @@ -42,17 +55,17 @@ struct Handler_TextDocumentDocumentSymbol return; if (params.all) { + Out_SimpleDocumentSymbol out; + out.id = request->id; for (SymbolRef sym : file->def->all_symbols) - if (std::optional info = - GetSymbolInfo(db, working_files, sym, false)) { - if (std::optional location = GetLsLocation( - db, working_files, - Use{{sym.range, sym.usr, sym.kind, sym.role}, file_id})) { - info->location = *location; - out.result.push_back(*info); - } - } + if (std::optional location = GetLsLocation( + db, working_files, + Use{{sym.range, sym.usr, sym.kind, sym.role}, file_id})) + out.result.push_back({{location->range}}); + pipeline::WriteStdout(kMethodType, out); } else { + Out_TextDocumentDocumentSymbol out; + out.id = request->id; for (SymbolRef sym : file->def->outline) if (std::optional info = GetSymbolInfo(db, working_files, sym, false)) { @@ -69,9 +82,8 @@ struct Handler_TextDocumentDocumentSymbol out.result.push_back(*info); } } + pipeline::WriteStdout(kMethodType, out); } - - pipeline::WriteStdout(kMethodType, out); } }; REGISTER_MESSAGE_HANDLER(Handler_TextDocumentDocumentSymbol); diff --git a/src/messages/text_document_hover.cc b/src/messages/textDocument_hover.cc similarity index 100% rename from src/messages/text_document_hover.cc rename to src/messages/textDocument_hover.cc diff --git a/src/messages/text_document_implementation.cc b/src/messages/textDocument_implementation.cc similarity index 100% rename from src/messages/text_document_implementation.cc rename to src/messages/textDocument_implementation.cc diff --git a/src/messages/text_document_references.cc b/src/messages/textDocument_references.cc similarity index 100% rename from src/messages/text_document_references.cc rename to src/messages/textDocument_references.cc diff --git a/src/messages/text_document_rename.cc b/src/messages/textDocument_rename.cc similarity index 100% rename from src/messages/text_document_rename.cc rename to src/messages/textDocument_rename.cc diff --git a/src/messages/text_document_signature_help.cc b/src/messages/textDocument_signatureHelp.cc similarity index 100% rename from src/messages/text_document_signature_help.cc rename to src/messages/textDocument_signatureHelp.cc diff --git a/src/messages/text_document_type_definition.cc b/src/messages/textDocument_typeDefinition.cc similarity index 100% rename from src/messages/text_document_type_definition.cc rename to src/messages/textDocument_typeDefinition.cc diff --git a/src/messages/workspace_did_change_configuration.cc b/src/messages/workspace_didChangeConfiguration.cc similarity index 100% rename from src/messages/workspace_did_change_configuration.cc rename to src/messages/workspace_didChangeConfiguration.cc diff --git a/src/messages/workspace_did_change_watched_files.cc b/src/messages/workspace_didChangeWatchedFiles.cc similarity index 100% rename from src/messages/workspace_did_change_watched_files.cc rename to src/messages/workspace_didChangeWatchedFiles.cc diff --git a/src/messages/workspace_execute_command.cc b/src/messages/workspace_executeCommand.cc similarity index 100% rename from src/messages/workspace_execute_command.cc rename to src/messages/workspace_executeCommand.cc