redcar 0.8.1 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +41 -1
- data/README.md +1 -1
- data/Rakefile +5 -6
- data/lib/plugin_manager/lib/plugin_manager.rb +1 -2
- data/lib/redcar.rb +19 -14
- data/lib/redcar/installer.rb +21 -17
- data/lib/redcar/runner.rb +10 -7
- data/lib/redcar/usage.rb +1 -0
- data/lib/redcar_quick_start.rb +8 -12
- data/lib/regex_replace.rb +3 -3
- data/plugins/application/features/step_definitions/menu_steps.rb +10 -0
- data/plugins/application/features/step_definitions/speedbar_steps.rb +8 -2
- data/plugins/application/features/step_definitions/tree_steps.rb +48 -6
- data/plugins/application/features/step_definitions/window_steps.rb +9 -4
- data/plugins/application/features/support/env.rb +20 -1
- data/plugins/application/features/support/fake_event.rb +14 -0
- data/plugins/application/lib/application.rb +29 -12
- data/plugins/application/lib/application/dialogs/filter_list_dialog.rb +19 -0
- data/plugins/application/lib/application/speedbar.rb +23 -17
- data/plugins/application/lib/application/tab.rb +20 -15
- data/plugins/application/lib/application/treebook.rb +10 -7
- data/plugins/application/lib/application/window.rb +1 -1
- data/plugins/application/plugin.rb +1 -1
- data/plugins/application_swt/lib/application_swt/dialog_adapter.rb +4 -4
- data/plugins/application_swt/lib/application_swt/dialogs/filter_list_dialog_controller.rb +15 -4
- data/plugins/application_swt/lib/application_swt/icon.rb +3 -5
- data/plugins/application_swt/lib/application_swt/notebook/tab_drag_and_drop_listener.rb +4 -4
- data/plugins/application_swt/lib/application_swt/notebook/tab_transfer.rb +5 -5
- data/plugins/application_swt/lib/application_swt/speedbar.rb +34 -120
- data/plugins/application_swt/lib/application_swt/speedbar/button_item.rb +20 -0
- data/plugins/application_swt/lib/application_swt/speedbar/combo_item.rb +38 -0
- data/plugins/application_swt/lib/application_swt/speedbar/label_item.rb +15 -0
- data/plugins/application_swt/lib/application_swt/speedbar/slider_item.rb +32 -0
- data/plugins/application_swt/lib/application_swt/speedbar/text_box_item.rb +36 -0
- data/plugins/application_swt/lib/application_swt/speedbar/toggle_item.rb +29 -0
- data/plugins/application_swt/lib/application_swt/tab.rb +1 -3
- data/plugins/application_swt/lib/application_swt/toolbar.rb +19 -20
- data/plugins/application_swt/lib/application_swt/treebook.rb +24 -9
- data/plugins/application_swt/lib/application_swt/window.rb +110 -98
- data/plugins/application_swt/lib/swt/vtab_folder.rb +77 -32
- data/plugins/application_swt/lib/swt/vtab_item.rb +9 -0
- data/plugins/application_swt/lib/swt/vtab_label.rb +63 -23
- data/plugins/application_swt/plugin.rb +1 -1
- data/plugins/clipboard-viewer/lib/clipboard_viewer/clipboard_bar.rb +2 -2
- data/plugins/comment/features/line_comment.feature +116 -4
- data/plugins/comment/lib/comment.rb +18 -16
- data/plugins/connection_manager/lib/connection_manager/commands.rb +1 -1
- data/plugins/connection_manager/lib/connection_manager/private_key_store.rb +5 -3
- data/plugins/declarations/lib/declarations.rb +1 -1
- data/plugins/declarations/lib/declarations/parser.rb +68 -20
- data/plugins/document_search/features/replace.feature +18 -0
- data/plugins/document_search/lib/document_search.rb +37 -54
- data/plugins/document_search/lib/document_search/replace_all_command.rb +27 -0
- data/plugins/document_search/lib/document_search/replace_command.rb +38 -0
- data/plugins/document_search/lib/document_search/replace_next_command.rb +27 -0
- data/plugins/document_search/lib/document_search/search_and_replace.rb +17 -24
- data/plugins/edit_view/features/step_definitions/editing_steps.rb +4 -4
- data/plugins/edit_view/features/step_definitions/tab_steps.rb +9 -0
- data/plugins/edit_view/features/step_definitions/window_steps.rb +0 -12
- data/plugins/edit_view/lib/edit_view/document.rb +2 -0
- data/plugins/edit_view/lib/edit_view/document/command.rb +8 -8
- data/plugins/edit_view/lib/edit_view/edit_tab.rb +21 -7
- data/plugins/edit_view/lib/edit_view/select_font_dialog.rb +6 -0
- data/plugins/edit_view/lib/edit_view/select_theme_dialog.rb +6 -0
- data/plugins/edit_view_swt/lib/edit_view_swt.rb +92 -43
- data/plugins/edit_view_swt/lib/edit_view_swt/document.rb +17 -4
- data/plugins/find-in-project/lib/find_in_project.rb +1 -4
- data/plugins/find-in-project/lib/find_in_project/commands.rb +0 -14
- data/plugins/find-in-project/lib/find_in_project/controllers.rb +12 -0
- data/plugins/find-in-project/lib/find_in_project/views/index.html.erb +5 -0
- data/plugins/groovy/features/fixtures/test.groovy +0 -0
- data/plugins/groovy/features/step_definitions/groovy_steps.rb +27 -0
- data/plugins/groovy/features/support/env.rb +27 -0
- data/plugins/groovy/features/syntax_check_groovy.feature +72 -0
- data/plugins/groovy/lib/syntax_check/groovy.rb +76 -0
- data/plugins/groovy/plugin.rb +7 -0
- data/plugins/help/lib/help.rb +28 -4
- data/plugins/help/lib/help/help_tab.rb +11 -0
- data/plugins/help/lib/help/view_controller.rb +25 -0
- data/plugins/help/plugin.rb +2 -1
- data/plugins/{view_shortcuts → help}/views/default.css +0 -0
- data/plugins/{view_shortcuts → help}/views/index.html.erb +1 -1
- data/plugins/{view_shortcuts → help}/views/redcar_small_icon.png +0 -0
- data/plugins/html_view/features/browser_bar.feature +47 -0
- data/plugins/html_view/features/fixtures/other.html +1 -0
- data/plugins/html_view/features/fixtures/sample.html +1 -0
- data/plugins/html_view/features/step_definitions/html_view_steps.rb +45 -5
- data/plugins/html_view/features/support/env.rb +26 -0
- data/plugins/html_view/features/web_preview.feature +21 -0
- data/plugins/html_view/lib/html_controller.rb +5 -5
- data/plugins/html_view/lib/html_view.rb +62 -10
- data/plugins/{web_bookmarks/lib/web_bookmarks → html_view/lib/html_view}/browser_bar.rb +32 -20
- data/plugins/html_view/lib/html_view/commands.rb +64 -0
- data/plugins/{web_bookmarks/lib/web_bookmarks/view_controller.rb → html_view/lib/html_view/default_controller.rb} +7 -6
- data/plugins/html_view/lib/html_view/html_tab.rb +17 -6
- data/plugins/html_view/plugin.rb +3 -3
- data/plugins/{web_bookmarks → html_view}/views/index.html.erb +0 -0
- data/plugins/javascript/features/fixtures/test.js +0 -0
- data/plugins/javascript/features/support/env.rb +4 -0
- data/plugins/javascript/features/syntax_check_javascript.feature +27 -0
- data/plugins/javascript/lib/syntax_check/javascript.rb +52 -0
- data/plugins/javascript/plugin.rb +7 -0
- data/plugins/javascript/vendor/jslint.js +539 -0
- data/plugins/macros/lib/macros/commands.rb +3 -3
- data/plugins/open_default_app/lib/open_default_app.rb +29 -3
- data/plugins/open_default_app/plugin.rb +1 -1
- data/plugins/outline_view/features/outline_view.feature +79 -0
- data/plugins/outline_view/features/step_definitions/outline_steps.rb +45 -0
- data/plugins/outline_view/lib/outline_view.rb +1 -1
- data/plugins/outline_view/spec/fixtures/some_project/javascript.js +10 -0
- data/plugins/outline_view/spec/fixtures/some_project/nothing_to_see.rb +0 -0
- data/plugins/outline_view/spec/fixtures/some_project/one_lonely_class.rb +2 -0
- data/plugins/outline_view/spec/fixtures/some_project/similar_names.rb +18 -0
- data/plugins/outline_view/spec/fixtures/some_project/something_fancy.rb +736 -0
- data/plugins/outline_view/spec/fixtures/some_project/trailing_space.rb +5 -0
- data/plugins/outline_view_swt/lib/outline_view_swt.rb +17 -19
- data/plugins/pair_highlighter/lib/pair_highlighter/document_controller.rb +1 -4
- data/plugins/plugin_manager_ui/lib/plugin_manager_ui.rb +12 -3
- data/plugins/project/features/close_directory_tree.feature +27 -0
- data/plugins/project/features/highlight_focussed_tab.feature +45 -1
- data/plugins/project/features/open_and_save_files.feature +33 -0
- data/plugins/project/features/open_directory_tree.feature +37 -11
- data/plugins/project/features/step_definitions/directory_steps.rb +1 -1
- data/plugins/project/features/step_definitions/drb_steps.rb +40 -0
- data/plugins/project/features/support/env.rb +17 -0
- data/plugins/project/lib/project.rb +12 -2
- data/plugins/project/lib/project/commands.rb +101 -99
- data/plugins/project/lib/project/drb_service.rb +55 -65
- data/plugins/project/lib/project/manager.rb +29 -4
- data/plugins/project/lib/project/project_tree_controller.rb +24 -0
- data/plugins/project/lib/project/support/trash.rb +1 -0
- data/plugins/redcar/redcar.rb +100 -37
- data/plugins/redcar_debug/lib/redcar_debug.rb +3 -3
- data/plugins/repl/features/step_definitions/repl_steps.rb +3 -0
- data/plugins/repl/lib/repl.rb +4 -11
- data/plugins/repl/lib/repl/repl_tab.rb +26 -0
- data/plugins/ruby/features/fixtures/test.rb +0 -0
- data/plugins/ruby/features/support/env.rb +4 -0
- data/plugins/ruby/features/syntax_check_ruby.feature +25 -0
- data/plugins/runnables/features/command_tree.feature +28 -0
- data/plugins/runnables/lib/runnables.rb +1 -0
- data/plugins/runnables/lib/runnables/commands.rb +4 -4
- data/plugins/runnables/lib/runnables/output_processor.rb +5 -5
- data/plugins/runnables/lib/runnables/tree_mirror/tree_controller.rb +2 -7
- data/plugins/runnables/lib/runnables/tree_mirror/tree_mirror.rb +13 -8
- data/plugins/scm_git/lib/scm_git/change.rb +5 -5
- data/plugins/strip_trailing_spaces/features/fixtures/test.txt +3 -0
- data/plugins/strip_trailing_spaces/features/strip_trailing_spaces.feature +34 -0
- data/plugins/strip_trailing_spaces/lib/strip_trailing_spaces.rb +3 -38
- data/plugins/swt/lib/swt.rb +5 -13
- data/plugins/swt/lib/swt/full_swt.rb +15 -13
- data/plugins/syntax_check/features/step_definitions/syntax_check_steps.rb +7 -0
- data/plugins/syntax_check/lib/syntax_check.rb +21 -3
- data/plugins/syntax_check/lib/syntax_check/error.rb +4 -3
- data/plugins/task_manager/lib/task_manager.rb +1 -1
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Ant.tmbundle/Preferences/Autocompletions.tmPreferences +345 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Ant.tmbundle/Preferences/Symbol List Target.tmPreferences +22 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Ant.tmbundle/Snippets/Doc Banner.tmSnippet +20 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Ant.tmbundle/Syntaxes/Ant.tmLanguage +247 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Ant.tmbundle/info.plist +55 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/RedcarRepl.tmbundle/Syntaxes/GroovyRepl.plist +40 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/RedcarRepl.tmbundle/info.plist +1 -1
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Ruby Haml.tmbundle/Syntaxes/Ruby_Haml.tmLanguage +0 -1
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Ruby Sass.tmbundle/Syntaxes/Ruby Sass.tmLanguage +626 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Ruby Sass.tmbundle/info.plist +16 -0
- data/plugins/todo_list/features/support/env.rb +8 -0
- data/plugins/todo_list/features/todo_list.feature +26 -0
- data/plugins/todo_list/lib/todo_list.rb +1 -0
- data/plugins/todo_list/lib/todo_list/file_parser.rb +23 -19
- data/plugins/todo_list/lib/todo_list/todo_controller.rb +60 -100
- data/plugins/todo_list/spec/fixtures/project/FIXME.file +3 -0
- data/plugins/todo_list/spec/fixtures/project/NOTE.ignored.file +1 -0
- data/plugins/todo_list/spec/fixtures/project/OPTIMIZE_colon.file +1 -0
- data/plugins/todo_list/spec/fixtures/project/XXX.ignored +1 -0
- data/plugins/todo_list/spec/fixtures/project/ignored_directory/TODO.file +2 -0
- data/plugins/todo_list/spec/fixtures/settings.rb +11 -0
- data/plugins/todo_list/spec/spec_helper.rb +6 -0
- data/plugins/todo_list/spec/todo_list/file_parser_spec.rb +35 -0
- data/plugins/tree/lib/tree.rb +1 -0
- data/plugins/tree/lib/tree/command.rb +5 -0
- data/plugins/web_bookmarks/features/bookmark.feature +37 -0
- data/plugins/web_bookmarks/features/fixtures/other.html +1 -0
- data/plugins/web_bookmarks/features/fixtures/sample.html +1 -0
- data/plugins/web_bookmarks/features/step_definitions/web_steps.rb +4 -0
- data/plugins/web_bookmarks/features/support/env.rb +26 -0
- data/plugins/web_bookmarks/lib/web_bookmarks.rb +0 -10
- data/plugins/web_bookmarks/lib/web_bookmarks/bookmark.rb +10 -1
- data/plugins/web_bookmarks/lib/web_bookmarks/commands.rb +1 -47
- data/plugins/web_bookmarks/lib/web_bookmarks/tree.rb +21 -14
- data/{plugins/application → share}/icons/close.png +0 -0
- data/{plugins/application → share}/icons/darwin-file.png +0 -0
- data/{plugins/application → share}/icons/darwin-folder.png +0 -0
- data/share/icons/open-source-flipped.png +0 -0
- data/{plugins/application/icons/redcar_icon_beta_dev.png → share/icons/redcar-icon-beta-dev.png} +0 -0
- data/{plugins/application/icons/redcar_icon_beta.png → share/icons/redcar-icon-beta.png} +0 -0
- data/{plugins/application → share}/icons/redcar-splash.png +0 -0
- metadata +90 -30
- data/lib/redcar/jvm_options_probe.rb +0 -33
- data/plugins/document_search/lib/document_search/replace.rb +0 -113
- data/plugins/document_search/lib/document_search/search.rb +0 -45
- data/plugins/outline_view_swt/lib/icons/alias.png +0 -0
- data/plugins/outline_view_swt/lib/icons/assignment.png +0 -0
- data/plugins/outline_view_swt/lib/icons/attribute.png +0 -0
- data/plugins/outline_view_swt/lib/icons/class.png +0 -0
- data/plugins/outline_view_swt/lib/icons/interface.png +0 -0
- data/plugins/outline_view_swt/lib/icons/method.png +0 -0
- data/plugins/strip_trailing_spaces/CHANGELOG +0 -12
- data/plugins/strip_trailing_spaces/README.md +0 -32
- data/plugins/view_shortcuts/lib/view_shortcuts.rb +0 -52
- data/plugins/view_shortcuts/plugin.rb +0 -11
@@ -27,11 +27,17 @@ module Redcar
|
|
27
27
|
@map ||=begin
|
28
28
|
c = File.read(Comment.comment_lib_path)
|
29
29
|
map = JSON.parse(c)
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
30
|
+
begin
|
31
|
+
path = Comment.comment_extension_path
|
32
|
+
if File.exist?(path)
|
33
|
+
json = File.read(path)
|
34
|
+
JSON.parse(json).each do |item,content|
|
35
|
+
map[item] = content
|
36
|
+
end
|
34
37
|
end
|
38
|
+
rescue Object => e
|
39
|
+
Redcar::Application::Dialog.message_box("There was an error parsing Comment extensions file: #{e.message}")
|
40
|
+
map = JSON.parse(c)
|
35
41
|
end
|
36
42
|
map
|
37
43
|
end
|
@@ -40,16 +46,11 @@ module Redcar
|
|
40
46
|
def self.extensions_file;"comment_extensions.json";end
|
41
47
|
|
42
48
|
def self.comment_lib_path
|
43
|
-
File.dirname(__FILE__)
|
49
|
+
File.join(File.dirname(__FILE__),"..","vendor","comment_lib.json")
|
44
50
|
end
|
45
51
|
|
46
|
-
def self.
|
47
|
-
|
48
|
-
if project
|
49
|
-
project.config_files(Comment.extensions_file)
|
50
|
-
else
|
51
|
-
Dir[File.join(Redcar.user_dir,Comment.extensions_file)]
|
52
|
-
end
|
52
|
+
def self.comment_extension_path
|
53
|
+
File.join(Redcar.user_dir,Comment.extensions_file)
|
53
54
|
end
|
54
55
|
|
55
56
|
def self.keymaps
|
@@ -108,7 +109,7 @@ module Redcar
|
|
108
109
|
doc.replace_line(line,text)
|
109
110
|
else
|
110
111
|
replacement = "#{start}#{text}#{ending}"
|
111
|
-
replacement
|
112
|
+
replacement << "\n" if doc.get_line(line) =~ /\n$/
|
112
113
|
doc.replace_line(line,replacement)
|
113
114
|
end
|
114
115
|
end
|
@@ -156,7 +157,7 @@ module Redcar
|
|
156
157
|
md[1].length
|
157
158
|
end
|
158
159
|
|
159
|
-
|
160
|
+
def execute
|
160
161
|
type = Comment.comment_map["#{tab.edit_view.grammar.gsub("\"","")}"]
|
161
162
|
if type
|
162
163
|
@comment = type["line_comment"]
|
@@ -198,7 +199,8 @@ module Redcar
|
|
198
199
|
|
199
200
|
(start_line..end_line).each do |line|
|
200
201
|
text = doc.get_line(line)
|
201
|
-
|
202
|
+
|
203
|
+
if text =~ /^\s*$/
|
202
204
|
else
|
203
205
|
insertion_column = [insertion_column, comment_insertion_point_for(text)].min
|
204
206
|
end
|
@@ -254,7 +256,7 @@ module Redcar
|
|
254
256
|
end
|
255
257
|
end
|
256
258
|
end
|
257
|
-
|
259
|
+
|
258
260
|
if selected
|
259
261
|
doc.set_selection_range(cursor_offset, selection_offset)
|
260
262
|
else
|
@@ -11,9 +11,11 @@ module Redcar
|
|
11
11
|
paths = []
|
12
12
|
default_key_globs.each do |default_key_glob|
|
13
13
|
Dir[default_key_glob].each do |filename|
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
unless File.directory?(filename) || !File.readable?(filename)
|
15
|
+
first = File.open(filename).read(100)
|
16
|
+
if first =~ /PRIVATE KEY/
|
17
|
+
paths << filename
|
18
|
+
end
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
|
2
2
|
module Redcar
|
3
|
-
|
3
|
+
GROOVY_YAML=<<-YAML
|
4
4
|
- regex: "class\\s+(\\w+)"
|
5
5
|
capture: 1
|
6
6
|
type: id
|
@@ -9,18 +9,53 @@ module Redcar
|
|
9
9
|
capture: 1
|
10
10
|
type: id
|
11
11
|
kind: interface
|
12
|
-
- regex: "(public|private)
|
12
|
+
- regex: "^\\s*((public|private|protected|)\\s+|)(static\\s+|)(([\\.\\w]+|)[A-Z]\\w*(<\\w+>|)|void|int|boolean|byte|short|long|char|float|def)\\s+(\\w+\\s*\\((.*)\\))"
|
13
|
+
capture: 7
|
14
|
+
type: id
|
15
|
+
kind: method
|
16
|
+
- regex: "(def|static)\\s+(\\w+)\\s*=\\s*\\{"
|
13
17
|
capture: 2
|
14
18
|
type: id
|
19
|
+
kind: closure
|
20
|
+
- regex: "enum\\s+(\\w+)"
|
21
|
+
capture: 1
|
22
|
+
type: id
|
23
|
+
kind: attribute
|
24
|
+
- regex: "^\\s*(public|private|protected)\\s+(static\\s+|)([A-Z]\\w+|int|boolean|byte|short|long|char|float|def)\s+(\\w+)\\s*(=|\\n)"
|
25
|
+
capture: 4
|
26
|
+
type: id
|
27
|
+
kind: assignment
|
28
|
+
YAML
|
29
|
+
|
30
|
+
JAVA_YAML=<<-YAML
|
31
|
+
- regex: "class\\s+(\\w+)"
|
32
|
+
capture: 1
|
33
|
+
type: id
|
34
|
+
kind: class
|
35
|
+
- regex: "interface\\s+(\\w+)"
|
36
|
+
capture: 1
|
37
|
+
type: id
|
38
|
+
kind: interface
|
39
|
+
- regex: "^\\s*((public|private|protected|)\\s+|)(static\\s+|)(([\\.\\w]+|)[A-Z]\\w*(<\\w+>|)|void|int|boolean|byte|short|long|char|float)\\s+(\\w+\\s*\\((.*)\\))"
|
40
|
+
capture: 7
|
41
|
+
type: id
|
15
42
|
kind: method
|
43
|
+
- regex: "enum\\s+(\\w*)"
|
44
|
+
capture: 1
|
45
|
+
type: id
|
46
|
+
kind: attribute
|
47
|
+
- regex: "^\\s*(public|private|protected)\\s+(static\\s+|)([A-Z]\\w+|int|boolean|byte|short|long|char|float|def)\s+(\\w+)\\s*(=|;)"
|
48
|
+
capture: 4
|
49
|
+
type: id
|
50
|
+
kind: assignment
|
16
51
|
YAML
|
17
|
-
|
52
|
+
|
18
53
|
RUBY_YAML=<<-YAML
|
19
54
|
- regex: "^[^#]*(class|module)\\s+(?:\\w*::)*(\\w+)(?:$|\\s|<)"
|
20
55
|
capture: 2
|
21
56
|
type: id
|
22
57
|
kind: class
|
23
|
-
- regex: "^[^#]*def (self\\.)?(\\w+[
|
58
|
+
- regex: "^[^#]*def (self\\.)?(\\w+[?!=]?)(\\(.*\\))?(\\s|\\;)+"
|
24
59
|
capture: 2
|
25
60
|
type: id
|
26
61
|
kind: method
|
@@ -28,11 +63,11 @@ module Redcar
|
|
28
63
|
capture: 2
|
29
64
|
type: id-list
|
30
65
|
kind: attribute
|
31
|
-
- regex: "^[^#]*alias
|
66
|
+
- regex: "^[^#]*alias\\s+:(\\w+)"
|
32
67
|
capture: 1
|
33
68
|
type: id
|
34
69
|
kind: alias
|
35
|
-
- regex: "^[^#]*alias_method
|
70
|
+
- regex: "^[^#]*alias_method\\s+:(\\w+[?!]?)"
|
36
71
|
capture: 1
|
37
72
|
type: id
|
38
73
|
kind: alias
|
@@ -56,27 +91,40 @@ module Redcar
|
|
56
91
|
type: id
|
57
92
|
kind: method
|
58
93
|
YAML
|
59
|
-
|
94
|
+
|
95
|
+
JS_YAML=<<-YAML
|
96
|
+
- regex: "function\\s+([A-Z]\\w*)\\(.*\\)"
|
97
|
+
capture: 1
|
98
|
+
type: id
|
99
|
+
kind: class
|
100
|
+
- regex: "function\\s+([a-z]\\w*)\\(.*\\)"
|
101
|
+
capture: 1
|
102
|
+
type: id
|
103
|
+
kind: method
|
104
|
+
YAML
|
105
|
+
|
60
106
|
class Declarations
|
61
107
|
class Parser
|
62
108
|
DEFINITIONS = {
|
63
|
-
/\.rb$/
|
64
|
-
/\.java$/
|
65
|
-
/\.
|
109
|
+
/\.rb$/ => YAML.load(RUBY_YAML),
|
110
|
+
/\.java$/ => YAML.load(JAVA_YAML),
|
111
|
+
/\.groovy$/ => YAML.load(GROOVY_YAML),
|
112
|
+
/\.php$/ => YAML.load(PHP_YAML),
|
113
|
+
/\.js$/ => YAML.load(JS_YAML)
|
66
114
|
}
|
67
|
-
|
115
|
+
|
68
116
|
attr_reader :tags
|
69
|
-
|
117
|
+
|
70
118
|
def initialize
|
71
119
|
@tags = []
|
72
120
|
end
|
73
|
-
|
121
|
+
|
74
122
|
def parse(files)
|
75
123
|
files.each do |path|
|
76
124
|
@tags += match_in_file(path)
|
77
125
|
end
|
78
126
|
end
|
79
|
-
|
127
|
+
|
80
128
|
def decls_for_file(path)
|
81
129
|
DEFINITIONS.each do |fn_re, decls|
|
82
130
|
if path =~ fn_re
|
@@ -85,7 +133,7 @@ module Redcar
|
|
85
133
|
end
|
86
134
|
nil
|
87
135
|
end
|
88
|
-
|
136
|
+
|
89
137
|
def match_kind(path, match)
|
90
138
|
if decls = decls_for_file(path)
|
91
139
|
decls.each do |decl|
|
@@ -95,9 +143,9 @@ module Redcar
|
|
95
143
|
end
|
96
144
|
end
|
97
145
|
end
|
98
|
-
|
146
|
+
|
99
147
|
private
|
100
|
-
|
148
|
+
|
101
149
|
def match_in_file(path)
|
102
150
|
tags = []
|
103
151
|
begin
|
@@ -117,7 +165,7 @@ module Redcar
|
|
117
165
|
[]
|
118
166
|
end
|
119
167
|
end
|
120
|
-
|
168
|
+
|
121
169
|
def process_file(path, &block)
|
122
170
|
if decls = decls_for_file(path)
|
123
171
|
decls.each do |decl|
|
@@ -127,11 +175,11 @@ module Redcar
|
|
127
175
|
end
|
128
176
|
end
|
129
177
|
end
|
130
|
-
|
178
|
+
|
131
179
|
def file(path)
|
132
180
|
::File.read(path)
|
133
181
|
end
|
134
|
-
|
182
|
+
|
135
183
|
end
|
136
184
|
end
|
137
185
|
end
|
@@ -92,6 +92,24 @@ Feature: Replace in file
|
|
92
92
|
And the selected text should be "Rab"
|
93
93
|
And the selection should be on line 3
|
94
94
|
|
95
|
+
Scenario: Replace all replaces two on the same line
|
96
|
+
When I replace the contents with "abcabc"
|
97
|
+
And I run the command DocumentSearch::SearchAndReplaceCommand
|
98
|
+
And I type "bc" into the "Search" field in the speedbar
|
99
|
+
And I type "xx" into the "Replace" field in the speedbar
|
100
|
+
Then I should see a message box containing "Replaced 2 occurrences"
|
101
|
+
When I press "Replace All" in the speedbar
|
102
|
+
Then the contents should be "axxaxx"
|
103
|
+
|
104
|
+
Scenario: Replace all replaces overlapping occurences on the same line
|
105
|
+
When I replace the contents with "deedeedeed"
|
106
|
+
And I run the command DocumentSearch::SearchAndReplaceCommand
|
107
|
+
And I type "deed" into the "Search" field in the speedbar
|
108
|
+
And I type "misdeed" into the "Replace" field in the speedbar
|
109
|
+
Then I should see a message box containing "Replaced 2 occurrences"
|
110
|
+
When I press "Replace All" in the speedbar
|
111
|
+
Then the contents should be "misdeedeemisdeed"
|
112
|
+
|
95
113
|
Scenario: Replace next occurrence test bug
|
96
114
|
When I replace the contents with "the\n* Speedbars have access to the properties of the widgets in them."
|
97
115
|
And I move the cursor to 0
|
@@ -1,5 +1,7 @@
|
|
1
|
-
require
|
2
|
-
require "document_search/
|
1
|
+
require 'strscan'
|
2
|
+
require "document_search/replace_command"
|
3
|
+
require "document_search/replace_all_command"
|
4
|
+
require "document_search/replace_next_command"
|
3
5
|
require "document_search/search_and_replace"
|
4
6
|
|
5
7
|
module DocumentSearch
|
@@ -15,14 +17,14 @@ module DocumentSearch
|
|
15
17
|
end
|
16
18
|
end
|
17
19
|
end
|
18
|
-
|
20
|
+
|
19
21
|
def self.toolbars
|
20
22
|
Redcar::ToolBar::Builder.build do
|
21
23
|
item "Search Document", :command => DocumentSearch::SearchForwardCommand, :icon => File.join(Redcar::ICONS_DIRECTORY, "magnifier.png"), :barname => :edit
|
22
24
|
item "Repeat Last Search", :command => DocumentSearch::RepeatPreviousSearchForwardCommand, :icon => File.join(Redcar::ICONS_DIRECTORY, "magnifier--arrow.png"), :barname => :edit
|
23
25
|
end
|
24
26
|
end
|
25
|
-
|
27
|
+
|
26
28
|
class SearchSpeedbar < Redcar::Speedbar
|
27
29
|
class << self
|
28
30
|
attr_accessor :previous_query
|
@@ -31,7 +33,7 @@ module DocumentSearch
|
|
31
33
|
end
|
32
34
|
|
33
35
|
attr_accessor :initial_query
|
34
|
-
|
36
|
+
|
35
37
|
def after_draw
|
36
38
|
SearchSpeedbar.previous_query ||= ""
|
37
39
|
self.query.value = @initial_query || SearchSpeedbar.previous_query
|
@@ -39,26 +41,26 @@ module DocumentSearch
|
|
39
41
|
self.match_case.value = SearchSpeedbar.previous_match_case
|
40
42
|
self.query.edit_view.document.select_all
|
41
43
|
end
|
42
|
-
|
44
|
+
|
43
45
|
label :label, "Search:"
|
44
46
|
textbox :query
|
45
|
-
|
47
|
+
|
46
48
|
toggle :is_regex, 'Regex', nil, false do |v|
|
47
49
|
# v is true or false
|
48
50
|
SearchSpeedbar.previous_is_regex = v
|
49
51
|
end
|
50
|
-
|
52
|
+
|
51
53
|
toggle :match_case, 'Match case', nil, false do |v|
|
52
54
|
SearchSpeedbar.previous_match_case = v
|
53
55
|
end
|
54
|
-
|
56
|
+
|
55
57
|
button :search, "Search", "Return" do
|
56
58
|
SearchSpeedbar.previous_query = query.value
|
57
59
|
SearchSpeedbar.previous_match_case = match_case.value
|
58
60
|
SearchSpeedbar.previous_is_regex = is_regex.value
|
59
61
|
success = SearchSpeedbar.repeat_query
|
60
62
|
end
|
61
|
-
|
63
|
+
|
62
64
|
def self.repeat_query
|
63
65
|
current_query = @previous_query
|
64
66
|
if !@previous_is_regex
|
@@ -68,9 +70,9 @@ module DocumentSearch
|
|
68
70
|
cmd.run_in_focussed_tab_edit_view
|
69
71
|
end
|
70
72
|
end
|
71
|
-
|
73
|
+
|
72
74
|
class SearchForwardCommand < Redcar::EditTabCommand
|
73
|
-
|
75
|
+
|
74
76
|
def execute
|
75
77
|
@speedbar = SearchSpeedbar.new
|
76
78
|
if doc.selection?
|
@@ -79,13 +81,13 @@ module DocumentSearch
|
|
79
81
|
win.open_speedbar(@speedbar)
|
80
82
|
end
|
81
83
|
end
|
82
|
-
|
84
|
+
|
83
85
|
class RepeatPreviousSearchForwardCommand < Redcar::EditTabCommand
|
84
86
|
def execute
|
85
87
|
SearchSpeedbar.repeat_query
|
86
88
|
end
|
87
89
|
end
|
88
|
-
|
90
|
+
|
89
91
|
class SearchAndReplaceCommand < Redcar::EditTabCommand
|
90
92
|
def execute
|
91
93
|
@speedbar = SearchAndReplaceSpeedbar.new
|
@@ -101,51 +103,32 @@ module DocumentSearch
|
|
101
103
|
@re = re
|
102
104
|
@wrap = wrap
|
103
105
|
end
|
104
|
-
|
106
|
+
|
105
107
|
def to_s
|
106
108
|
"<#{self.class}: @re:#{@re.inspect} wrap:#{!!@wrap}>"
|
107
109
|
end
|
108
|
-
|
110
|
+
|
109
111
|
def execute
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
elsif doc.cursor_line < doc.line_count - 1
|
120
|
-
# next search the rest of the lines
|
121
|
-
found_line_offset = nil
|
122
|
-
found_line_num = nil
|
123
|
-
found_length = nil
|
124
|
-
line_nums = ((doc.cursor_line() + 1)..(doc.line_count() - 1)).to_a # the rest of the document
|
125
|
-
if @wrap
|
126
|
-
line_nums += (0..doc.cursor_line()).to_a
|
127
|
-
end
|
128
|
-
for line_num in line_nums do
|
129
|
-
curr_line = doc.get_line(line_num)
|
130
|
-
if new_offset = (curr_line.to_s =~ @re)
|
131
|
-
found_line_offset = new_offset
|
132
|
-
found_line_num = line_num
|
133
|
-
found_length = $&.length
|
134
|
-
break
|
135
|
-
end
|
136
|
-
end
|
137
|
-
if found_line_num
|
138
|
-
line_start = doc.offset_at_line(found_line_num)
|
139
|
-
startoff = line_start + found_line_offset
|
140
|
-
endoff = startoff + found_length
|
141
|
-
doc.scroll_to_line(found_line_num)
|
142
|
-
doc.set_selection_range(endoff, startoff)
|
143
|
-
true
|
144
|
-
else
|
145
|
-
false
|
146
|
-
end
|
112
|
+
position = doc.cursor_offset
|
113
|
+
sc = StringScanner.new(doc.get_all_text)
|
114
|
+
sc.pos = position
|
115
|
+
sc.scan_until(@re)
|
116
|
+
|
117
|
+
if @wrap and !sc.matched?
|
118
|
+
# No match was found in the remainder of the document, search from beginning
|
119
|
+
sc.reset
|
120
|
+
sc.scan_until(@re)
|
147
121
|
end
|
122
|
+
|
123
|
+
if sc.matched?
|
124
|
+
endoff = sc.pos
|
125
|
+
startoff = sc.pos - sc.matched_size
|
126
|
+
doc.set_selection_range(sc.pos, sc.pos - sc.matched_size)
|
127
|
+
doc.scroll_to_line(doc.line_at_offset(startoff))
|
128
|
+
return true
|
129
|
+
end
|
130
|
+
false
|
148
131
|
end
|
149
132
|
end
|
150
|
-
|
133
|
+
|
151
134
|
end
|