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

Renaming or creating a java file requires restart #486

Merged
merged 1 commit into from
Dec 13, 2017

Conversation

snjeza
Copy link
Contributor

@snjeza snjeza commented Dec 7, 2017

Fixes redhat-developer/vscode-java#380

Signed-off-by: Snjezana Peco [email protected]

@snjeza snjeza requested review from gorkem and fbricon December 7, 2017 18:00
private ICompilationUnit createCompilationUnit(ICompilationUnit unit) {
try {
unit.getResource().refreshLocal(IResource.DEPTH_ONE, new NullProgressMonitor());
if (unit.getResource().exists()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't we check the resource exists BEFORE refreshing it?

Copy link
Contributor

Choose a reason for hiding this comment

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

this method is largely similar to the block you modified in DocumentLifeCycleHandler.handleOpen, yet the conditions are different. Here the resource needs to exists, in handleOpen, it must not be accessible (doesn't exist). Seems dubious. Both places should probably be refactored to call the same logic

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The resource must exist after refreshing.

@fbricon
Copy link
Contributor

fbricon commented Dec 7, 2017

@snjeza can we have some integration tests here or is it too complex?

@snjeza
Copy link
Contributor Author

snjeza commented Dec 7, 2017

@fbricon I will try to create a test.

@snjeza
Copy link
Contributor Author

snjeza commented Dec 8, 2017

@fbricon I have updated the PR.

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.

3 participants