martineausimon / nvim-lilypond-suite

Neovim plugin for writing LilyPond scores, with asynchronous make, midi/mp3 player, fast syntax highlighting, "hyphenation" function, and support for LaTex and Texinfo files
GNU General Public License v3.0
130 stars 11 forks source link

Slurs break syntax highlighting with `\editionMod` #18

Closed niveK77pur closed 1 year ago

niveK77pur commented 1 year ago

The issue

First off, I should mention that everything works as expected inside a "normal" Lilypond file!

I have started to use the edition engraver to apply tweaks to my score. For the first time now, I also tried setting slurs using the edition engraver, as opposed to directly putting them into the main lilypond source files. However, the slurs cause the syntax highlighting to break and many elements won't be highlighted anymore. I have attached a few screenshots below. (I also attached a sample file to test with)

I also tried the syntax highlighting provided by lilypond. There appears to be no highlights defined whatsoever for the edition engraver, which makes me assume that this plugin includes a few special syntax highlights for these.

Screenshots

Using nvim-lilypond-suite's highlighting

With the slurs

image

Without the slurs

I simply commented out all lines containing slurs to show/see what the syntax highlighting should look like.

image

Using Lilypond's highlighting

With the slurs

image

Without the slurs

image

Sample file

Here is the file containing all the \editionMods, which I \include into the main lilypond file.

\include "global.ly"

\consistToContexts #edition-engraver Score.PianoStaff.Staff.Voice
\consistToContexts #edition-engraver Score.PianoStaff.Dynamics

\addEdition tweaks
\addEdition fingering
\addEdition dynamics
\addEdition articulations

\editionMod dynamics 2 0/4 music.Dynamics \p

\editionMod articulations 4 5/8 music.Voice.A \(
\editionMod articulations 7 0/8 music.Voice.A \)

\editionMod dynamics 9 0/4 music.Dynamics \sf
\editionMod articulations 9 0/4 music.Voice.A \(

\editionMod dynamics 10 0/4 music.Dynamics \mp

\editionMod articulations 12 0/4 music.Voice.A \)
\editionMod articulations 12 3/4 music.Voice.A \(

\editionMod articulations 13 0/4 music.Voice.A \)

\editionMod dynamics 15 0/4 music.Dynamics \sf
\editionMod articulations 15 0/4 music.Voice.A \(

\editionMod dynamics 16 0/4 music.Dynamics \mp
\editionMod tweaks 16 0/4 music.Dynamics \once\override DynamicText.X-offset = #-0.5

\editionMod articulations 18 0/4 music.Voice.A \)
\editionMod articulations 18 3/4 music.Voice.A \(

\editionMod articulations 19 0/4 music.Voice.A \)

\editionMod dynamics 21 0/4 music.Dynamics \mf
\editionMod articulations 21 0/4 music.Voice.A \(
\editionMod articulations 21 3/4 music.Voice.A \)

\editionMod articulations 22 0/4 music.Voice.A \(

\editionMod articulations 23 1/4 music.Voice.A \)

\editionMod dynamics 25 0/4 music.Dynamics \mf
\editionMod articulations 25 0/4 music.Voice.A \(
\editionMod articulations 25 3/4 music.Voice.A \)

\editionMod articulations 26 0/4 music.Voice.A \(

\editionMod fingering 27 2/8 music.Voice.B -1
\editionMod fingering 27 3/8 music.Voice.B -2
\editionMod fingering 27 4/8 music.Voice.B -3
\editionMod fingering 27 5/8 music.Voice.B -5
\editionMod articulations 27 1/4 music.Voice.A \)
\editionMod articulations 27 3/8 music.Voice.B \(

\editionMod fingering 28 0/8 music.Voice.B -3
\editionMod fingering 28 1/8 music.Voice.B -5
\editionMod dynamics 28 0/4 music.Dynamics \>
\editionMod dynamics 28 2/4 music.Dynamics \p
\editionMod articulations 28 3/8 music.Voice.B \)
\editionMod articulations 28 2/4 music.Voice.A \(

\editionMod articulations 29 2/4 music.Voice.A \)

\editionMod articulations 30 2/4 music.Voice.B \(

\editionMod dynamics 31 1/4 music.Dynamics \<
\editionMod dynamics 31 7/8 music.Dynamics \!
\editionMod articulations 31 0/4 music.Voice.B \)
\editionMod articulations 31 1/4 music.Voice.B \(

\editionMod fingering 32 2/16 music.Voice.B -2
\editionMod fingering 32 3/16 music.Voice.B -3
\editionMod fingering 32 4/16 music.Voice.B -4
\editionMod dynamics 32 1/8 music.Dynamics \>
\editionMod articulations 32 2/4 music.Voice.B \)
\editionMod articulations 32 3/4 music.Voice.A \(

\editionMod dynamics 33 0/4 music.Dynamics \pp
\editionMod tweaks 33 0/4 music.Dynamics \once\override DynamicText.X-offset = #-0.0
\editionMod articulations 33 0/4 music.Voice.A \)
\editionMod articulations 33 5/8 music.Voice.A (

\editionMod articulations 34 0/4 music.Voice.A )

\editionMod articulations 36 0/4 music.Voice.A \(

\editionMod dynamics 36 0/4 music.Dynamics \p

\editionMod articulations 40 0/4 music.Voice.A \)

\editionMod articulations 42 0/4 music.Voice.A \(

\editionMod articulations 46 0/4 music.Voice.A \)

\editionMod dynamics 48 0/4 music.Dynamics \p
\editionMod dynamics 48 0/4 music.Voice.A \(

\editionMod dynamics 50 0/4 music.Voice.A \)

\editionMod dynamics 51 2/4 music.Voice.A \(
\editionMod dynamics 52 0/4 music.Voice.A \)

\editionMod dynamics 53 0/4 music.Dynamics \pp
martineausimon commented 1 year ago

Hello, thank you for this feedback, I never use \editionMod and indeed, it reveals several errors in my syntax code: the contexts were badly highlighted, and the parentheses were identified as scheme code... It should work better now!

niveK77pur commented 1 year ago

Thanks a bunch for the quick intervention! I shall have a look in the coming days and report back!

niveK77pur commented 1 year ago

I almost forgot to report back! But everything seems to work as expected now! Thanks a lot, I shall close the issue~

Here the image for reference: image

martineausimon commented 1 year ago

Thanks for your feedback ! Can I ask you what colorscheme you use? Grobs like DynamicText should be highlighted differently from functions like \override and numbers, here is a screenshot with neovim's default theme :

2023-06-21-213902_684x40_scrot

niveK77pur commented 1 year ago

Interesting, thanks for bringing it to my attention. I shall try out different colorschemes to see if the issue is related to the specific one I am using; maybe it is missing some color definitions.

I am currently using this one: https://github.com/Matsuuu/pinkmare