Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlighting doesn't pick up built-in functions/variables #51

Open
lachlansleight opened this issue Aug 16, 2018 · 4 comments
Open

Highlighting doesn't pick up built-in functions/variables #51

lachlansleight opened this issue Aug 16, 2018 · 4 comments

Comments

@lachlansleight
Copy link

Presently processing-specific variables like width, height, frameRate, PI etc. aren't highlighted (and neither are built-in functions like setup(), keyPressed() etc), which can be confusing to beginners (I'm currently teaching someone to code using Processing so I've been thinking a lot about this kind of stuff lately).

Here's a comparison image (Processing editor on top, VSCode on bottom - note setup(), width and PI):
highlightcomparison

I have no idea how .tmlanguage files work but I would imagine it could be as simple as manually adding them to the dictionary somehow?

@AvinZarlez
Copy link
Owner

This is a feature that doesn't exist in the extension. It's a good idea, just a matter updating the .tmlanguage file. Honestly, I haven't touched it in over 3 years I think, so it might be out of date for multiple reasons.

I didn't even make the file, just borrowed the one that the Processing Sublime plugin uses https://github.com/b-g/processing-sublime - Which also hasn't been updated in about 3 years it seems?

If you'd like to figure out what the syntax is for adding those build in function names, please feel free to make a PR updating the tmlanguage file!

@lachlansleight
Copy link
Author

lachlansleight commented Aug 16, 2018 via email

@atnbueno
Copy link
Contributor

atnbueno commented Mar 13, 2020

Those variables are in the TextMate grammar, but the default VSCode themes don't have a different color for everything. You have to find the corresponding scope (e.g. constant.other.processing is the scope for the frameRate, width, and mouseX tokens). And then you can add a custom color to those in settings.json with something like this:

"editor.tokenColorCustomizations": {
    "textMateRules": [
        {
            "scope": "constant.other.processing",
            "settings": {
                "foreground": "#00FF00"
            }
        }
    ]
}

Before:
imagen

After:
imagen

You can also specify different colors for each available theme. See https://code.visualstudio.com/docs/getstarted/themes#_customizing-a-color-theme

P.S. Instead/In addition of the color ("foreground") you can change the "fontStyle" (e.g. to "Italic")

@AvinZarlez
Copy link
Owner

That explanation seems like something that could be turned into an useful instructional blurb in the readme!

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

No branches or pull requests

3 participants