-
Notifications
You must be signed in to change notification settings - Fork 204
Added support for Rust macros and macro calls #515
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,7 @@ | |
| jump_to_alias_definition_menu_item, jump_to_crate_menu_item, find_references_menu_item, | ||
| std_lib_links_menu, jump_to_module_declaration_menu_item, jump_to_type_declaration_menu_item, | ||
| jump_to_variable_declaration_menu_item, jump_to_function_declaration_menu_item, | ||
| trait_impl_menu_item) | ||
| trait_impl_menu_item, jump_to_macro_definition_menu_item) | ||
|
|
||
|
|
||
| def trim_dict(dictionary, keys): | ||
|
|
@@ -126,6 +126,29 @@ def menu_items(self): | |
| return menu | ||
|
|
||
|
|
||
| class MacroRef(_RustRef): | ||
| def prepare_menu_data(self, tree_index, datum): | ||
| self.hover = datum['qualname'] | ||
| return trim_dict(datum, ['qualname']) | ||
|
|
||
| def menu_items(self): | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think here and below we also want to add the
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not quite following - that shouldn't have any impact on macros. Unless you mean you want to be able to jump to macro references from a macro reference? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh yeah, sorry, should have looked that up, it wasn't what I was expecting. Anyway, yeah, I guess you should add
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
| return [find_references_menu_item(self.tree, self.menu_data["qualname"], "macro-ref", "macro")] | ||
|
|
||
| class MacroRefRef(_RustRef): | ||
| def prepare_menu_data(self, tree_index, datum): | ||
| if datum['qualname'] and datum['qualname'] in tree_index.data.macros: | ||
| self.hover = datum['qualname'] | ||
| mac = tree_index.data.macros[datum['qualname']] | ||
| return trim_dict(mac, ['file_name', 'file_line', 'qualname']) | ||
|
|
||
| def menu_items(self): | ||
| if self.menu_data: | ||
| menu = [jump_to_target_from_decl(jump_to_macro_definition_menu_item, self.tree, self.menu_data)] | ||
| menu.append(find_references_menu_item(self.tree, self.menu_data["qualname"], "macro-ref", "macro")) | ||
| return menu | ||
| return [] | ||
|
|
||
|
|
||
| class VariableRef(_KeysFromDatum): | ||
| keys = ['type', 'qualname'] | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Just a nit: 1 skipped line between methods of a class)