C# ScriptEditor is still a Pain... Everywhere

Scripting C# with the ScriptEditor is still a pain. The Search Dialog behavior is killing me. I had hoped for it to be fixed in R6, but not so, not so.

< rant >
Before two decades ago any Windows Search/Replace Dialog was capable of

  1. …picking up the selected word/text on CTRL+F / H. Everytime.
    Not only the first time but also next time if something else was selected before pressing CTRL-F/H again. This usually works, but it stops to work as described in §2 below.

  2. …always putting Focus on the first Edit Field in the Dialog.
    If ticking the “Find Options” then Focus is not regained on CTRL-F/H, and also §1 stops working. CTRL+H doesn’t switch from Search (CTRL+F) if the dialog is open, and vice versa. This zombification of the search dialog drives me nuts, if I’m not nuts already.

  3. …refrain from changing the Search scope (“Look in”). Ever.
    If I set the scope then I want it to stay there until I change it. Don’t fiddle with it. Extra reasons why not tampering with it automagically is described in §4 below, which explains why any automagic chnages forces you to Mouseclick it back to desired scope, although you are both hands on the keyboard

  4. responding to the TAB key. So the Tab key really isn’t working in the Search/ Replace Dialog.
    It works only for tabbing down from the Find/Replace-Tabs and between the two Field edit boxes, but not tabbing further down to Selection scope (“Look in”) or Find options. This forces users to leave the Keyboard to grab the Mouse in order to Click my options, a zillion times a day. And worse yet, when I have set the Selection scope over and over again by grabbing the Mouse, then it will most likely change automagically again next time I press CTRL+F/H, and so I will have to grab the Mouse again and…

No good. No good.

< / rantings & ravings >

One good thing though in R6 is that you seem to have fixed the Goto (row) dialog (CTRL+G, which could lock up the search dialog AND THE ENTIRE ui if it was open at the same time).

  1. Only problem is that I just tested that again as I was typing this, and guess what? Pressing CTRL-G while the Search dialog was open again locked up the Rhino/Grasshopper UI beyond recovery. Had to kill my Rhino process. Hm.

I spend day and night with this code editor. And it is becoming more and more disturbing. It hurts.

// Rolf

Edit 1: The Goto-disaster is an old one:

Edit 2: This time I lost the Goto dialog (behind somewhere) and only the Search dialog is visible, but stone dead and so is Rhino & Grasshopper UI. I must write this text in the space below the silly dialog that got stuck in the middle of my screen. :crazy_face:


The most annoying thing I hate about the editor is when initialising Lists or Trees. It always deletes my Type when pressing “(” (f.e.: var list = new List< Point3d >( becomes var list=new ListBindingConverter).
The rest is totally okay for scripting. At least snippets and intellisense do work. There are much worse editors out there and comparing it with Visual Studio or other IDE’s is a bit unfair. :slight_smile:


I think it’s OK to code with except for the annoying Search & Replace dialog.

And yes, Lists<...> can be annoying as well. I use to swap the first arrow (left) until the expression is ready and then go back and fix the arrow. Like so:

.... = new List>string>();
.... = new List<string>();


// Rolf

1 Like

I always click after I wrote < string >* click here * or as an alternative I press right and left button. Both options are bad as well

I keep hitting escape to kill the autocomplete for generic types.

@TomTom there may well be worse editors out there, but none I would elect to use. The editor is embarrassingly bad, but we don’t own the code and can’t really fix any of it. It’s just a component we drop into our windows.

@Alain can you give us an update about the future of code-editors in Rhino Win+Mac?

This is exactly why one should never use third party code or components which doesn’t provide the source code, with a reasonable license. Never.

// Rolf

1 Like

I’m happy with the Search/Replace Dialog, I haven’t had any problems with in Rh5. I only use it to change the name, though.
What bothers me is what TomTom mentioned.
Also the auto-suggestions or the auto-completion disappears constantly. This problem has worsened in Rh6.
It also bothers me that regions (or functions, classes… parts of code that collapse or are shown with a +/- in a square) are opened by default, every time I open a script I have to close them again. Really annoying for me. I would also like the loops to have this option.

But I write this for the following reason, I’ve always thought about it, why not use the whole canvas as a code editor? So inefficient is gdi+ for not doing it? Programming in sequential text is very limiting for comprehension when there are more than 500 lines, always up and down. The editor has an option to split the editor in two but would need a screen twice as big to be useful. Passing the code to the canvas sounds great but very challenging, being able to organize the code in 2d makes it modularly visual and it might help a lot to understand the flow of the program. For example, if we write a system of agents, the interfaces and classes would be grouped in a corner without disturbing them. Interactions between agents would be another group of components but of functions, as the work space in progress. The solver would be present waiting for input and output of instance data that would be a mixture of normal components and code components that implement agent objects. It is understood visually the shape of the code in 3 seconds. I’ve always thought that GH should go around as a natural step. Who hasn’t dreamed of this?

1 Like

Well, back then the choice was either this, or a regular textbox with no functionality whatsoever.

Right now we’re trying to get scintilla hooked up to Eto, but there’s a lot more work involved. When the time comes to make the editor UI for GH2 I hope we have a better solution ready, but I’m also going to look into hooking up external editors.

LOL :smiley:, and I was going to complain about PythonEditor just because double-click on the API browser doesn’t copy the syntax in the editor. Or that there’s no Right-click drop-down menu in GH.Python editor.

Apparently mine are tiny issues :smiley:

for what is worth, take a look at this one, it seems it’s getting very popular:


Yeah I loathe Atom, takes much too long to start. I use Sublime Text 3 these days but it’s more of an advanced text editor rather than an IDE.

Still, the point of external editors is that the user picks whichever one they like best. We just need to figure out how to send the text to some other app and then get the modified text back. The more popular editors we support the better.


:slight_smile:, I just recommended it because It’s highly customizable. I couldn’t use it in my work because I have to create my own syntax palette for the custom language I use.

Currently Notepad++ does the job, I wanna change it but I haven’t found better one yet.


Hopefully, now that Microsoft are acquiring GitHub, they may come with a very light open source version of VisualStudio connected with github :wink:

That’s sorta already out there (and is indeed pretty neat) depending on ones specific requirements (i.e. I don’t think one can compile C# components with it out of the box, if at all):

I second Sublime Text though for light weight external code/markup-type stuff… for so many reasons…

Whatever faborite cope editor, but they don’t integrate with the ScriptComponent.It’s the interactive part with SC which I find valuable about it. I make final versions in VS which I find “good enough”. I’ve never tried any other IDE for “serious” work. Can VSCode do the same job as VS?

Edit: Found the VSCode FAQ: https://code.visualstudio.com/docs/supporting/faq

// Rolf

Yeah it would be really neat if GH could somehow start Atom or VSCode or Visual Studio or whatever and provide both the source and the references needed for correct autocomplete. I do not know if this is possible, haven’t looked into details yet. Had a quick run with Scintilla on Eto, but it was really bare-boned, not even a C# style highlighter hooked up yet.

From my ScriptCodegen_CS2VS experience it seem that all info for exporting to an external editor should be no problem (just saving a well formatted code file (.cs) to disk while the file being open in the editor (and open via command line if not already open) already works just fine.

But harvesting code and references and inserting the info back into the ScriptComponent may not be trivial. But I have not checked and tried all of the ScriptComponent’s API as of yet, but someone else might have.

Anyway, if such a two-way connection could be implemented via an external component (connected to any output of the ScriptComponent) to manage it all , then it would be a piece of cake to integrate whatever text/code editor/IDE for the task.

Perhaps a open source collaboration project around this would interest someone?

// Rolf

Eventually I imagine it should be possible to load an RHP which provides integration for a specific platform. (GH2 will use RHPs instead of GHAs, makes it easier to distribute rhino commands and components at the same time.)

These plug-ins can totally be on github, I’m hoping to put most of the component code on public github too.


For now I think the rule of thumb was that Rhino doesn’t have full access to Grasshopper while Grasshopper have full access to both, right?

Anyway, the basic code differences between ScriptComponent and a (VS) GH_Component class is perhaps what requires the most of the coding to get it to work “automagically”. I have a good start for one-way ( to a → GH_Component cs-file) with the ScriptCodegen_CS2VS. After some code cleanup and refactoring perhaps it would make for an interesting start.

// Rolf

1 Like

My goodness, this thing (VScode) is even more confusing to use than Atom :astonished:. It’s like people forgot about simplicity and pragmatism.

Indeed !

One vote for Vim. :slight_smile:


It is possible, Alain already wrote an atom prototype of this for python on Mac. You basically have to open a network connection with an editor and communicate to help it with things like autocomplete and debugging feedback. It is on our radar, but isn’t actively being developed yet. If someone wanted to take the lead on this, we can help.