ceylon-ide-intellij icon indicating copy to clipboard operation
ceylon-ide-intellij copied to clipboard

model updates should not block purely-local refactorings

Open gavinking opened this issue 9 years ago • 5 comments

For example, right now I can't Inline a local value when a model update is in progress.

gavinking avatar Sep 07 '16 09:09 gavinking

I can do the scenario you described. For example in AbstractIntention, which is large enough to produce model updates that last 1-2s, I added the following code:

        value h = "h";
        print(h);

After forcing an update using ⌘⌥U, I can inline h while the model is being updated.

bjansen avatar Sep 09 '16 13:09 bjansen

it probably depends on the project for on model update is running. In your case you have 2 project with one depending on the other. You should probably test with a full model update, ensure you're testing during a model update on the right project by looking in the status bar.

davidfestal avatar Sep 09 '16 13:09 davidfestal

One thing that is not possible is calling intentions when the editor is reparsing the files and recomputing all the annotations (just after the model update), i.e. the short period when all the gutter icons and warnings are removed from the editor before being redrawn. I think that's a limitation in the IDE though.

bjansen avatar Sep 09 '16 13:09 bjansen

You should probably test with a full model update, ensure you're testing during a model update on the right project by looking in the status bar.

Well, during a full model udpate in plugin-ceylon-code, I can call one intention, but once it has been applied, the file has to be reparsed in order to compute the new intentions, and for that to work we currently need to wait for the model update to finish.

bjansen avatar Sep 09 '16 13:09 bjansen

From what I understand:

  • during full model updates, the model manager holds a lock while typechecking source files
  • when you modify a file during full model updates, it cannot be locally typechecked because it can't acquire a lock on the model
  • quick assists and refactorings like Inline currently need a typechecked phased unit, which cannot be computed because of the two previous points

I'm wondering if it is safe to use the "last typechecked phased unit" in refactorings/assists, I think in some cases it could cause problems.

I'm moving this issue to 1.3.5 because I won't have time to fix it before the release.

bjansen avatar Sep 13 '16 10:09 bjansen