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

Feature request: syntax highlighting in o.expr.codebox #380

Open
wagne342 opened this issue May 9, 2019 · 10 comments
Open

Feature request: syntax highlighting in o.expr.codebox #380

wagne342 opened this issue May 9, 2019 · 10 comments

Comments

@wagne342
Copy link
Contributor

wagne342 commented May 9, 2019

I've been writing very long lambda functions and I'm finding that I spend an inordinate amount of time tracking down basic errors in o.expr.codebox. I know this comes up all of the time, but can we please implement some form of basic text/syntax highlighting in the codebox? Even color coding parentheses and brackets would be a huge step forward. Extra points if we can build in some key commands for automatic formatting.

@ramagottfried
Copy link
Member

hey jeremy, totally agreed -- it's hypothetically possible do add syntax highlighting for o.expr.codebox using the MaxSDK, and of course things like the gen.codebox have that, ... but it might be easier and more flexible to make a syntax highlighting scheme for an external editor like atom, sublime, vs-code, textwrangler, etc. -- probably something like a javascript scheme could be edited to allow the leading / before variable names, and add an error for trailing commas.

for parenthesis checking, you can already paste o.expr.codebox text into a code text editor and it should help you find parenthesis pairs at least. also nice for paste/replace, etc.

I've been thinking of making an o.expr object that can read external files, seems pretty useful especially for composing in an external text editor,... not sure when that will be exactly, but I think "not too hard" to make.

@equilet
Copy link
Member

equilet commented May 9, 2019

Longstanding issue and talked about since ODOT's first builds.
It's trivial and the code already exists in a sense (otherwise expr codebox wouldn't be able to parse text input and do something meaningful with it). The larger issue is twofold: o.display and o.compose also draw bundle text to the screen, but we wouldn't want those to be drawing parsing all color combinations, as this would introduce CPU tax in rapid updates. Consequentially, it feels kludgy to only have syntax colorization in expr codebox.

Because of this, Rama's suggestion or something similar would be a good alternative, basically having highlighting relegated to a scheme elsewhere. My thought on that back in the day was to have an "open in..." message that would open in whatever editor had been designated... Then there could be an autowatch similar to what you see in the [js] object's implementation.

@wagne342
Copy link
Contributor Author

wagne342 commented May 9, 2019

From a workflow standpoint, it would be vastly preferable if the thing were fully self-contained. Even if the highlighting turns off when the codebox isn't being edited, it would make the thing much easier to troubleshoot, and I think ultimately, more teachable. If, in the meantime, we could provide hooks into/out of an external editor, that would be progress.

@adrianfreed
Copy link
Member

adrianfreed commented May 10, 2019 via email

@ilzxc
Copy link
Contributor

ilzxc commented May 10, 2019 via email

@wagne342
Copy link
Contributor Author

wagne342 commented May 10, 2019 via email

@ilzxc
Copy link
Contributor

ilzxc commented May 10, 2019 via email

@maccallum
Copy link
Member

maccallum commented May 10, 2019 via email

@federicoVisi
Copy link

would love to see this one too some day, perhaps similarly to how the js and node.js objects work (i.e. editor pops up on double-click)

@maccallum
Copy link
Member

Looks like this is probably the thing to try in order to do something similar do the js object: https://docs.juce.com/master/classCodeEditorComponent.html

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

7 participants