redcar 0.9.2 → 0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +34 -4
- data/Rakefile +2 -1
- data/lib/redcar.rb +3 -3
- data/lib/redcar/installer.rb +2 -3
- data/plugins/application/features/step_definitions/dialog_steps.rb +7 -0
- data/plugins/application/features/step_definitions/key_steps.rb +18 -0
- data/plugins/application/features/step_definitions/menu_steps.rb +5 -6
- data/plugins/application/features/step_definitions/speedbar_steps.rb +29 -9
- data/plugins/application/features/step_definitions/tree_steps.rb +13 -0
- data/plugins/application/features/support/env.rb +39 -5
- data/plugins/application/features/support/fake_event.rb +12 -0
- data/plugins/application/lib/application.rb +5 -6
- data/plugins/application/lib/application/dialog.rb +53 -10
- data/plugins/application/lib/application/dialogs/modeless_list_dialog.rb +85 -0
- data/plugins/application/lib/application/keymap.rb +10 -8
- data/plugins/application/lib/application/menu.rb +38 -16
- data/plugins/application/lib/application/treebook.rb +30 -0
- data/plugins/application/lib/application/window.rb +20 -2
- data/plugins/application/spec/application/command/executor_spec.rb +1 -0
- data/plugins/application/spec/application/menu_spec.rb +26 -26
- data/plugins/application/spec/application/treebook_spec.rb +6 -6
- data/plugins/application/spec/spec_helper.rb +10 -1
- data/plugins/application_swt/lib/application_swt.rb +25 -3
- data/plugins/application_swt/lib/application_swt/dialog_adapter.rb +48 -27
- data/plugins/application_swt/lib/application_swt/dialogs/filter_list_dialog_controller.rb +22 -11
- data/plugins/application_swt/lib/application_swt/dialogs/modeless_dialog.rb +113 -0
- data/plugins/application_swt/lib/application_swt/dialogs/modeless_html_dialog.rb +85 -0
- data/plugins/application_swt/lib/application_swt/dialogs/modeless_list_dialog_controller.rb +143 -0
- data/plugins/application_swt/lib/application_swt/gradient.rb +61 -0
- data/plugins/application_swt/lib/application_swt/menu/binding_translator.rb +4 -4
- data/plugins/application_swt/lib/application_swt/notebook.rb +5 -8
- data/plugins/application_swt/lib/application_swt/speedbar.rb +1 -0
- data/plugins/application_swt/lib/application_swt/treebook.rb +6 -8
- data/plugins/application_swt/lib/application_swt/window.rb +85 -57
- data/plugins/application_swt/lib/swt/graphics_utils.rb +23 -0
- data/plugins/application_swt/lib/swt/vtab_folder.rb +7 -0
- data/plugins/application_swt/lib/swt/vtab_label.rb +1 -1
- data/plugins/application_swt/spec/application_swt/gradient_spec.rb +142 -0
- data/plugins/auto_completer/lib/auto_completer.rb +10 -42
- data/plugins/auto_completer/lib/auto_completer/list_dialog.rb +21 -0
- data/plugins/clojure/lib/clojure.rb +33 -0
- data/plugins/{repl/lib/repl/clojure_mirror.rb → clojure/lib/clojure/repl_mirror.rb} +16 -20
- data/plugins/clojure/plugin.rb +9 -0
- data/plugins/{repl/spec/repl/clojure_mirror_spec.rb → clojure/spec/clojure/repl_mirror_spec.rb} +12 -13
- data/plugins/clojure/spec/spec_helper.rb +5 -0
- data/plugins/{repl → clojure}/vendor/Wrapper.clj +0 -0
- data/plugins/{repl → clojure}/vendor/dummy +0 -0
- data/plugins/{repl → clojure}/vendor/enclojure-wrapper.jar +0 -0
- data/plugins/connection_manager/lib/connection_manager.rb +13 -13
- data/plugins/declarations/lib/declarations.rb +17 -6
- data/plugins/document_search/features/find.feature +389 -0
- data/plugins/document_search/features/find_and_replace.feature +723 -0
- data/plugins/document_search/features/replace.feature +69 -62
- data/plugins/document_search/lib/document_search.rb +81 -64
- data/plugins/document_search/lib/document_search/commands.rb +258 -0
- data/plugins/document_search/lib/document_search/find_and_replace_speedbar.rb +142 -0
- data/plugins/document_search/lib/document_search/find_speedbar.rb +102 -0
- data/plugins/document_search/lib/document_search/query_options.rb +45 -0
- data/plugins/edit_view/features/case_change.feature +9 -5
- data/plugins/edit_view/features/step_definitions/editing_steps.rb +19 -0
- data/plugins/edit_view/lib/edit_view.rb +15 -12
- data/plugins/edit_view/lib/edit_view/actions/arrow_keys.rb +12 -2
- data/plugins/edit_view/lib/edit_view/commands/text_conversion_commands.rb +1 -1
- data/plugins/edit_view/lib/edit_view/document.rb +129 -99
- data/plugins/edit_view_swt/lib/edit_view_swt.rb +33 -15
- data/plugins/encryption/encryption.rb +2 -0
- data/plugins/find-in-project/lib/find_in_project.rb +3 -5
- data/plugins/find-in-project/lib/find_in_project/views/index.html.erb +2 -0
- data/plugins/groovy/features/step_definitions/groovy_steps.rb +2 -2
- data/plugins/groovy/features/syntax_check_groovy.feature +3 -3
- data/plugins/groovy/lib/groovy.rb +38 -0
- data/plugins/groovy/lib/groovy/commands.rb +10 -0
- data/plugins/{repl/lib/repl/groovy_mirror.rb → groovy/lib/groovy/repl_mirror.rb} +33 -13
- data/plugins/groovy/lib/{syntax_check/groovy.rb → groovy/syntax_checker.rb} +13 -8
- data/plugins/groovy/plugin.rb +5 -4
- data/plugins/{repl/spec/repl/groovy_mirror_spec.rb → groovy/spec/groovy/repl_mirror_spec.rb} +14 -13
- data/plugins/groovy/spec/spec_helper.rb +5 -0
- data/plugins/html_view/assets/json2.js +476 -0
- data/plugins/html_view/lib/html_view.rb +1 -0
- data/plugins/java/features/fixtures/test.java +0 -0
- data/plugins/java/features/support/env.rb +27 -0
- data/plugins/java/features/syntax_check_java.feature +86 -0
- data/plugins/java/lib/syntax_check/java.rb +86 -0
- data/plugins/java/plugin.rb +7 -0
- data/plugins/javascript/features/fixtures/test2.js +5 -0
- data/plugins/javascript/features/step_definitions/javascript_steps.rb +16 -0
- data/plugins/javascript/features/support/env.rb +14 -0
- data/plugins/javascript/features/syntax_check_javascript.feature +46 -3
- data/plugins/javascript/lib/syntax_check/javascript.rb +15 -9
- data/plugins/line_tools/features/trim_line.feature +49 -0
- data/plugins/line_tools/lib/line_tools.rb +5 -1
- data/plugins/mirah/README +7 -0
- data/plugins/mirah/features/fixtures/test.mirah +2 -0
- data/plugins/mirah/features/syntax_check_mirah.feature +46 -0
- data/plugins/mirah/lib/mirah.rb +43 -0
- data/plugins/mirah/lib/mirah/my_error_handler.rb +22 -0
- data/plugins/mirah/lib/mirah/repl_mirror.rb +50 -0
- data/plugins/mirah/lib/mirah/syntax_checker.rb +38 -0
- data/plugins/mirah/plugin.rb +8 -0
- data/plugins/mirah/spec/mirah/repl_mirror_spec.rb +188 -0
- data/plugins/mirah/spec/spec_helper.rb +5 -0
- data/plugins/mirah/vendor/mirah-parser.jar +0 -0
- data/plugins/pair_highlighter/lib/pair_highlighter/document_controller.rb +24 -23
- data/plugins/plugin_manager_ui/lib/plugin_manager_ui.rb +10 -1
- data/plugins/plugin_manager_ui/views/index.html.erb +2 -0
- data/plugins/project/features/find_file.feature +40 -16
- data/plugins/project/features/highlight_focussed_tab.feature +16 -10
- data/plugins/project/features/step_definitions/find_file_steps.rb +11 -0
- data/plugins/project/features/step_definitions/project_tree_steps.rb +5 -1
- data/plugins/project/features/support/env.rb +5 -0
- data/plugins/project/lib/project/commands.rb +8 -1
- data/plugins/project/lib/project/dir_controller.rb +4 -1
- data/plugins/project/lib/project/find_file_dialog.rb +16 -12
- data/plugins/project/lib/project/manager.rb +30 -1
- data/plugins/project_search/vendor/lucene/CHANGELOG +147 -0
- data/plugins/project_search/vendor/lucene/CONTRIBUTORS +17 -0
- data/plugins/project_search/vendor/lucene/Gemfile +9 -0
- data/plugins/project_search/vendor/lucene/Gemfile.lock +33 -0
- data/plugins/project_search/vendor/lucene/LICENSE +19 -0
- data/plugins/project_search/vendor/lucene/README.rdoc +283 -0
- data/plugins/project_search/vendor/lucene/Rakefile +35 -0
- data/plugins/project_search/vendor/lucene/examples/active_model/serializers.rb +25 -0
- data/plugins/project_search/vendor/lucene/examples/active_model/validation.rb +26 -0
- data/plugins/project_search/vendor/lucene/examples/admin/Rakefile +4 -0
- data/plugins/project_search/vendor/lucene/examples/admin/admin.rb +29 -0
- data/plugins/project_search/vendor/lucene/examples/admin/public/jquery.js +4376 -0
- data/plugins/project_search/vendor/lucene/examples/admin/public/neo4j.css +153 -0
- data/plugins/project_search/vendor/lucene/examples/admin/public/neo_admin.js +18 -0
- data/plugins/project_search/vendor/lucene/examples/admin/spec/admin_spec.rb +26 -0
- data/plugins/project_search/vendor/lucene/examples/admin/views/index.erb +21 -0
- data/plugins/project_search/vendor/lucene/examples/filetree/README.rdoc +9 -0
- data/plugins/project_search/vendor/lucene/examples/filetree/app.rb +7 -0
- data/plugins/project_search/vendor/lucene/examples/filetree/batch.props +5 -0
- data/plugins/project_search/vendor/lucene/examples/filetree/features/step_definitions/add_steps.rb +121 -0
- data/plugins/project_search/vendor/lucene/examples/filetree/features/support/env.rb +30 -0
- data/plugins/project_search/vendor/lucene/examples/filetree/features/support/rspec_helper.rb +50 -0
- data/plugins/project_search/vendor/lucene/examples/filetree/features/treesizes.feature +19 -0
- data/plugins/project_search/vendor/lucene/examples/imdb/1_create_neo_db.rb +66 -0
- data/plugins/project_search/vendor/lucene/examples/imdb/2_index_db.rb +23 -0
- data/plugins/project_search/vendor/lucene/examples/imdb/README +12 -0
- data/plugins/project_search/vendor/lucene/examples/imdb/find_actors.rb +56 -0
- data/plugins/project_search/vendor/lucene/examples/imdb/install.sh +12 -0
- data/plugins/project_search/vendor/lucene/examples/imdb/model.rb +37 -0
- data/plugins/project_search/vendor/lucene/examples/railway/README +111 -0
- data/plugins/project_search/vendor/lucene/examples/railway/railnet-app.rb +31 -0
- data/plugins/project_search/vendor/lucene/examples/railway/railnet-data.rb +42 -0
- data/plugins/project_search/vendor/lucene/examples/rest/example.rb +41 -0
- data/plugins/project_search/vendor/lucene/examples/you_might_know/YouMightKnow.java +60 -0
- data/plugins/project_search/vendor/lucene/examples/you_might_know/all_simple_paths.rb +34 -0
- data/plugins/project_search/vendor/lucene/examples/you_might_know/nodes.rb +34 -0
- data/plugins/project_search/vendor/lucene/examples/you_might_know/you_might_know.rb +50 -0
- data/plugins/project_search/vendor/lucene/lib/lucene.rb +15 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/config.rb +145 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/document.rb +96 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/field_info.rb +144 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/hits.rb +54 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/index.rb +267 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/index_info.rb +146 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/index_searcher.rb +157 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/jars.rb +5 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/query_dsl.rb +135 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/transaction.rb +117 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/version.rb +3 -0
- data/plugins/project_search/vendor/lucene/lucene.gemspec +23 -0
- data/plugins/project_search/vendor/lucene/spec/lucene/document_spec.rb +32 -0
- data/plugins/project_search/vendor/lucene/spec/lucene/field_info_spec.rb +70 -0
- data/plugins/project_search/vendor/lucene/spec/lucene/index_info_spec.rb +76 -0
- data/plugins/project_search/vendor/lucene/spec/lucene/index_spec.rb +643 -0
- data/plugins/project_search/vendor/lucene/spec/lucene/query_dsl_spec.rb +142 -0
- data/plugins/project_search/vendor/lucene/spec/lucene/sort_spec.rb +101 -0
- data/plugins/project_search/vendor/lucene/spec/lucene/spec_helper.rb +10 -0
- data/plugins/project_search/vendor/lucene/spec/lucene/transaction_spec.rb +118 -0
- data/plugins/redcar/features/alter_font_size.feature +25 -0
- data/plugins/redcar/features/step_definitions/font_steps.rb +34 -0
- data/plugins/redcar/redcar.rb +256 -43
- data/plugins/repl/features/command_editing.feature +55 -0
- data/plugins/repl/features/command_history.feature +75 -0
- data/plugins/repl/features/step_definitions/repl_steps.rb +17 -1
- data/plugins/repl/features/support/env.rb +24 -0
- data/plugins/repl/features/support/fake_repl.rb +16 -0
- data/plugins/repl/lib/repl.rb +17 -74
- data/plugins/repl/lib/repl/repl_command.rb +20 -0
- data/plugins/repl/lib/repl/repl_mirror.rb +168 -22
- data/plugins/repl/lib/repl/repl_tab.rb +131 -6
- data/plugins/repl/plugin.rb +1 -1
- data/plugins/repl/spec/repl/repl_mirror_spec.rb +72 -0
- data/plugins/repl/spec/spec_helper.rb +1 -1
- data/plugins/repl_swt/lib/repl_swt.rb +7 -0
- data/plugins/repl_swt/lib/repl_swt/key_listener.rb +43 -0
- data/plugins/repl_swt/plugin.rb +8 -0
- data/plugins/ruby/lib/ruby.rb +35 -0
- data/plugins/{repl/lib/repl/ruby_mirror.rb → ruby/lib/ruby/repl_mirror.rb} +12 -12
- data/plugins/ruby/lib/{syntax_check/ruby.rb → ruby/syntax_checker.rb} +3 -3
- data/plugins/ruby/plugin.rb +5 -4
- data/plugins/{repl/spec/repl/ruby_mirror_spec.rb → ruby/spec/ruby/repl_mirror_spec.rb} +38 -29
- data/plugins/ruby/spec/spec_helper.rb +5 -0
- data/plugins/runnables/lib/runnables.rb +2 -0
- data/plugins/runnables/lib/runnables/command_output_controller.rb +5 -0
- data/plugins/runnables/lib/runnables/output_processor.rb +14 -3
- data/plugins/runnables/views/command_output.html.erb +3 -2
- data/plugins/scm/lib/scm.rb +4 -2
- data/plugins/scm/lib/scm/diff_mirror.rb +6 -6
- data/plugins/scm_git/lib/scm_git.rb +136 -107
- data/plugins/scm_git/lib/scm_git/change.rb +28 -19
- data/plugins/snippets/lib/snippets/explorer.rb +2 -2
- data/plugins/swt/lib/swt/full_swt.rb +1 -0
- data/plugins/syntax_check/features/step_definitions/syntax_check_steps.rb +4 -0
- data/plugins/syntax_check/features/support/env.rb +3 -0
- data/plugins/syntax_check/lib/syntax_check.rb +71 -5
- data/plugins/syntax_check/lib/syntax_check/annotation.rb +61 -0
- data/plugins/test_runner/lib/test_runner.rb +39 -0
- data/plugins/test_runner/lib/test_runner/rspec_runner.rb +20 -0
- data/plugins/test_runner/lib/test_runner/run_test_command.rb +63 -0
- data/plugins/test_runner/lib/test_runner/runnable_test_runner.rb +26 -0
- data/plugins/test_runner/plugin.rb +8 -0
- data/plugins/test_runner/spec/run_test_command_spec.rb +51 -0
- data/plugins/test_runner/spec/spec_helper.rb +5 -0
- data/plugins/textmate/lib/textmate.rb +12 -2
- data/plugins/textmate/vendor/redcar-bundles/Bundles/HTML.tmbundle/Syntaxes/HTML.plist +0 -2
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Mirah.tmbundle/Syntaxes/Mirah.plist +22 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Mirah.tmbundle/info.plist +12 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Ruby.tmbundle/Syntaxes/Ruby.plist +2 -0
- data/plugins/todo_list/lib/todo_list.rb +7 -0
- data/plugins/todo_list/lib/todo_list/todo_controller.rb +3 -1
- data/plugins/tree/lib/tree.rb +4 -0
- data/plugins/tree_view_swt/lib/tree_view_swt.rb +5 -0
- data/plugins/web_bookmarks/lib/web_bookmarks.rb +10 -0
- metadata +137 -22
- data/plugins/document_search/features/search.feature +0 -163
- data/plugins/document_search/lib/document_search/replace_all_command.rb +0 -27
- data/plugins/document_search/lib/document_search/replace_command.rb +0 -38
- data/plugins/document_search/lib/document_search/replace_next_command.rb +0 -27
- data/plugins/document_search/lib/document_search/search_and_replace.rb +0 -81
- data/plugins/ruby/README +0 -6
File without changes
|
@@ -0,0 +1,27 @@
|
|
1
|
+
After do
|
2
|
+
# Truncate the test file
|
3
|
+
File.open(File.expand_path("../../fixtures/test.java", __FILE__), "w")
|
4
|
+
|
5
|
+
#recreate the classpath file
|
6
|
+
File.open(File.expand_path("../../fixtures/.redcar/classpath.groovy", __FILE__), "w") do |f|
|
7
|
+
f.puts <<-CONFIG
|
8
|
+
def redcar_config = new File(getClass().protectionDomain.codeSource.location.path).parentFile
|
9
|
+
def project = redcar_config.parentFile
|
10
|
+
def classpath = []
|
11
|
+
|
12
|
+
//installed libraries
|
13
|
+
def lib = new File(project.path + File.separator + "lib")
|
14
|
+
lib.list().each {name -> classpath << lib.path+File.separator+name}
|
15
|
+
|
16
|
+
//compiled classes
|
17
|
+
def target_classes = new File(
|
18
|
+
project.path + File.separator +
|
19
|
+
"target" + File.separator +
|
20
|
+
"classes"
|
21
|
+
)
|
22
|
+
classpath << target_classes.path
|
23
|
+
|
24
|
+
return classpath.toArray()
|
25
|
+
CONFIG
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
Feature: Syntax Checking for Java
|
2
|
+
As a user
|
3
|
+
I want to get annotations on syntax errors in Java files
|
4
|
+
|
5
|
+
Background:
|
6
|
+
When I have opened "plugins/java/features/fixtures/test.java"
|
7
|
+
|
8
|
+
Scenario: A syntax-clean Java file has no syntax error annotations
|
9
|
+
When I replace the contents with "class Foo {\n\n}"
|
10
|
+
And I save the tab
|
11
|
+
Then the tab should not have annotations
|
12
|
+
|
13
|
+
Scenario: A syntax-error in a Java file should cause syntax error annotations
|
14
|
+
When I replace the contents with "class Foo {\n int\n}"
|
15
|
+
And I save the tab
|
16
|
+
And I wait "2.5" seconds
|
17
|
+
Then the tab should have annotations
|
18
|
+
And the tab should have an annotation on line 2
|
19
|
+
|
20
|
+
Scenario: Fixing a syntax-error in a Java file should cause syntax error annotations to vanish
|
21
|
+
When I replace the contents with "class Foo {\n int\n}"
|
22
|
+
And I save the tab
|
23
|
+
And I wait "2.5" seconds
|
24
|
+
Then the tab should have annotations
|
25
|
+
When I replace the contents with "class Foo {\n\n}"
|
26
|
+
And I wait "2.5" seconds
|
27
|
+
And I save the tab
|
28
|
+
Then the tab should not have annotations
|
29
|
+
|
30
|
+
Scenario: If java is excluded from being checked, I should see no syntax errors
|
31
|
+
Given I excluded "java" files from being checked for syntax errors
|
32
|
+
When I replace the contents with "class Foo {\n int\n}"
|
33
|
+
And I save the tab
|
34
|
+
And I wait "2.5" seconds
|
35
|
+
Then the tab should not have annotations
|
36
|
+
|
37
|
+
Scenario: A file which references unknown java classes should cause syntax error annotations
|
38
|
+
And I replace the contents with "class Foo {\n Bar x = new Bar(10);\n FooBar y = new FooBar();\n}"
|
39
|
+
And I save the tab
|
40
|
+
And I wait "2.5" seconds
|
41
|
+
Then the tab should have annotations
|
42
|
+
And the tab should have an annotation on line 2
|
43
|
+
|
44
|
+
Scenario: A project can add libraries and compiled class directories to the java classpath
|
45
|
+
When I will choose "plugins/java/features/fixtures" from the "open_directory" dialog
|
46
|
+
And I open a directory
|
47
|
+
And I replace the contents with "class Foo {\n Bar x = new Bar(10);\n FooBar y = new FooBar();\n}"
|
48
|
+
And I save the tab
|
49
|
+
And I wait "2.5" seconds
|
50
|
+
Then the tab should not have annotations
|
51
|
+
|
52
|
+
Scenario: If a project classpath.java file has syntax errors, there should be an error message and annotations
|
53
|
+
And I close the focussed tab
|
54
|
+
Given I have not suppressed syntax checking message dialogs
|
55
|
+
When I will choose "plugins/java/features/fixtures" from the "open_directory" dialog
|
56
|
+
And I open a directory
|
57
|
+
And I have opened "plugins/java/features/fixtures/.redcar/classpath.groovy"
|
58
|
+
And I replace the contents with "def x = 4\nsdef"
|
59
|
+
And I save the tab
|
60
|
+
Then I should see a message box containing "An error occurred while loading classpath file"
|
61
|
+
|
62
|
+
Scenario: If an error occurs while parsing a java file, there should be an error message
|
63
|
+
Given I have not suppressed syntax checking message dialogs
|
64
|
+
When I will choose "plugins/java/features/fixtures" from the "open_directory" dialog
|
65
|
+
And I open a directory
|
66
|
+
And I add "lib2" to the "java" classpath
|
67
|
+
And I replace the contents with "class Foo {\n Bar x = new Bar(10);\n FooBaz y = new FooBaz();\n}"
|
68
|
+
And I save the tab
|
69
|
+
Then I should see a message box containing "An error occurred while parsing"
|
70
|
+
And the tab should not have annotations
|
71
|
+
|
72
|
+
Scenario: If syntax message dialogs are suppressed, I should see no message boxes
|
73
|
+
Given I have suppressed syntax checking message dialogs
|
74
|
+
When I will choose "plugins/java/features/fixtures" from the "open_directory" dialog
|
75
|
+
And I open a directory
|
76
|
+
And I have opened "plugins/java/features/fixtures/.redcar/classpath.groovy"
|
77
|
+
And I replace the contents with "sdef"
|
78
|
+
And I save the tab
|
79
|
+
And I wait "2.5" seconds
|
80
|
+
Then the tab should not have annotations
|
81
|
+
When I close the focussed tab
|
82
|
+
And I add "lib2" to the "java" classpath
|
83
|
+
And I replace the contents with "class Foo {\n Bar x = new Bar(10);\n FooBaz y = new FooBaz();\n}"
|
84
|
+
And I save the tab
|
85
|
+
And I wait "2.5" seconds
|
86
|
+
And the tab should have annotations
|
@@ -0,0 +1,86 @@
|
|
1
|
+
require 'java'
|
2
|
+
require 'open3'
|
3
|
+
module Redcar
|
4
|
+
module SyntaxCheck
|
5
|
+
class Java < Checker
|
6
|
+
supported_grammars "Java"
|
7
|
+
|
8
|
+
def check(*args)
|
9
|
+
path = manifest_path(doc)
|
10
|
+
name = File.basename(path)
|
11
|
+
temp = java.lang.System.getProperty('java.io.tmpdir')
|
12
|
+
if t = Java.thread and t.alive? and t[:java]
|
13
|
+
t.exit
|
14
|
+
SyntaxCheck.remove_syntax_error_annotations(doc.edit_view)
|
15
|
+
end
|
16
|
+
Java.thread=Thread.new do
|
17
|
+
Thread.current[:java] = true
|
18
|
+
begin
|
19
|
+
cmd = "javac -d #{temp}"
|
20
|
+
if project = Project::Manager.focussed_project and
|
21
|
+
cpath = classpath(project)
|
22
|
+
cmd << " -cp \"#{cpath}\""
|
23
|
+
end
|
24
|
+
stdin,stdout,err = Open3.popen3("#{cmd} #{path}")
|
25
|
+
err.each_line do |msg|
|
26
|
+
if msg =~ /#{Regexp.escape(name)}:(\d+):(.*)/
|
27
|
+
SyntaxCheck::Error.new(doc, $1.to_i - 1, $2).annotate
|
28
|
+
sleep 1
|
29
|
+
end
|
30
|
+
end
|
31
|
+
rescue Object => e
|
32
|
+
SyntaxCheck.message(
|
33
|
+
"An error occurred while parsing #{name}: #{e.message}", :error)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def classpath_files(project)
|
39
|
+
project.config_files("classpath.groovy")
|
40
|
+
end
|
41
|
+
|
42
|
+
def classpath(project)
|
43
|
+
unless @loaded
|
44
|
+
require File.join(Redcar.asset_dir,"groovy-all")
|
45
|
+
import 'groovy.lang.GroovyShell'
|
46
|
+
import 'org.codehaus.groovy.control.CompilationFailedException'
|
47
|
+
import 'org.codehaus.groovy.control.CompilerConfiguration'
|
48
|
+
@loaded = true
|
49
|
+
end
|
50
|
+
parts = []
|
51
|
+
shell = GroovyShell.new
|
52
|
+
files = classpath_files(project)
|
53
|
+
return unless files.any?
|
54
|
+
files.each do |path|
|
55
|
+
begin
|
56
|
+
file = java.io.File.new(path)
|
57
|
+
part = shell.run(file, [])
|
58
|
+
parts += part if part
|
59
|
+
rescue Object => e
|
60
|
+
SyntaxCheck.message(
|
61
|
+
"An error occurred while loading classpath file #{path}: #{e.message}",:error)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
build_classpath(parts)
|
65
|
+
end
|
66
|
+
|
67
|
+
def build_classpath(parts)
|
68
|
+
composite = ""
|
69
|
+
separator = java.lang.System.getProperty('path.separator')
|
70
|
+
parts.each {|p| composite << p+separator}
|
71
|
+
composite[0,composite.length-1] if composite.length > 0
|
72
|
+
composite
|
73
|
+
end
|
74
|
+
|
75
|
+
private
|
76
|
+
|
77
|
+
def self.thread
|
78
|
+
@thread
|
79
|
+
end
|
80
|
+
|
81
|
+
def self.thread=(thread)
|
82
|
+
@thread = thread
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
When /^I save the tab (\d+) times and wait (\d+) seconds each time$/ do |count,time|
|
2
|
+
count = count.to_i
|
3
|
+
time = time.to_i
|
4
|
+
(1..count).each do |i|
|
5
|
+
begin
|
6
|
+
When "I save the tab"
|
7
|
+
When "I wait #{time} seconds"
|
8
|
+
rescue => e
|
9
|
+
add_exception(e)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
Then /^the tab should not have thrown SWT concurrency exceptions$/ do
|
15
|
+
exception_count.should == 0
|
16
|
+
end
|
@@ -1,4 +1,18 @@
|
|
1
1
|
After do
|
2
2
|
# Truncate the test file
|
3
3
|
File.open(File.expand_path("../../fixtures/test.js", __FILE__), "w")
|
4
|
+
@exceptions = 0
|
5
|
+
end
|
6
|
+
|
7
|
+
Before do
|
8
|
+
@exceptions = 0
|
9
|
+
end
|
10
|
+
|
11
|
+
def add_exception(e)
|
12
|
+
@exceptions = @exceptions + 1
|
13
|
+
p e.message
|
14
|
+
end
|
15
|
+
|
16
|
+
def exception_count
|
17
|
+
@exceptions
|
4
18
|
end
|
@@ -13,15 +13,58 @@ Feature: Syntax Checking for JavaScript
|
|
13
13
|
Scenario: A syntax-error in a JavaScript file should cause syntax error annotations
|
14
14
|
When I replace the contents with "var foo = 1;\nbar"
|
15
15
|
And I save the tab
|
16
|
-
And I wait
|
16
|
+
And I wait 2 seconds
|
17
17
|
Then the tab should have annotations
|
18
18
|
And the tab should have an annotation on line 2
|
19
19
|
|
20
20
|
Scenario: Fixing a syntax-error in a JavaScript file should cause syntax error annotations to vanish
|
21
21
|
When I replace the contents with "var foo = 1;\nbar"
|
22
22
|
And I save the tab
|
23
|
-
And I wait
|
23
|
+
And I wait 2 seconds
|
24
24
|
Then the tab should have annotations
|
25
25
|
When I replace the contents with "var foo = 1;\nvar bar;"
|
26
26
|
And I save the tab
|
27
|
-
Then the tab should not have annotations
|
27
|
+
Then the tab should not have annotations
|
28
|
+
|
29
|
+
Scenario: Checking for syntax errors on a file with syntax errors should not cause concurrency errors
|
30
|
+
When I replace the contents with "foo\nbar\nfunction\nbax\nboo\nbonne"
|
31
|
+
And I save the tab 10 times and wait 2 seconds each time
|
32
|
+
Then the tab should not have thrown SWT concurrency exceptions
|
33
|
+
|
34
|
+
Scenario: Checking for syntax errors between two different error-throwing files should not cause concurrency errors
|
35
|
+
When I replace the contents with "foo\nbar\nfunction\nbax\nboo\nbonne"
|
36
|
+
And I have opened "plugins/javascript/features/fixtures/test2.js"
|
37
|
+
And I replace the contents with "boo foo\nbaz\nbee\nbaux\nbeau"
|
38
|
+
And I save the tab
|
39
|
+
And I wait 1 seconds
|
40
|
+
And I switch up a tab
|
41
|
+
And I save the tab
|
42
|
+
And I wait 1 seconds
|
43
|
+
And I switch down a tab
|
44
|
+
And I save the tab
|
45
|
+
And I wait 1 seconds
|
46
|
+
And I switch up a tab
|
47
|
+
And I save the tab
|
48
|
+
And I wait 1 seconds
|
49
|
+
Then the tab should not have thrown SWT concurrency exceptions
|
50
|
+
And the tab should have annotations
|
51
|
+
When I switch down a tab
|
52
|
+
Then the tab should have annotations
|
53
|
+
|
54
|
+
Scenario: Checking rapidly for syntax errors between two files should not cause concurrency errors
|
55
|
+
When I replace the contents with "foo\nbar\nfunction\nbax\nboo\nbonne"
|
56
|
+
And I have opened "plugins/javascript/features/fixtures/test2.js"
|
57
|
+
And I replace the contents with "boo foo\nbaz\nbee\nbaux\nbeau"
|
58
|
+
And I save the tab
|
59
|
+
And I switch up a tab
|
60
|
+
And I save the tab
|
61
|
+
And I switch down a tab
|
62
|
+
And I save the tab
|
63
|
+
And I switch up a tab
|
64
|
+
And I save the tab
|
65
|
+
And I wait 5 seconds
|
66
|
+
Then the tab should not have thrown SWT concurrency exceptions
|
67
|
+
And the tab should have annotations
|
68
|
+
When I switch down a tab
|
69
|
+
Then the tab should have annotations
|
70
|
+
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'java'
|
2
1
|
|
3
2
|
module Redcar
|
4
3
|
module SyntaxCheck
|
@@ -14,21 +13,28 @@ module Redcar
|
|
14
13
|
File.join(Redcar.asset_dir,'js.jar')
|
15
14
|
end
|
16
15
|
|
16
|
+
def main_method
|
17
|
+
"org.mozilla.javascript.tools.shell.Main"
|
18
|
+
end
|
19
|
+
|
17
20
|
def check(*args)
|
18
|
-
path
|
19
|
-
name
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
path = manifest_path(doc)
|
22
|
+
name = File.basename(path)
|
23
|
+
if t = JavaScript.thread and t.alive?
|
24
|
+
if t[:doc] and t[:doc] == doc
|
25
|
+
t.exit
|
26
|
+
SyntaxCheck.remove_syntax_error_annotations(doc.edit_view)
|
27
|
+
end
|
24
28
|
end
|
25
29
|
JavaScript.thread=Thread.new do
|
26
|
-
|
30
|
+
SyntaxCheck.remove_syntax_error_annotations(doc.edit_view)
|
31
|
+
Thread.current[:doc] = doc
|
27
32
|
begin
|
28
|
-
output = `java -cp #{rhino_path}
|
33
|
+
output = `java -cp #{rhino_path} #{main_method} #{jslint_path} #{path}`
|
29
34
|
output.each_line do |line|
|
30
35
|
if line =~ /Lint at line (\d+) character (\d+): (.*)/
|
31
36
|
SyntaxCheck::Error.new(doc, $1.to_i-1, $3).annotate
|
37
|
+
sleep 1
|
32
38
|
end
|
33
39
|
end
|
34
40
|
rescue Object => e
|
@@ -22,3 +22,52 @@ Scenario: Trimming a line with unicode
|
|
22
22
|
And I move the cursor to 5
|
23
23
|
And I trim the line
|
24
24
|
Then the contents should be "foo\nb\nbaz"
|
25
|
+
|
26
|
+
Scenario: Trimming a line with Windows line endings
|
27
|
+
When I open a new edit tab
|
28
|
+
And I replace the contents with "foo\r\nbść\r\nbaz"
|
29
|
+
And I move the cursor to 6
|
30
|
+
And I trim the line
|
31
|
+
Then the contents should be "foo\r\nb\r\nbaz"
|
32
|
+
|
33
|
+
Scenario: Trimming empty line removes newline character
|
34
|
+
When I open a new edit tab
|
35
|
+
And I replace the contents with "foo\n\nbaz"
|
36
|
+
And I move the cursor to 4
|
37
|
+
And I trim the line
|
38
|
+
Then the contents should be "foo\nbaz"
|
39
|
+
|
40
|
+
Scenario: Trimming empty line removes newline character (Windows)
|
41
|
+
When I open a new edit tab
|
42
|
+
And I replace the contents with "foo\r\n\r\nbaz"
|
43
|
+
And I move the cursor to 5
|
44
|
+
And I trim the line
|
45
|
+
Then the contents should be "foo\r\nbaz"
|
46
|
+
|
47
|
+
Scenario: Trimming when at end of line removes newline character
|
48
|
+
When I open a new edit tab
|
49
|
+
And I replace the contents with "foo\nbść\nbaz"
|
50
|
+
And I move the cursor to 7
|
51
|
+
And I trim the line
|
52
|
+
Then the contents should be "foo\nbśćbaz"
|
53
|
+
|
54
|
+
Scenario: Trimming when at end of file and newline absent it does nothing
|
55
|
+
When I open a new edit tab
|
56
|
+
And I replace the contents with "foo\nbść\nbaz"
|
57
|
+
And I move the cursor to 11
|
58
|
+
And I trim the line
|
59
|
+
Then the contents should be "foo\nbść\nbaz"
|
60
|
+
|
61
|
+
Scenario: Trimming when just before last newline character it removes it
|
62
|
+
When I open a new edit tab
|
63
|
+
And I replace the contents with "foo\nbść\nbaz\n"
|
64
|
+
And I move the cursor to 11
|
65
|
+
And I trim the line
|
66
|
+
Then the contents should be "foo\nbść\nbaz"
|
67
|
+
|
68
|
+
Scenario: Trimming when at end of file and newline present it does nothing
|
69
|
+
When I open a new edit tab
|
70
|
+
And I replace the contents with "foo\nbść\nbaz\n"
|
71
|
+
And I move the cursor to 12
|
72
|
+
And I trim the line
|
73
|
+
Then the contents should be "foo\nbść\nbaz\n"
|
@@ -92,7 +92,11 @@ module Redcar
|
|
92
92
|
text = doc.get_slice(offset, doc.offset_at_line_end(line_ix))
|
93
93
|
end
|
94
94
|
doc.controllers(Redcar::AutoIndenter::DocumentController).first.disable do
|
95
|
-
doc.
|
95
|
+
if text == doc.line_delimiter or text == ""
|
96
|
+
doc.replace(offset, text.split(//).length, "")
|
97
|
+
else
|
98
|
+
doc.replace(offset, text.split(//).length, doc.line_delimiter)
|
99
|
+
end
|
96
100
|
end
|
97
101
|
#doc.cursor_offset = doc.cursor_offset - 1
|
98
102
|
end
|