zyedidia / micro

A modern and intuitive terminal-based text editor
https://micro-editor.github.io
MIT License
24.4k stars 1.16k forks source link

syntax: Reintroduction of `header` as fallback when filename doesn't match #3206

Closed JoeKar closed 3 months ago

JoeKar commented 3 months ago

Fixes #3201

JoeKar commented 3 months ago

@dmaluka: The MacOS build run one time fail, but currently I can't image why: https://github.com/zyedidia/micro/actions/runs/8402687727/job/23012403628

I removed my last commit, added it partly again: ok I removed my last commit, added it fully again: ok

Do you have an idea? I'd like to prevent further regressions.

Strange :thinking:

dmaluka commented 3 months ago

I haven't reviewed this PR yet (obviously) but I'm not sure if the extra complexity it adds is the right approach to the problem. The reason is: I've found that #2819, among other things, changed the meaning of the foundDef variable, so now it means not "we found the final syntax definition" but something different, and rather confusing. Which makes the entire code confusing, difficult to understand (and thus difficult to extend in a correct way), and actually buggy.

I already have a fix for foundDef but I haven't fully tested it yet.

After fixing foundDef, adding support for header matches together with signature matches should become trivial (I suppose).

JoeKar commented 3 months ago

Closed as tracked with #3208 due to more clean and straight logic.