Skip to content

Fix Pascal-Case Function Mis-Color#68

Open
mtunixic wants to merge 12 commits intovshaxe:masterfrom
mtunixic:function-pascal-colorfix
Open

Fix Pascal-Case Function Mis-Color#68
mtunixic wants to merge 12 commits intovshaxe:masterfrom
mtunixic:function-pascal-colorfix

Conversation

@mtunixic
Copy link
Copy Markdown

makes it so that if you make a function with a pascal-case, it wont be colored yellow like it's a class, and instead be colored blue like a function

@AlexHaxe
Copy link
Copy Markdown
Member

did you just patch the ouput file instead of adjusting the YAML rules to make your changes more permanent?

remember to also run tests, to see if your changes have the desired effect. or make changes / additions to test cases to reflect your change.

@mtunixic
Copy link
Copy Markdown
Author

mtunixic commented Feb 27, 2026

did you just patch the ouput file instead of adjusting the YAML rules to make your changes more permanent?

remember to also run tests, to see if your changes have the desired effect. or make changes / additions to test cases to reflect your change.

2026-02-27-152313_hyprshot

yes, i tried it and it worked fine, and even tried obscure things like this
2026-02-27-191119_hyprshot
and still worked

@AlexHaxe
Copy link
Copy Markdown
Member

let me rephrase my question: you've hacked haxe.tmLanguage when you should have edited haxe.YAML-tmLanguage.

@mtunixic
Copy link
Copy Markdown
Author

let me rephrase my question: you've hacked haxe.tmLanguage when you should have edited haxe.YAML-tmLanguage.

oh, my bad, i did not know that, do i do that and resend the pull?

here you go, as requested
@mtunixic
Copy link
Copy Markdown
Author

@AlexHaxe alright i tried patching it up like you asked, should filter out functions now

@mtunixic
Copy link
Copy Markdown
Author

oh, enums' parameters and public static called variable have this minor bug too, no clue how to patch those but if i found it ill update you

swapped includes in identifiers (vars and finals), and also added a match for enums before including identifiers

havent tested yet so if you could try it with
```hx
enum Color {
    Red;
    Green;
    Blue;
}
```
@mtunixic
Copy link
Copy Markdown
Author

try this

tiny fix to the YAML that makes it so that not everything pascal case is colored yellow like a class, more specifically functions, called variables and finals, and enum parameters
…-isnt-a-class-(functions,-called-finals/variables,-enum-parameters))

Pascal-Case Colorfix
@AlexHaxe
Copy link
Copy Markdown
Member

when generating haxe.tmLanguage I get a different one from the one in your PR. so please update.

tests are failing, can you adjust them, to make them go green?
I think we should also add new test cases, since that seems to be an area that wasn't covered previously.

@mtunixic
Copy link
Copy Markdown
Author

mtunixic commented Feb 28, 2026

when generating haxe.tmLanguage I get a different one from the one in your PR. so please update.

tests are failing, can you adjust them, to make them go green? I think we should also add new test cases, since that seems to be an area that wasn't covered previously.

i'm using the one from vscode itself, not sure if its the one up to date or not
also the variable fix is a bit buggy since doing Class.function() colors class like a variable, will try to fix that

by the way what do you mean by "can you adjust them, to make them go green?"

@mtunixic
Copy link
Copy Markdown
Author

when generating haxe.tmLanguage I get a different one from the one in your PR. so please update.

tests are failing, can you adjust them, to make them go green? I think we should also add new test cases, since that seems to be an area that wasn't covered previously.

the way i actually test and verify things is by editing the haxe.tmTemplate file instead of the YAML one since thats what the installed extension has, how do i test the yaml version anyway

@AlexHaxe
Copy link
Copy Markdown
Member

the way i actually test and verify things is by editing the haxe.tmTemplate file instead of the YAML one since thats what the installed extension has, how do i test the yaml version anyway

I don't think anyone is going to look through that diff to see if your hand-made changes align with what's in yaml file.
treat xml format as an output file, changes to it are lost whenever a build happens. and since it's auto-generated editing that mess is not fun in the first place, and I think it is deliberately kept in its one-line form (XML-formatter exist) to get people to question whether it's a good idea to edit it.

to run tests the readme has got you covered: https://github.com/vshaxe/haxe-TmLanguage?tab=readme-ov-file#tests

@mtunixic
Copy link
Copy Markdown
Author

the way i actually test and verify things is by editing the haxe.tmTemplate file instead of the YAML one since thats what the installed extension has, how do i test the yaml version anyway

