IDE functions within a TextView?

Is it possible to enable some functions of the IDE (like autocomplete, or looking up implementations of a method) within a TextView? I’m working on making a custom coding interface in SuperCollider and I’d like to incorporate some of that functionality within the new GUI.

2 Likes

I’d love to know if you figure this out Carl. I have a prototype module in my setup that uses TextView and every time I code in it I feel like part of my brain is missing.

Sam

Is there a way to embed a Document inside of a View? I guess Document isn’t a part of the GUI library, but yeah it would be great to be able to do this.

I worked really hard on this years ago. The general sentiment at the time seemed to be, if we’re going to have a vanilla code view, it better be a real Document. I couldn’t figure out how to do this, so I made a couple widgets for myself that I still use today but they do require compiling a fork of SC from 7+years ago and I haven’t tried compiling it recently.

(It’s unfortunate that you can’t distribute GUI widgets like quarks. I just use this one in a context where I only need simple stuff like routines with midi and osc, so haven’t needed to update to newer SC versions in the places where I use it.)

Anyway it’s basically a modification of TextView with syntax highlighting and a separate auto complete window that tries to help you the way SCIDE does, i.e. suggest classes and tell you the names of arguments as you are typing. It also I think tells you the current value of an environment variable you are typing.

It works well, but the downside is, you need to compile this fork of SuperCollider: GitHub - esluyter/supercollider: An audio server, programming language, and IDE for sound synthesis and algorithmic composition.
which probably will be a bit difficult as I haven’t done this in 7 years. best is probably to update the whole thing to the latest SC release and then deal with Qt problems in my custom widgets as they come up. Then, you need to install this extension: GitHub - esluyter/CodeView: Stopgap GUI code editor for SuperCollider

And then for your efforts you will have a functional CodeView with syntax highlighting and line numbers, autocomplete and automatic matching parenthases, indentation etc., and PostView, which acts as a post window.

But, for a lighter version without all the fuss of the custom Qt widgets, maybe try this version of CodeView which I adapted to work in vanilla SC without the line numbers or syntax highlighting: ESTimeline/CodeView_v2/CodeView.sc at master · esluyter/ESTimeline · GitHub
and this version of the autocomplete window: CodeView/CodeViewCompleteWindow.sc at master · esluyter/CodeView · GitHub

(I think/hope they will just work together. When I have time I’ll look at this and maybe put them together as a quark.)

c = CodeView().front
w = CodeViewCompleteWindow(c, Rect(300, Window.availableBounds.height, 300, 300))

1 Like