QB64Official / vscode

QB64 Extension for Visual Studio Code.
MIT License
14 stars 3 forks source link

Please do not change the font style of anything by default #120

Closed grymmjack closed 1 year ago

grymmjack commented 1 year ago

https://github.com/QB64Official/vscode/blob/3f6e6633a6d325d660b981a4bdbab245f59e64af/src/decoratorFunctions.ts#L95 https://github.com/QB64Official/vscode/blob/3f6e6633a6d325d660b981a4bdbab245f59e64af/src/decoratorFunctions.ts#L100

image

We can instead use the settings.json and "fontStyle": "bold" in the "settings" block if bold is desired.

I cannot unset it, I have tried.

    "editor.tokenColorCustomizations": {
        "textMateRules": [
            {
                "scope": [
                    "userfunctions.QB64",
                    "entity.name.function.QB64",
                    "meta.function.QB64",
                    "source.QB64",
                    "entity.name.function"
                ],
                "settings": {
                    "fontStyle": ""
                }
            }
        ]
    }

The setting is working, just is bold by default which should not be forced on the user.

LordDurus commented 1 year ago

Agreed. This and any new font styles should be controlled by a setting.

LordDurus commented 1 year ago

This is ready to test in dev.

grymmjack commented 1 year ago

The setting doesn't seem to work, and the highlighting does not factor int the return type variety: image

I have in my settings:

    "qb64.isBoldingSubsAndFunctionsEnabled": true,

And it's not bolded.

Note that a function that ends in a type suffix is also not matched.

grymmjack commented 1 year ago

Actually. I think it was the font rendering on the Mac. I was using my Mac.

On PC, it's absolutely working.

"qb64.isBoldingSubsAndFunctionsEnabled": true,

image

"qb64.isBoldingSubsAndFunctionsEnabled": false,

image

Sorry for the false info @LordDurus good to close this I think :)

grymmjack commented 1 year ago

There is a bug though. It looks like you need negative lookbehind in the regex for '

Negative lookbehind is written as (?<!text) From: https://www.regular-expressions.info/lookaround.html

image

See how it's highlighting the comment too?

grymmjack commented 1 year ago

Also some strange formatting here: image

grymmjack commented 1 year ago

Attaching the .BAS for these bugs for your own tests. MONEY.zip

grymmjack commented 1 year ago

Another strange one: image

From my strings.bi here:

''
' QB64_GJ_LIB
' GRYMMJACK'S STRINGS LIB
'
' Some commonly used functions that I missed in QB64 coming from PHP
'
' USAGE:
'   Insert '$INCLUDE:'path_to_GJ_LIB/STRINGS/STRINGS.BI' at the top of file
'   Insert '$INCLUDE:'path_to_GJ_LIB/STRINGS/STRINGS.BM' at the bottom of file
' 
' @author Rick Christy <grymmjack@gmail.com>
' @uses STRINGS.BM
'
$LET GJ_LIB_STRINGS_INC_BI = 1
CONST GJ_LIB_MAX_STR_POSITIONS = 50

DECLARE FUNCTION str_implode$ (arr$(), delim$)
DECLARE SUB str_explode (target$, delim$, dest$(), numParts%)
DECLARE SUB str_find_pos (target$, search$, arrFound%(), numFound%)
DECLARE FUNCTION str_insert$ (s$, ins$, p%)
DECLARE FUNCTION str_remove$ (s$, del$)
DECLARE FUNCTION str_del (s$, del$)
DECLARE FUNCTION str_replace$ (s$, search$, replace$)
DECLARE FUNCTION str_rep$ (s$, search$, replace$)
DECLARE FUNCTION str_slice_pos (s$, startPos%, endPos%)
grymmjack commented 1 year ago

Last thing: good job on fixing the type suffixes on functions and subs highlighting. Works good: image

LordDurus commented 1 year ago

Looks like there are 2 more issues. 1) Comments 2) Weird color on the function declaration

LordDurus commented 1 year ago

I think I have the issue with declare function fixed.
The problem was the regex was matching function and not declare function.

LordDurus commented 1 year ago

Still need to fix: image

LordDurus commented 1 year ago

I think I have it working. Let me know if you find anything else.

I pushed this to dev in v.0.9.1

grymmjack commented 1 year ago

Testing :)

LordDurus commented 1 year ago

Found another case of the comments getting highlighted (GOTO command)

image

LordDurus commented 1 year ago

Took awhile, but looks good now image