Report from: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/7901 .
When we put elseif part we will brake fold/unfold for if and also for function until the end of the code.
Ref: https://cmake.org/cmake/help/latest/command/if.html
Code for test:
function(function1)
endfunction()
function(function2 PARAM)
if(1)
list(1)
elseif(1)
list(1)
elseif(1)
list(1)
else(1)
list(1)
endif()
target_compile_options(${TARGET} PRIVATE ${options})
endfunction()
function(function3 PARAM P2)
endfunction()
Description for above:
if then all code to the end will be fold (not to endif)function2 then all code to the end will be fold (not to corresponding endfunction()).elseif has fold / unfold but else not.elseif then fold/unfold for if works better, but still wrong.elseif then all works correct.I see that lexer cmake has fold.at.else, but this should apply for both elseif and else, and when its off then fold/unfold for if should works correct.
https://sourceforge.net/p/scintilla/code/ci/default/tree/lexers/LexCmake.cxx#l385
Ehh... please change in title
ifelsetoelseif.This is a bug.
As I don't use CMake, a fix will have to come from a volunteer.
Diff:
Hello,
this error has been bothering me for a while, so I started to investigate it and posted my solution already for NotePad++
In Summary: The only thing necessary to avoid this error is that the fold level should not be incremented on an "elseif"-token.
Please see my changed in the attached file based on https://sourceforge.net/projects/scintilla/files/lexilla/5.1.5/lexilla515.tgz/download
With regards
Lexers have been moved into the separate Lexilla project.
https://github.com/ScintillaOrg/lexilla
Committed fix to Lexilla with https://github.com/ScintillaOrg/lexilla/commit/0422d84ac419c177aa0d20b02267444bccd7a636 .
Lexilla change links:
https://github.com/ScintillaOrg/lexilla/issues/77
https://github.com/ScintillaOrg/lexilla/pull/78