Live data from Hacker News

Code-GUI bidirectional editing via LSP

jamesbvaughan.com

1–10 of 71 posts

Re: Code-GUI bidirectional editing via LSP

#3
This is a great idea: I'd never think of using LSP for this!

As a software developer, I always get frustrated when I am doing some graphical work and struggle to neatly parametrize whatever I am drawing (wooden cabinets and furniture, room layouts, installation plans...) and switch between coding where that makes most sense and GUI where it doesn't.

The best I've gotten was FreeCAD with Python bindings (I've got a couple of small libraries to build out components for me), but while you can use your own editor, the experience is not very seamless.

And then I start imagining tools like the one here, but obviously doing it just right for me (balancing the level of coding or GUI work).

Re: Code-GUI bidirectional editing via LSP

#4
Isn’t the python based build123d the current best CAD in code solution? The problem with OpenSCAD is that it cannot export solid geometry, just a final mesh.

More broadly, I was genuinely shocked to realize, when I was playing with it, that there is no cross CAD file format that captures even simple design concepts like “this hole is aligned to the center of this plate” or even “this is a 2mm fillet”. STEP (the file format) mostly just captures final geometry.

I think CAD people just … redesign the part again if they need to move from say Fusion 360 to FreeCAD or whatever. How do they live like that?!

Re: Code-GUI bidirectional editing via LSP

#6
This is close to the functionality that Borland Delphi had back in the 1990s. The pascal language and the design of their GUI toolkit were a really good impedance match, so you could freely switch between GUI design and editing the text version of it.

Doing so for languages like C++, was a sea of boilerplate that you couldn't touch, which is why I never moved away from Pascal. Similar fragility was evident in WxPython and it's builder.

I'm glad to see that LLMs can provide a match for less well suited Language/GUI pairs. We all deserve to get that kind of productivity.

Re: Code-GUI bidirectional editing via LSP

#8
Hey nice - this stuff is so much fun to me. I've worked a number of experiments like this too, especially related to live coding. Love seeing it in the wild.

I built a small project where you can live-code Love2D. The running program updates in real time (no saving needed) and see all values update in real-time, via LSP.

https://github.com/jasonjmcghee/livelove

And also added the same kind of interactivity like a number slider and color picker that replace text inline, like yours (though via vs code extension: https://gist.github.com/jasonjmcghee/17a404bbf15918fda29cf69...)

Here's another experiment where I made it so you could "drag and drop" to choose a position for something by manipulating the editor / replacing a computed position with a static one, on keypress.

https://clj.social/@jason/113550406525463981

There's so much cool stuff you can do here.

Re: Code-GUI bidirectional editing via LSP

#10

Hey nice - this stuff is so much fun to me. I've worked a number of experiments like this too, especially related to live coding. Love seeing it in the wild. I built a small project where you can live-code Love2D. The running program updates in real time (no saving needed) and see all values update in real-time, via LSP. https://github.com/jasonjmcghee/livelove And also added the same kind of interactivity like a num…

I love your project. I am making something with LSP and your code was a great example of what is possible.
Post reply on HN