|
|
|
@ -84,8 +84,15 @@ LanguageProtocol::Capabilities LanguageProtocol::Client::initialize(Source::Lang |
|
|
|
auto capabilities_pt=result.find("capabilities"); |
|
|
|
auto capabilities_pt=result.find("capabilities"); |
|
|
|
if(capabilities_pt!=result.not_found()) { |
|
|
|
if(capabilities_pt!=result.not_found()) { |
|
|
|
capabilities.text_document_sync=static_cast<LanguageProtocol::Capabilities::TextDocumentSync>(capabilities_pt->second.get<unsigned>("textDocumentSync", 0)); |
|
|
|
capabilities.text_document_sync=static_cast<LanguageProtocol::Capabilities::TextDocumentSync>(capabilities_pt->second.get<unsigned>("textDocumentSync", 0)); |
|
|
|
|
|
|
|
capabilities.hover=capabilities_pt->second.get<bool>("hoverProvider", false); |
|
|
|
|
|
|
|
capabilities.completion=capabilities_pt->second.find("completionProvider")!=capabilities_pt->second.not_found()?true:false; |
|
|
|
|
|
|
|
capabilities.definition=capabilities_pt->second.get<bool>("definitionProvider", false); |
|
|
|
|
|
|
|
capabilities.references=capabilities_pt->second.get<bool>("referencesProvider", false); |
|
|
|
capabilities.document_highlight=capabilities_pt->second.get<bool>("documentHighlightProvider", false); |
|
|
|
capabilities.document_highlight=capabilities_pt->second.get<bool>("documentHighlightProvider", false); |
|
|
|
capabilities.workspace_symbol=capabilities_pt->second.get<bool>("workspaceSymbolProvider", false); |
|
|
|
capabilities.workspace_symbol=capabilities_pt->second.get<bool>("workspaceSymbolProvider", false); |
|
|
|
|
|
|
|
capabilities.document_formatting=capabilities_pt->second.get<bool>("documentFormattingProvider", false); |
|
|
|
|
|
|
|
capabilities.document_range_formatting=capabilities_pt->second.get<bool>("documentRangeFormattingProvider", false); |
|
|
|
|
|
|
|
capabilities.rename=capabilities_pt->second.get<bool>("renameProvider", false); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
write_notification("initialized", ""); |
|
|
|
write_notification("initialized", ""); |
|
|
|
@ -369,6 +376,7 @@ Source::LanguageProtocolView::~LanguageProtocolView() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Source::LanguageProtocolView::setup_navigation_and_refactoring() { |
|
|
|
void Source::LanguageProtocolView::setup_navigation_and_refactoring() { |
|
|
|
|
|
|
|
if(capabilities.document_formatting) { |
|
|
|
format_style=[this](bool continue_without_style_file) { |
|
|
|
format_style=[this](bool continue_without_style_file) { |
|
|
|
if(!continue_without_style_file) |
|
|
|
if(!continue_without_style_file) |
|
|
|
return; |
|
|
|
return; |
|
|
|
@ -414,14 +422,18 @@ void Source::LanguageProtocolView::setup_navigation_and_refactoring() { |
|
|
|
} |
|
|
|
} |
|
|
|
get_buffer()->end_user_action(); |
|
|
|
get_buffer()->end_user_action(); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(capabilities.definition) { |
|
|
|
get_declaration_location=[this]() { |
|
|
|
get_declaration_location=[this]() { |
|
|
|
auto offset=get_declaration(get_buffer()->get_insert()->get_iter()); |
|
|
|
auto offset=get_declaration(get_buffer()->get_insert()->get_iter()); |
|
|
|
if(!offset) |
|
|
|
if(!offset) |
|
|
|
Info::get().print("No declaration found"); |
|
|
|
Info::get().print("No declaration found"); |
|
|
|
return offset; |
|
|
|
return offset; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(capabilities.references) { |
|
|
|
get_usages=[this] { |
|
|
|
get_usages=[this] { |
|
|
|
auto iter=get_buffer()->get_insert()->get_iter(); |
|
|
|
auto iter=get_buffer()->get_insert()->get_iter(); |
|
|
|
std::vector<std::pair<Offset, std::string>> usages; |
|
|
|
std::vector<std::pair<Offset, std::string>> usages; |
|
|
|
@ -539,6 +551,7 @@ void Source::LanguageProtocolView::setup_navigation_and_refactoring() { |
|
|
|
|
|
|
|
|
|
|
|
return usages; |
|
|
|
return usages; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
get_token_spelling=[this]() -> std::string { |
|
|
|
get_token_spelling=[this]() -> std::string { |
|
|
|
auto start=get_buffer()->get_insert()->get_iter(); |
|
|
|
auto start=get_buffer()->get_insert()->get_iter(); |
|
|
|
@ -555,6 +568,7 @@ void Source::LanguageProtocolView::setup_navigation_and_refactoring() { |
|
|
|
return get_buffer()->get_text(start, end); |
|
|
|
return get_buffer()->get_text(start, end); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(capabilities.rename) { |
|
|
|
rename_similar_tokens=[this](const std::string &text) { |
|
|
|
rename_similar_tokens=[this](const std::string &text) { |
|
|
|
class Usages { |
|
|
|
class Usages { |
|
|
|
public: |
|
|
|
public: |
|
|
|
@ -663,6 +677,7 @@ void Source::LanguageProtocolView::setup_navigation_and_refactoring() { |
|
|
|
Terminal::get().print("\n"); |
|
|
|
Terminal::get().print("\n"); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
goto_next_diagnostic=[this]() { |
|
|
|
goto_next_diagnostic=[this]() { |
|
|
|
auto insert_offset=get_buffer()->get_insert()->get_iter().get_offset(); |
|
|
|
auto insert_offset=get_buffer()->get_insert()->get_iter().get_offset(); |
|
|
|
@ -790,6 +805,9 @@ void Source::LanguageProtocolView::show_diagnostic_tooltips(const Gdk::Rectangle |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Source::LanguageProtocolView::show_type_tooltips(const Gdk::Rectangle &rectangle) { |
|
|
|
void Source::LanguageProtocolView::show_type_tooltips(const Gdk::Rectangle &rectangle) { |
|
|
|
|
|
|
|
if(!capabilities.hover) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
Gtk::TextIter iter; |
|
|
|
Gtk::TextIter iter; |
|
|
|
int location_x, location_y; |
|
|
|
int location_x, location_y; |
|
|
|
window_to_buffer_coords(Gtk::TextWindowType::TEXT_WINDOW_TEXT, rectangle.get_x(), rectangle.get_y(), location_x, location_y); |
|
|
|
window_to_buffer_coords(Gtk::TextWindowType::TEXT_WINDOW_TEXT, rectangle.get_x(), rectangle.get_y(), location_x, location_y); |
|
|
|
@ -817,7 +835,7 @@ void Source::LanguageProtocolView::show_type_tooltips(const Gdk::Rectangle &rect |
|
|
|
tooltip_buffer->insert_with_tag(tooltip_buffer->get_insert()->get_iter(), "Type: "+value, "def:note"); |
|
|
|
tooltip_buffer->insert_with_tag(tooltip_buffer->get_insert()->get_iter(), "Type: "+value, "def:note"); |
|
|
|
|
|
|
|
|
|
|
|
#ifdef JUCI_ENABLE_DEBUG |
|
|
|
#ifdef JUCI_ENABLE_DEBUG |
|
|
|
if(language_id=="rust") { |
|
|
|
if(language_id=="rust" && capabilities.definition) { |
|
|
|
if(Debug::LLDB::get().is_stopped()) { |
|
|
|
if(Debug::LLDB::get().is_stopped()) { |
|
|
|
Glib::ustring value_type="Value"; |
|
|
|
Glib::ustring value_type="Value"; |
|
|
|
|
|
|
|
|
|
|
|
@ -867,6 +885,9 @@ void Source::LanguageProtocolView::show_type_tooltips(const Gdk::Rectangle &rect |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Source::LanguageProtocolView::tag_similar_symbols() { |
|
|
|
void Source::LanguageProtocolView::tag_similar_symbols() { |
|
|
|
|
|
|
|
if(!capabilities.document_highlight && !capabilities.references) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
auto iter=get_buffer()->get_insert()->get_iter(); |
|
|
|
auto iter=get_buffer()->get_insert()->get_iter(); |
|
|
|
std::vector<std::pair<Offset, Offset>> offsets; |
|
|
|
std::vector<std::pair<Offset, Offset>> offsets; |
|
|
|
std::promise<void> result_processed; |
|
|
|
std::promise<void> result_processed; |
|
|
|
@ -931,6 +952,9 @@ Source::Offset Source::LanguageProtocolView::get_declaration(const Gtk::TextIter |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Source::LanguageProtocolView::setup_autocomplete() { |
|
|
|
void Source::LanguageProtocolView::setup_autocomplete() { |
|
|
|
|
|
|
|
if(!capabilities.completion) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
non_interactive_completion=[this] { |
|
|
|
non_interactive_completion=[this] { |
|
|
|
if(CompletionDialog::get() && CompletionDialog::get()->is_visible()) |
|
|
|
if(CompletionDialog::get() && CompletionDialog::get()->is_visible()) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|