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

#194 improve marker cleanup #195

Merged
merged 2 commits into from
Jan 29, 2021
Merged

#194 improve marker cleanup #195

merged 2 commits into from
Jan 29, 2021

Conversation

nittka
Copy link
Collaborator

@nittka nittka commented Jun 21, 2020

Remove markers in included files as well, not only in the main file to
be compiled.

If you merge PR #192 first, I'd rebase this commit.

@nittka
Copy link
Collaborator Author

nittka commented Jun 24, 2020

I have rebased the branch. Ready for review.

(I have worked too much with gerrit lately - one PR=one commit, so it did not even occur to me, that I could have simply done the two fixes with two commits in one PR.)

@nittka nittka requested a review from thSoft June 24, 2020 16:42
@nittka
Copy link
Collaborator Author

nittka commented Jul 5, 2020

I am quite confident about this change and it is not a fundamentally new feature. However, I'd still appreciate your feedback before merging.

@thSoft thSoft linked an issue Jul 5, 2020 that may be closed by this pull request
Copy link
Owner

@thSoft thSoft left a comment

Choose a reason for hiding this comment

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

Unfortunately, this does not seem to work for me. Steps to reproduce:

  • Import project from issues-194.zip
  • In score2.ily line 8, change x to c
  • The error marker does not disappear

@nittka
Copy link
Collaborator Author

nittka commented Jul 6, 2020

Thanks for your feedback! This is indeed a "border-case" currently not covered. However, the cause is not the marker removal itself, but the calculation of included files.

The calculation is based on the index information of resolved references. But an include alone does not yet create such a reference. Only if you refer to a definition from an included file, such a reference is created. You can see the difference if you add musicRef=\music to the main ly-file.

Should I try to fix this "academic" case for this PR or should it be a separate issue.

@nittka
Copy link
Collaborator Author

nittka commented Jul 6, 2020

It turns out, the problem is even more border-line. Even if you add any real reference (like someRef=\trill) to the main file, it works. The scope provider is responsible for doing the the transitive include calculation. Without a reference it is not invoked (and it looks like the file has no includes at all).

Unfortunately it does not suffice to invoke the scope provider during validation - the linking and creation of the resource descriptions is already done at that point. Hopefully, I find a simple way to ensure the scope provider is at least invoked once...

@thSoft
Copy link
Owner

thSoft commented Jul 6, 2020

I see. If you find a simple fix, let's include also that one, otherwise I'd propose to track the scope calculation as a separate issue, rename #194 and I'll approve this PR.

@nittka
Copy link
Collaborator Author

nittka commented Jul 8, 2020

I had to do another bigger refactoring. The initial change was too simplistic. Removing the markers from all included files when saving one changed file is wrong: if you have several included files, each with a lilypond compile error, markers should be removed only from the changed file. Otherwise too much information is lost.

The PR now contains the following improvements:

  • recognize an included file, even if there are no Xtext references (the problem you indicated in your comment)
  • remove a lilypond marker also in changed included files (the actual bug reported)
  • update the decorators in the score library as well (before you had to do a manual refresh on the project or file in order for problem markers to disappear)
  • do not ask the user if compilation is to be continued (open dirty files) if lilypond compilation is not active during build

@nittka
Copy link
Collaborator Author

nittka commented Dec 31, 2020

If you are currently working on Elysium, could you have another look at the changes?

@thSoft
Copy link
Owner

thSoft commented Jan 3, 2021

Sorry for the delay. I'm updating my development environment and going to review this in one week if everything goes well.

@thSoft
Copy link
Owner

thSoft commented Jan 11, 2021

Unfortunately I stumbled into #197. I ask for your patience again, this might take one more week.

@thSoft thSoft modified the milestone: 0.7.0 Jan 18, 2021
@thSoft
Copy link
Owner

thSoft commented Jan 22, 2021

I'd like to try this out. Please rebase this branch to current master and provide manual test instructions to verify whether this works correctly. Thank you in advance!

If a file contains an include but no (Xtext) reference, the includes
have not been calculated by the scope provider. In this case invoke the
calculation when creating the Resourcedescriptions.
@nittka
Copy link
Collaborator Author

nittka commented Jan 23, 2021

OK to summarize: Compilation is executed only on the main ly-File. If the compiler finds problems in an included file, markers are created there.

  1. Previously, these markers were not removed if the problem was fixed and the main file was acutally recompiled. This problem is fixed by the PR.

  2. Also you indicated a problem with the initial attempt in #194 improve marker cleanup #195 (review)
    This problem has been addressed (check with the test project you provided).
    Typically Xtext creates crossreferences if they are needed (there is an actual reference), an include/import alone does not suffice. This PR ensures, that includes alone suffice to establish the reference.
    I.e. if x.ly includes y.ily without actually referencing a variable defined there, error markers in y.ily will be cleared if the problem was fixed and x.ly is recompiled.

  3. If compilation on save is enabled, you are asked whether you want to save an open dirty file before compilation starts. Previously, you were aske also if compilation on save was not enabled. This was annoying, because saving or not saving the file does not make a difference, if the compiler will not run.

Copy link
Owner

@thSoft thSoft left a comment

Choose a reason for hiding this comment

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

LGTM, I have just nitpicks.

Remove markers in included files as well, not only in the main file to
be compiled and update file decorations.
If lilypond compilation is not active, the user should not be asked
whether to continue with the compilation - it does not matter if there
are open dirty files.
@nittka
Copy link
Collaborator Author

nittka commented Jan 28, 2021

I have updated the PR accordingly

@nittka nittka merged commit d975859 into thSoft:master Jan 29, 2021
@nittka nittka deleted the ilyMarkerCleanup branch January 29, 2021 14:56
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.

Marker deletion in included files
2 participants