I don't think anyone is going to look through that diff to see if your hand-made changes align with what's in yaml file. treat xml format as an output file, changes to it are lost whenever a build happens. and since it's auto-generated editing that mess is not fun in the first place, and I think it is deliberately kept in its one-line form (XML-formatter exist) to get people to question whether it's a good idea to edit it.

to run tests the readme has got you covered: https://github.com/vshaxe/haxe-TmLanguage?tab=readme-ov-file#tests

alright fair enough, i'll try it and get back to you

@mtunixic
Copy link
Copy Markdown
Author

mtunixic commented Feb 28, 2026

@AlexHaxe I got everything to work properly (Enums, Vars, Finals) without any conflicts or bugs, except for functions ironically, debugging it all took alot but I think I'm pretty close

fix alot (var finals enum params, functions, called functions and var finals enums)
but also missing a few things
@mtunixic
Copy link
Copy Markdown
Author

mtunixic commented Mar 1, 2026

@AlexHaxe i got it to work great, just a few things left that im honestly stuck on:
pkg.sub.Class is all colored yellow instead of pkg and sub being white while the dots are cyan
function variables (eg Function(thing)'s thing) when pascal case or upper case is colored like a class still

is it okay if you inspect and try to fix the remaining bugs? ill try to fix these 2 in the meantime
thank you for waiting

@AlexHaxe
Copy link
Copy Markdown
Member

AlexHaxe commented Mar 1, 2026

compared to your initial changes, it feels like your latest version is getting a bit out of hand.

the bugs you are describing, are those bugs that exist in the original version, or are they caused by your changes?
if the former, that should be a separate issue. if it's because of your changes, then maybe your approach might need a correction. sometimes it is worth (or necessary) to go back a couple of steps to rethink your decisions and the solutions you came up with.

@mtunixic
Copy link
Copy Markdown
Author

mtunixic commented Mar 1, 2026

alright, I'll try to, sorry to keep you waiting

@mtunixic
Copy link
Copy Markdown
Author

mtunixic commented Mar 4, 2026

@AlexHaxe update, honestly for something like this i'd probably need a semantics typescript for it to work, its a bit too much to declare every strict type combination with only using regex, and idk anything about typescript let alone making a semantics lol, i wont give up yet tho ill try looking on docs on how to do it

@AlexHaxe
Copy link
Copy Markdown
Member

AlexHaxe commented Mar 4, 2026

@AlexHaxe update, honestly for something like this i'd probably need a semantics typescript for it to work, its a bit too much to declare every strict type combination with only using regex, and idk anything about typescript let alone making a semantics lol, i wont give up yet tho ill try looking on docs on how to do it

semantic highlight is something that needs to be implemented in Haxe languageserver. it's impossible to get the semantics strictly using only regexes.

maybe reduce the scope of your fix to the most common occurrences and leave more obscure / uncommon ones as is.

I've only ever seen PascalCase for function names in openfl/lime code base. most people I would say are using camelCase for their function names. I would even go so far as to call it the standard for Haxe code.
you might prefer PascalCase, that's your choice, but you might be in the minority.

@mtunixic
Copy link
Copy Markdown
Author

mtunixic commented Mar 5, 2026

@AlexHaxe alright, my patch is complete, fixed alot of things and made the code simpler
if theres anything you'd like to tell me feel free to do so

@mtunixic
Copy link
Copy Markdown
Author

mtunixic commented Mar 5, 2026

no clue why it didnt show that i updated haxe.YAML-tmLanguage, but the file is in here if you couldnt find it
https://github.com/mtunixic/haxe-TmLanguage/blob/master/haxe.YAML-tmLanguage

@kLabz
Copy link
Copy Markdown

kLabz commented Mar 5, 2026

You pushed to the wrong branch, you need to update the function-pascal-colorfix branch for this PR

@mtunixic
Copy link
Copy Markdown
Author

mtunixic commented Mar 5, 2026

You pushed to the wrong branch, you need to update the function-pascal-colorfix branch for this PR

oops, will do once im home, btw can you try my patch and see if it works?

@mtunixic
Copy link
Copy Markdown
Author

mtunixic commented Mar 5, 2026

done

@mtunixic
Copy link
Copy Markdown
Author

mtunixic commented Mar 5, 2026

nevermind, when i tried branching it to function-pascal-colorfix it branched it to function-pascal-colorfix-1 instead, so here's the link instead
https://github.com/mtunixic/haxe-TmLanguage/blob/master/haxe.YAML-tmLanguage

@kLabz
Copy link
Copy Markdown

kLabz commented Mar 5, 2026

Nope, still wrong branch.

@mtunixic
Copy link
Copy Markdown
Author

mtunixic commented Mar 5, 2026

@AlexHaxe @kLabz alright, pushed successfully

@AlexHaxe
Copy link
Copy Markdown
Member

AlexHaxe commented Mar 5, 2026

  • revert ahaxe_libraries changes
  • remove OG folder
  • revert package.json and package-lock.json changes (should be a separate PR, if necessary)
  • XML output file should be identical to result of running npx lix run vshaxe-build --target tm-language-conversion, or exclude it from PR
  • make sure tests pass when running npx lix run vshaxe-build --target tm-language-tests
  • add testcases for the things you changed, if they aren't covered yet

@mtunixic
Copy link
Copy Markdown
Author

mtunixic commented Mar 5, 2026

  • revert ahaxe_libraries changes

    • remove OG folder

    • revert package.json and package-lock.json changes (should be a separate PR, if necessary)

    • XML output file should be identical to result of running npx lix run vshaxe-build --target tm-language-conversion, or exclude it from PR

    • make sure tests pass when running npx lix run vshaxe-build --target tm-language-tests

    • add testcases for the things you changed, if they aren't covered yet

seems straight-forward enough, will get back to you once its done
thank you for your patience with me

@mtunixic
Copy link
Copy Markdown
Author

mtunixic commented Mar 6, 2026

why does github always say my checks fail :/

@mtunixic
Copy link
Copy Markdown
Author

mtunixic commented Mar 6, 2026

@AlexHaxe vshaxe-build never seems to work for me

❯ npx lix run vshaxe-build --target tm-language-conversion
Failed to get content of /home/MT/haxe/haxe_libraries/vshaxe-build/0.0.1/github/a9972b6e741f99200da6ba41563f780b33a554ae/haxelib.json
Failed to invoke `haxelib run-dir vshaxe-build /home/MT/haxe/haxe_libraries/vshaxe-build/0.0.1/github/a9972b6e741f99200da6ba41563f780b33a554ae --target tm-language-conversion` because Error: Command failed: haxelib run-dir vshaxe-build /home/MT/haxe/haxe_libraries/vshaxe-build/0.0.1/github/a9972b6e741f99200da6ba41563f780b33a554ae --target tm-language-conversion

❯  npx lix run vshaxe-build --target tm-language-tests
Failed to get content of /home/MT/haxe/haxe_libraries/vshaxe-build/0.0.1/github/a9972b6e741f99200da6ba41563f780b33a554ae/haxelib.json
Failed to invoke `haxelib run-dir vshaxe-build /home/MT/haxe/haxe_libraries/vshaxe-build/0.0.1/github/a9972b6e741f99200da6ba41563f780b33a554ae --target tm-language-tests` because Error: Command failed: haxelib run-dir vshaxe-build /home/MT/haxe/haxe_libraries/vshaxe-build/0.0.1/github/a9972b6e741f99200da6ba41563f780b33a554ae --target tm-language-tests

@AlexHaxe
Copy link
Copy Markdown
Member

AlexHaxe commented Mar 6, 2026

why does github always say my checks fail :/

well before they were failing because of your rename of haxe_libraries folder, now they fail because your changes broke some unittests.

as to why vshaxe-build is not working for you, I'm not entirely sure what causes that. maybe your lix is not set up correctly. so maybe check that.

alternatively you could look at vshaxe-build.json to see how to run its different targets: e.g. running tests should be something like haxe -cp src --lib hxnodejs --js bin/test.js --main Test --debug + node bin/test.js (or combined with a --cmd)

  • revert rename of haxe.tmLanguage to haxe.tmLanguage.bak

@mtunixic
Copy link
Copy Markdown
Author

mtunixic commented Mar 7, 2026

@AlexHaxe not sure if this is good or bad...

❯ haxe -cp src -lib hxnodejs --js bin/test.js -main Test --debug --cmd "node bin/test.js"

Success.
❯ haxe -cp src -lib hxnodejs --js bin/test.js -main Test --cmd "node bin/test.js"
Error: "CommentsInDeclarations.hx.baseline.txt" is not the same as the baseline!
Error: "ConditionalCompilation.hx.baseline.txt" is not the same as the baseline!
Error: "ECheckType.hx.baseline.txt" is not the same as the baseline!
Error: "Enums.hx.baseline.txt" is not the same as the baseline!
Error: "Extractors.hx.baseline.txt" is not the same as the baseline!
Error: "Final.hx.baseline.txt" is not the same as the baseline!
Error: "HaxeInHxml.hxml.baseline.txt" is not the same as the baseline!
Error: "Identifiers.hx.baseline.txt" is not the same as the baseline!
Error: "ImportsUsings.hx.baseline.txt" is not the same as the baseline!
Error: "IntersectionTypes.hx.baseline.txt" is not the same as the baseline!
Error: "IsOperator.hx.baseline.txt" is not the same as the baseline!
Error: "Issue10.hx.baseline.txt" is not the same as the baseline!
Error: "Issue14.hx.baseline.txt" is not the same as the baseline!
Error: "Issue16.hx.baseline.txt" is not the same as the baseline!
Error: "Issue17.hx.baseline.txt" is not the same as the baseline!
Error: "Issue22.hx.baseline.txt" is not the same as the baseline!
Error: "Issue25.hx.baseline.txt" is not the same as the baseline!
Error: "Issue29.hx.baseline.txt" is not the same as the baseline!
Error: "Issue34.hx.baseline.txt" is not the same as the baseline!
Error: "Issue36.hx.baseline.txt" is not the same as the baseline!
Error: "Issue4.hx.baseline.txt" is not the same as the baseline!
Error: "Issue6.hx.baseline.txt" is not the same as the baseline!
Error: "MacroPatterns.hx.baseline.txt" is not the same as the baseline!
Error: "MacroReification.hx.baseline.txt" is not the same as the baseline!
Error: "NestedFunction.hx.baseline.txt" is not the same as the baseline!
Error: "New.hx.baseline.txt" is not the same as the baseline!
Error: "NullCoalescing.hx.baseline.txt" is not the same as the baseline!
Error: "PatternMatching.hx.baseline.txt" is not the same as the baseline!
Error: "StringInterpolation.hx.baseline.txt" is not the same as the baseline!
Error: "TrailingCommas.hx.baseline.txt" is not the same as the baseline!
Error: "TryCatch.hx.baseline.txt" is not the same as the baseline!
Error: "TypeParameters.hx.baseline.txt" is not the same as the baseline!
Error: "UntypedFunctions.hx.baseline.txt" is not the same as the baseline!
 
Failed!
Error: Command failed with error 1

@AlexHaxe
Copy link
Copy Markdown
Member

AlexHaxe commented Mar 7, 2026

I get the same output for debug and non-debug builds. so must be on your end.

@mtunixic
Copy link
Copy Markdown
Author

mtunixic commented Mar 7, 2026

I get the same output for debug and non-debug builds. so must be on your end.

what can i do about it?

@AlexHaxe
Copy link
Copy Markdown
Member

AlexHaxe commented Mar 7, 2026

what can i do about it?

I'm not sure, because there should be no difference whether Test.hx runs with --debug or without (I don't see any conditional compilation sections).

