carbonblack / intellij-rpmspec

An IntelliJ plugin for RPM SPEC file support
Apache License 2.0
11 stars 4 forks source link

`%files` directive not recognised after `%install` directive #17

Closed EagleErwin closed 1 year ago

EagleErwin commented 1 year ago

Describe the bug

I noticed some strange behaviour in the syntax highlighting of a .spec file, when an %install directive is present. For example, take the following spec file and open it in IntelliJ:

Name: Some name
Version: 0.0.1

%install
mktemp -d

%files
%defattr(-,-,-,-)
/opt/some/file

IntelliJ shows it like this: image

Note the non-highlighted %files directive. If I now put my cursor at the end of the line containing %files and I press <enter>, the line becomes highlighted in yellow. If I then press <del> to remove the newly added line, the %files directive remains yellow. Until I close the file and open it again, then it's not recognised and white again.

It seems to happen after all directives from the SHELL_SECTIONS constant. For example: if I change %install into %description, the problem is gone. If I change it to %build, the issue is there as well.

Reproduction steps

  1. Create a simple .spec file with an %install directive, followed by a %files directive.
  2. Notice that the %files directive is not highlighted.

Expected behavior

I expect the %files directive to be highlighted in yellow, regardless of the presence of an %install directive before it.

Additional context

Using IntelliJ 2022.3 with plugin version 2.1.0. I reproduced it with ./gradlew runIde.