Add QML syntax to editor#5022
Conversation
I don't think that QML should be added to the JavaScript syntax. As far as I understand, QML files can contain JavaScript, but the opposite is not true: QML is not valid JavaScript. However, I think that you can include other syntax files in your syntax. So if the overlap is extremely high, you might have luck organizing the files in such a way that a common section is included in both, or one is included in another. |
I agree.
I tried "concatenation" using double include in Syntax and including from inside .syntax and this approach didn't work ( Seems like unless someone reworks syntax loading in editor we'll have to deal with duplication across syntax files. |
Yes, but can't you split it into 3 files like |
|
preferably, js-common.syntax. there shouldn't be anything qml-specific in it. more broadly, #2931 seems relevant once again. if only because dedicated highlighter libraries usually come with a sizable collection of syntax definitions. |
|
Unfortunately (unless I am missing something), it won't be possible to use common syntax file unless we want to cram "default context" of JS related languages into common and have them all use it. |
|
/rebase |
Actually, I don't quite understand your problem. I think that our qml.syntax js.syntax javascript-common-default.syntax If you need to share more, you can make more files. Or does it not work? It would be good to have this sorted out so that I can merge this PR. |
Signed-off-by: Eugene San (eugenesan) <eugenesan@gmail.com> Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
|
After some more testing, I was unable to use include lines in .syntax files. It seems like the code in https://github.com/MidnightCommander/mc/blob/master/src/editor/syntax.c was designed to support The code is undocumented and has parts that doesn't make sense to me. Line 1016 in 9927d07 Unless someone figures out what is wrong with the code or shows what I am wrong, feel free to either merge the PR as is or close it. |
| yum-repo.syntax \ | ||
| yxx.syntax | ||
| yxx.syntax \ | ||
| qml.syntax |
There was a problem hiding this comment.
Please make this list sorted alphabetically again.
Proposed changes
Checklist
git commit --amend -smake indent && make check)Discussion
Currently QML was added as a standalone syntax file.
I'd like to hear opinions if instead it should be added to existing JavaScript syntax (
js.syntax) as they share ~70% of syntax and QML can contains JavaScript code.