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

'Force Java compilation' breaks diagnostics in dirty files #834

Closed
snjeza opened this issue Oct 24, 2018 · 8 comments
Closed

'Force Java compilation' breaks diagnostics in dirty files #834

snjeza opened this issue Oct 24, 2018 · 8 comments

Comments

@snjeza
Copy link
Contributor

snjeza commented Oct 24, 2018

Steps to reproduce:

  • open a Java project
  • ensure that there is no diagnostic message
  • edit a Java file so you get a diagnostic message
  • do not save the file
  • call 'Force Java compilation'>Full

Diagnostic message disappears.

A solution would be to:

  • require a user to save all dirty files when calling 'Force Java compilation'
    or
  • revalidate opened compilation units after building the workspace
@tsmaeder
Copy link
Contributor

Does this scenario work in Eclipse?

require a user to save all dirty files when calling 'Force Java compilation'
or

Sorry, but no can do: we don't control the clients.

@snjeza
Copy link
Contributor Author

snjeza commented Oct 29, 2018

Does this scenario work in Eclipse?

It does.

@fbricon
Copy link
Contributor

fbricon commented Nov 13, 2018

actually it doesn't work in eclipse either.
Let's say you have Foo and Bar, with Bar extends Foo.
If both files are opened in Eclipse, rename Foo to NewFoo, Bar will extends NewFoo, won't appear as modified.
Now if Bar is dirty, rename Foo to NewFoo, then you'll see an error in Bar saying Foo cannot be resolved to a type
What works is if Bar is dirty, rename Foo to NewFoo directly from within Bar, then no errors will show up after. Bar will be saved

@fbricon
Copy link
Contributor

fbricon commented Nov 13, 2018

revalidate opened compilation units after building the workspace

could work, but I'm afraid that might cause a performance issue in the case of incremental builds when several hundreds of files are opened.
Might be worth pursuing though, at least to fix @yaohaizh's problem with renaming support in #840

@yaohaizh
Copy link
Contributor

@fbricon @snjeza In order to fix the diagnostic issue, I make some try in this commits: 3dc6a0c

It did fix the issue for rename type, but still not fixed the issue for renaming packages. So I would think we should save the files when renaming, which is the behavior of the eclipse.

Similar case for "Force Java Compiling"

@fbricon
Copy link
Contributor

fbricon commented Nov 20, 2018

In order to fix the diagnostic issue, I make some try in this commits: 3dc6a0c

can we get unit tests for that?

@fbricon fbricon added this to the End November 2018 milestone Nov 28, 2018
@fbricon
Copy link
Contributor

fbricon commented Nov 28, 2018

This seems fixed by @yaohaizh's PR #864. However, I'd like to see unit tests to ensure future non-regression

@snjeza
Copy link
Contributor Author

snjeza commented Dec 3, 2018

This seems fixed by @yaohaizh's PR #864. However, I'd like to see unit tests to ensure future non-regression

@yaohaizh has already created DocumentLifeCycleHandlerTest.testBasicBufferLifeCycleWithoutSave - See https://github.com/eclipse/eclipse.jdt.ls/blob/master/org.eclipse.jdt.ls.tests/src/org/eclipse/jdt/ls/core/internal/handlers/DocumentLifeCycleHandlerTest.java#L250

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants