Class: Redcar::Declarations
- Inherits:
-
Object
show all
- Defined in:
- plugins/declarations/lib/declarations.rb,
plugins/declarations/lib/declarations/file.rb,
plugins/declarations/lib/declarations/parser.rb,
plugins/declarations/lib/declarations/commands.rb,
plugins/declarations/lib/declarations/completion_source.rb,
plugins/declarations/lib/declarations/select_tag_dialog.rb
Defined Under Namespace
Classes: CompletionSource, File, GoToTagCommand, OpenOutlineViewCommand, OpenProjectOutlineViewCommand, OutlineViewDialog, Parser, ProjectOutlineViewDialog, ProjectRefresh, RebuildTagsCommand, SelectTagDialog
Class Method Summary
(collapse)
Class Method Details
+ (Object) autocompletion_source_types
47
48
49
|
# File 'plugins/declarations/lib/declarations.rb', line 47
def self.autocompletion_source_types
[] end
|
112
113
114
115
|
# File 'plugins/declarations/lib/declarations.rb', line 112
def self.clear_tags_for_path(path)
@tags_for_path ||= {}
@tags_for_path.delete(path)
end
|
+ (Object) file_path(project)
51
52
53
|
# File 'plugins/declarations/lib/declarations.rb', line 51
def self.file_path(project)
::File.join(project.config_dir, 'tags')
end
|
+ (Object) go_to_definition(match)
117
118
119
120
121
122
|
# File 'plugins/declarations/lib/declarations.rb', line 117
def self.go_to_definition(match)
path = match[:file]
Project::Manager.open_file(path)
regexp = Regexp.new(Regexp.escape(match[:match]))
DocumentSearch::FindNextRegex.new(regexp, true).run_in_focussed_tab_edit_view
end
|
+ (Object) icon_for_kind(kind)
55
56
57
58
59
60
61
62
63
64
65
66
67
|
# File 'plugins/declarations/lib/declarations.rb', line 55
def self.icon_for_kind(kind)
h = {
:method => :node_insert,
:class => :open_source_flipped,
:attribute => :status,
:alias => :arrow_branch,
:assignment => :arrow,
:interface => :information,
:closure => :node_magnifier,
:none => nil
}
h[kind.to_sym]
end
|
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'plugins/declarations/lib/declarations.rb', line 31
def self.keymaps
linwin = Keymap.build("main", [:linux, :windows]) do
link "Alt+G", Declarations::GoToTagCommand
link "Ctrl+I", Declarations::OpenOutlineViewCommand
link "Ctrl+Shift+I", Declarations::OpenProjectOutlineViewCommand
end
osx = Keymap.build("main", :osx) do
link "Ctrl+Alt+G", Declarations::GoToTagCommand
link "Cmd+I", Declarations::OpenOutlineViewCommand
link "Cmd+Ctrl+I", Declarations::OpenProjectOutlineViewCommand
end
[linwin, osx]
end
|
+ (Object) match_kind(path, regex)
108
109
110
|
# File 'plugins/declarations/lib/declarations.rb', line 108
def self.match_kind(path, regex)
Declarations::Parser.new.match_kind(path, regex)
end
|
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'plugins/declarations/lib/declarations.rb', line 11
def self.
Menu::Builder.build do
"Edit" do
group :priority => 30 do
item "Find declaration", :command => Declarations::OpenOutlineViewCommand
end
end
"Project" do
group :priority => 60 do
item "Go to declaration", :command => Declarations::GoToTagCommand, :priority => 30
item "Find declaration", :command => Declarations::OpenProjectOutlineViewCommand, :priority => :first
end
"Refresh", :priority => 31 do
item "Declarations file", :command => Declarations::RebuildTagsCommand
end
end
end
end
|
+ (Object) project_refresh_task_type
87
88
89
|
# File 'plugins/declarations/lib/declarations.rb', line 87
def self.project_refresh_task_type
ProjectRefresh
end
|
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
# File 'plugins/declarations/lib/declarations.rb', line 91
def self.tags_for_path(path)
@tags_for_path ||= {}
@tags_for_path[path] ||= begin
tags = {}
::File.read(path).each_line do |line|
key, file, *match = line.split("\t")
if [key, file, match].all? { |el| !el.nil? && !el.empty? }
tags[key] ||= []
tags[key] << { :file => file, :match => match.join("\t").chomp }
end
end
tags
rescue Errno::ENOENT
{}
end
end
|