Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial implementation for code actions #155

Merged
merged 2 commits into from Feb 16, 2017

Conversation

gorkem
Copy link
Contributor

@gorkem gorkem commented Feb 15, 2017

Implements “insert quotes” and remove import
code actions. Lays the groundwork for more
code actions.

Signed-off-by: Gorkem Ercan gorkem.ercan@gmail.com

@fbricon
Copy link
Contributor

fbricon commented Feb 16, 2017

run tests

params.setRange(range);
params.setContext(new CodeActionContext(Arrays.asList(getDiagnostic(Integer.toString(IProblem.UnusedImport), range))));
List<? extends Command> commands = server.codeAction(params).join();
Assert.assertFalse(commands.isEmpty());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checking isEmpty is useless when checking the size on next line

params.setRange(range);
params.setContext(new CodeActionContext(Arrays.asList(getDiagnostic(Integer.toString(IProblem.UnterminatedString), range))));
List<? extends Command> commands = server.codeAction(params).join();
Assert.assertFalse(commands.isEmpty());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checking isEmpty is useless when checking the size on next line

*
*/
@RunWith(MockitoJUnitRunner.class)
public class CodeActionHandlerTest extends AbstractCompletionBasedTest {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd probably make that class abstract and have separate test classes to check separate code actions

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the benefit?

Copy link
Contributor

@fbricon fbricon Feb 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm expecting we'll see lots of different code actions, cramming everything under the same test class is gonna be messy

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A class per code actions is not less messy either. When we have a lot of code actions, we can think of a way to organize the tests. probably around common actions such as unused code etc.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok. No biggie

@fbricon
Copy link
Contributor

fbricon commented Feb 16, 2017

+1 to apply, once the conflict is resolved

Implements “insert quotes” and remove import
code actions. Lays the groundwork for more
code actions.

Signed-off-by: Gorkem Ercan <gorkem.ercan@gmail.com>
Add tests for the implemented code actions.

Signed-off-by: Gorkem Ercan <gorkem.ercan@gmail.com>
@gorkem gorkem merged commit ed2a336 into eclipse-jdtls:master Feb 16, 2017
@gorkem gorkem deleted the code_actions/initial branch February 17, 2017 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants