[HN Gopher] Code=GUI bidirectional editing via LSP
       ___________________________________________________________________
        
       Code=GUI bidirectional editing via LSP
        
       Author : jamesbvaughan
       Score  : 85 points
       Date   : 2025-07-01 16:43 UTC (6 hours ago)
        
 (HTM) web link (jamesbvaughan.com)
 (TXT) w3m dump (jamesbvaughan.com)
        
       | love2read wrote:
       | Related:
       | https://chromewebstore.google.com/detail/ghosttext/godiecgff...
       | 
       | > Write in the browser with your text editor.
        
       | necovek wrote:
       | 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).
        
       | rao-v wrote:
       | 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?!
        
         | fwip wrote:
         | I don't think they change programs very often, and only very
         | rarely in the middle of a project.
        
         | rjsw wrote:
         | STEP is capable of capturing what you describe, it is down to
         | the "user group" of customers of the CAD vendors to ask for it
         | to be implemented by each CAD system in terms of what they
         | import and export.
         | 
         | We put in for some funding for the next edition of STEP AP242
         | for me to be able to work more closely with the user group to
         | improve this area.
        
         | mk_stjames wrote:
         | It's really hard to explain if you don't know how CAD kernels
         | produce final BREP shapes via their process trees, but, try
         | give an example- something like "this is a 2mm fillet" requires
         | a 'fillet solver' that is deeply ingrained in the kernel. It
         | isn't something that would ever be portable, say, from
         | Fusion360 to CATIA natively because those are completely
         | different kernels with different ways of 'solving' the model
         | (and not just fillets, but, everything).
         | 
         | That is why STEP containing the final BREP manifold solid is
         | the standard interchange that it is - it is a final
         | representation of the solved output that IS portable, and
         | anything else is... difficult.
        
       | bitwize wrote:
       | See also: zoo.dev, started by an acquaintance of mine.
        
       | mikewarot wrote:
       | 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.
        
       | williamcotton wrote:
       | While it doesn't use an LSP (which is a great idea!), this
       | project of mine does bidirectional mapping between a GUI and a
       | shell pipeline:
       | 
       | Screenshots and GIFs for the explanation!
       | 
       | https://github.com/williamcotton/guish
        
       | jasonjmcghee wrote:
       | 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.
        
         | madmod wrote:
         | I love your project. I am making something with LSP and your
         | code was a great example of what is possible.
        
           | jasonjmcghee wrote:
           | Glad it was useful! LSP is definitely under-utilized. It's
           | great for the "malleable software" / small tools for yourself
           | kind of stuff especially.
        
         | jamesbvaughan wrote:
         | That's cool! I suspected that someone must have done something
         | like this before.
        
         | KRAKRISMOTT wrote:
         | Isn't autocad lisp powered?
        
       | low_tech_punk wrote:
       | So if we replace LSP with MCP, the UI might control the code in
       | interesting ways!
        
       | rtcode_io wrote:
       | See https://new.rt.ht for bidi i=o sync demos!
       | 
       | The PDF ones are especially fun!
       | 
       | The whole playground is built for bidi sync!
        
         | low_tech_punk wrote:
         | Wait, what is this?! It's really cool
        
       | SwiftyBug wrote:
       | This is awesome! If someone created a Interface Builder on top of
       | that, I feel like I might even go back to making iOS apps. Xcode
       | makes the whole experience so terrible that it sucks the joy out
       | of it.
        
       | WillAdams wrote:
       | I've suggested this sort of interactivity for (Open)PythonSCAD:
       | 
       | https://lists.openscad.org/empathy/thread/GAX4QYYRUC3CEH572I...
       | 
       | The devil is in the details though, and I worry about the UI
       | becoming cluttered and unmanageable.
        
       | taeric wrote:
       | Reminds me of the excitement I got on seeing
       | https://www.youtube.com/watch?v=4tyTgyzUJqM. I still get excited
       | about trying something like this again pretty much every time I
       | see it. Have yet to really get any traction on anything. :(
       | 
       | A lot of folks had fun watching Minecraft built using a live code
       | session, if I recall.
        
       | pjmlp wrote:
       | I guess it is about time for the usual Lisp, Smalltalk, Cedar and
       | Oberon remarks.
       | 
       | Why do cool ideas take so much time to be embraced in mainstream?
       | 
       | Retoric question, naturally they weren't VC friendly with
       | exponential growth capitalising user acquisition. /s
        
       | ogoffart wrote:
       | For Slint [https://slint.dev], a (native) GUI Toolkit, I've also
       | developed a LSP server that do live preview and editing. You can
       | try it online at https://slintpad.com : if you click on the
       | toolbar button to enable the right panel, you can edit the
       | properties from the UI, and this is all done through the LSP and
       | can be integrated in any editor that supports it.
        
       | nico wrote:
       | Very cool concept. Would love to see something like this for web
       | development. Where making changes in the browser could be
       | persisted seamlessly to code
        
       | junon wrote:
       | I'm about to set off on this journey too with a code-first PCB
       | editing suite for myself to work on. Seems like this is a good
       | piece of prior art to reference as I need to build similar
       | tooling. Thanks for posting!
        
       | pshc wrote:
       | This stuff is a dream of mine, editors in different modes that
       | can collaborate seamlessly. Keep up the good work!
        
       | kennykartman wrote:
       | I know basically nothing about CAD, but I know thet fornjot
       | exists and wondered if it might be useful to your purposes, in
       | case you don't know about that.
       | 
       | But well, the project is very cool and I love the idea of using
       | LSP for something more!
        
       ___________________________________________________________________
       (page generated 2025-07-01 23:00 UTC)