regardless these unittest either need to be updated to reflect your changes (because your changes improved handling in those cases) or they show that some (or one) of your changes affects more things than what you intended.

@mtunixic
Copy link
Copy Markdown
Author

sorry for not being up to date, had to deal with life stuff, will try to finish this up quickly tho

@mtunixic
Copy link
Copy Markdown
Author

alright it's complete, no more changes needed, all thats left is the checks you asked me to do

@mtunixic
Copy link
Copy Markdown
Author

mtunixic commented Apr 2, 2026

@AlexHaxe no matter what i do it tells me all checks failed, what do i do?

@AlexHaxe
Copy link
Copy Markdown
Member

AlexHaxe commented Apr 2, 2026

test cases assume existing behaviour, so they might fail because your adjustments fix things that were "broken" or mislabeled before. or tests might fail because your changes break things that they shouldn't.

what you need to do is look through your test results, diff them against expected classification results (see baselines and cases) and then figure out if your new version is correct or whether old behaviour should remain.
if your version is correct or improves classification, then the baselines need to be updated. if your version is making things worse, then figure out how and why and find a fixes for it.

chances are there is a mixture of both, so some things will need to be updated and some things might need fixing.
it's also very likely that some of the cases that your changes address do not have a corresponding testcase. please add one or multiple!

@mtunixic
Copy link
Copy Markdown
Author

this is genuinely so tiring to deal with, the whole check thing needs like file to file specific checks and its very annoying imo. feels like it's taking forever

@mtunixic
Copy link
Copy Markdown
Author

i'm halfway thru tho so i tthink

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants