[Script editor for C#]: Line number mismatch and pre-populated code

Hi all, I am trying to use the C# Scrip editor in Grasshopper on Rhino6 for Mac.
Two things I noticed coming from windows:

  1. The line numbers start from 1, whereas the pre-existing code “public class, private void” lines. I remember that they end at 69 and our code starts from 70.
    The issue with this is that the errors are displayed differently than the line numbers. For eg: “; expected in line 84” where line 84 is line 15 in the script editor.
  2. I would like to see my the private void Runscript() to check my variables. Am I missing something? is there a way to toggle this?
1 Like

I’d never used the GH Script component on Windows or Mac before, but I thought I’d give it a try. Here is a picture of what happened:

  1. It is not obvious what I am doing to deserve 34 error messages here
  2. My script has 3 lines; the compiler is complaining about errors starting on line 55

After much googling, I finally saw a screenshot of what this script editor looks like on Windows, and it all became clear. On Windows, you can see your code is being inserted into a method body inside a class, along with various other stuff that accounts for the missing line numbers. So my struct declaration needs to go in the “using” section of the editor (why didn’t I think of that?)

One could say I was being dumb – that’s a solid theory – but, I’d have to be pretty smart to have just guessed this. It’s not about understanding C# – the information is completely hidden. Even once I know what’s going on, I still see wrong line numbers, and I can’t see the declarations for the input variables, or the other bits that make this into valid C# code.

I’m guessing that hiding the code was a design choice(?), but from my perspective it’s a bug.

Hi Bob -

Yes, Rhino 8 has a new code editor.
-wim