Search Unity

  1. Engage, network and learn at Unite Austin 2017, Oct 3 - 5. Get your ticket today!
    Dismiss Notice
  2. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  3. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice
  4. Unity 2017.1 is now released.
    Dismiss Notice
  5. Unity 2017.2 beta is now available for download.
    Dismiss Notice

Script Inspector 3

Discussion in 'Works In Progress' started by Flipbookee, Aug 10, 2013.

  1. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,012
    Oh, thanks a lot! That's a great find :) and it's super-cool that you managed to trace the issue up to there! :eek: Yeah, it gets a bit complicated, so I'll take care of it.
     
    Andrew_Howe likes this.
  2. jrDev

    jrDev

    Joined:
    Nov 5, 2008
    Posts:
    1,558
    Hey Flipbookee,

    Any fix for the comments indentation problem yet?

    Thanks,
    jrDev
     
    Flipbookee likes this.
  3. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,012
    Uh, I forgot about that. Let me check...
     
    jrDev likes this.
  4. jrDev

    jrDev

    Joined:
    Nov 5, 2008
    Posts:
    1,558
    Hey Flipbookee,

    I also found a bug introduced in this version update. Sometimes when I hit Command+Shift+T to hide, a new copy of all my script tabs would be created.

    Thanks,
    jrDev
     
  5. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,012
    Do you mean like another floating window with the same scripts shows up? That's weird. I'll check...
     
  6. jrDev

    jrDev

    Joined:
    Nov 5, 2008
    Posts:
    1,558
    Yes.

    Thanks,
    jrDev
     
  7. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,012
    Hey @jrDev, I cannot reproduce that bug and I checked the code - it seems impossible for something like that to happen! I'm sure something went wrong, but I have no idea what that might be, so I'll appreciate any help with reproducing this bug!

    First thing that comes to my mind, did you get any errors in the Console when this happens? Second, what Unity version and OS was that? And third, how often does that happen?

    Thanks!
     
  8. Andrew_Howe

    Andrew_Howe

    Joined:
    Sep 22, 2015
    Posts:
    3
    OK I hope you're having fun with my previous bug, but I have a new one :) And I suspect this one will be harder to fix :(

    Code (CSharp):
    1.  
    2. using System.Linq.Expressions;
    3. class X
    4. {
    5.     public static void Foo<TValue>(Expression<Func<TValue>> selector) {} // not this one
    6.     public static void Foo<T, TValue>(T instance, Expression<Func<T, TValue>> selector) {} // this one
    7.     public int Bar {get; set;}
    8.     public void Oops()
    9.     {
    10.         Foo(this, (X x)=>x.Bar); // manually qualify type, works
    11.         Foo(this, x=>x.Bar);     // squigglies under "Bar", but it has compiled fine. T was inferred from instance.
    12.     }
    13. }
    The use case is a sweet system I have for changing & reverting project settings. Foo actually does a bunch of stuff, but the basic pattern is that you can't have a reference to a property in C#, but you can pass a lambda expression and walk it with System.Linq.Expressions. 'x' should be inferred from 'this', and in fact it is by the compiler. But your editor doesn't figure it out - it knows which Foo is being used, and it knows T is X. Unfortunately it doesn't figure out the connection between the lambda and the Expression - x should be a T (i.e. X). But that might be difficult to fix, I guess.
     
    Flipbookee likes this.
  9. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,012
    Hey man, thanks for the great code example! I'm looking at this issue right now... Seems like the Expression class is a weird beast, I'm still trying to understand how that works. But it's always fun to face complex problems like this ;)
     
    Andrew_Howe likes this.
  10. Victor_Kallai

    Victor_Kallai

    Joined:
    Mar 5, 2014
    Posts:
    123
    I found a small bug, sizeof(Int32) gets red underlined in SI3, but Unity has no problem with it.
     
    Flipbookee likes this.
  11. Victor_Kallai

    Victor_Kallai

    Joined:
    Mar 5, 2014
    Posts:
    123
    Flipbookee likes this.
  12. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,012
    Thanks @Victor_Kallai, I'll check that!

    Hehe, nice! :) It should come with sound effects as well...

    @Andrew_Howe, Expression class(es) are a really interesting feature of the C# compiler that I wasn't aware of. Fixing Si3 to support that is actually easy and almost done :)
     
    Andrew_Howe and Victor_Kallai like this.
  13. amisner2k

    amisner2k

    Joined:
    Jan 9, 2017
    Posts:
    5
    I too am waiting humbly for the big 3.1 update. The integration between Unity and VS is better than ever at the time of this writing. The only thing that makes me keep thinking about Script Inspector and making me even consider switching is the lightning fast loading of script files and a tighter debugging experience built-in to Unity (right now there are still a few instances in VS where you simply can't evaluate an expression without getting some weird invocation exception or something).

    Honestly, if and when Script Inspector gets its debugging functionality (and it just works and it's tight and robust) then that will probably be the killer feature that will bring the rest of the planet over to the Script Inspector dark side I feel. Seriously...the number of converts would be quite staggering I'd imagine.

    Anyway, I just got done reading and catching up to this thread (starting from the beginning) and it was like reading an adventure novel. So many twists and turns, ups and downs, amusing anecdotes, witty replies, and intriguing insights. I'll be interested to see how this thread and Script Inspector evolve from here.

    Lastly, thanks for all your hard work and dedication @Flipbookee . You truly are a cut above the rest.
     
    Wrymnn, petey and Flipbookee like this.
  14. Victor_Kallai

    Victor_Kallai

    Joined:
    Mar 5, 2014
    Posts:
    123
    Small feature request, when selecting something in the middle of a line, and pressing Ctrl+D (duplicate) it should also duplicate the selection. Cheers!
     
  15. Wrymnn

    Wrymnn

    Joined:
    Sep 24, 2014
    Posts:
    270
    Agreed, Debugging is last giant stepping stone for Script Inspector.
    This is holding me and I believe many other people from using it, even though I already bought it.

    When Debugging gets implemented, SI will get giant leap in number of users, helping both funds, support and bug reports flow into SI development.
     
    Flipbookee likes this.
  16. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    5,600
    The real problem with debugging is the way Unity runs your app in edit mode right within the editor process. That's a bit of insanity that I haven't seen in any other development environment. Even REALbasic circa 1992 builds and launches the app as a separate process (and in case you're worried, it's still lightning-fast). And it means that if you pause the app for debugging, the whole editor is paused — including the script editor.

    Unfortunately, that's not something @Flipbookee can fix; it would have to come from Unity. So instead he's going to have to go through these goofy work-arounds, with a separate debugger process that duplicates much of the functionality of the IDE just so you can browse your code while debugging.

    Personally, I've found I just don't care that often. Most of the time I can debug fine with Debug.Log; when I really need to step through code, I launch MonoDevelop, get the "aha!" I needed, and then quit it again. This happens maybe once or twice a month — the rest of the time, I'm happy as a clam with Si3.
     
    Flipbookee likes this.
  17. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,012
    Oh sorry @Victor_Kallai, I missed you post... I just checked and the line gets duplicated above the current line, while the selection stays where it was, now one line below because a line was inserted above. Or, what do you mean by "duplicate the selection"? :confused:
     
  18. Victor_Kallai

    Victor_Kallai

    Joined:
    Mar 5, 2014
    Posts:
    123
    In other IDE's duplicate line command has 2 functionalities: if you have nothing selected or multiple lines selected, it duplicates the current line, but if you have something selected, like one or more words is the middle of the line, then it will only duplicate the words in the middle, not the whole line.
    If you have a line "var foo = bar;" and you select bar and duplicate it, it should become: "var foo = barbar;"
     
    Flipbookee and JoeStrout like this.
  19. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,012
    Hmm, I see... Well, I don't know of a good enough use case for that feature, but I know what else Ctrl+D will be good for when something is selected in a single line - adding selection to the next appearance of the selected text, once multi-selection is implemented. Ctrl+D is the default shortcut for this operation in other IDE's... But I don't know, maybe having two such different commands assigned to a single shortcut will be too confusing?
     
  20. Victor_Kallai

    Victor_Kallai

    Joined:
    Mar 5, 2014
    Posts:
    123
    True, this feature is not really that important, just I found it strange that it does not have the same behavior as other IDE's (such as Notepad++, Intelij, Webstorm, VS Code, VS with Duplicate Selection tool, or Resharper).
    I sometimes want to use it when I define arrays with similar elements, or when calling a function with similar named params.
    From my point of view, I am so happy with the current state of SI3 that the only things that could be improved are the little details like this :)
     
    Flipbookee likes this.
  21. jrDev

    jrDev

    Joined:
    Nov 5, 2008
    Posts:
    1,558
    Hey @Flipbookee,

    After updating to Unity 2017, I can't double click from console to open the script location.

    Any ideas?

    Thanks,
    jrDev
     
  22. Victor_Kallai

    Victor_Kallai

    Joined:
    Mar 5, 2014
    Posts:
    123
    Are you using SI Console window?
     
  23. jrDev

    jrDev

    Joined:
    Nov 5, 2008
    Posts:
    1,558
    Yes of course...

    Thanks,
    jrDev
     
  24. Andrew_Howe

    Andrew_Howe

    Joined:
    Sep 22, 2015
    Posts:
    3
    This fixes the console double click problem.

    Code (CSharp):
    1. --- FGConsole.cs
    2. +++ FGConsole.cs
    3. @@ -78,0 +79,3 @@ public class FGConsole : EditorWindow
    4. +#if UNITY_2017_1_OR_NEWER
    5. +        logEntriesType = typeof(EditorWindow).Assembly.GetType("UnityEditor.LogEntries");
    6. +#else      
    7. @@ -79,0 +83 @@ public class FGConsole : EditorWindow
    8. +#endif
    9. @@ -85,0 +90,3 @@ public class FGConsole : EditorWindow
    10. +#if UNITY_2017_1_OR_NEWER
    11. +        logEntryType = typeof(EditorWindow).Assembly.GetType("UnityEditor.LogEntry");
    12. +#else
    13. @@ -86,0 +94 @@ public class FGConsole : EditorWindow
    14. +#endif
     
    punk, Flipbookee, PhatSiz and 2 others like this.
  25. gamedivision

    gamedivision

    Joined:
    Nov 4, 2012
    Posts:
    47
    can we create our own snippets
     
    Flipbookee likes this.
  26. jrDev

    jrDev

    Joined:
    Nov 5, 2008
    Posts:
    1,558
    Hey,

    Hmmm...What's changing here? I must be missing something because those changes didn't work for me. Where is @Flipbookee on this issue?

    Thanks,
    jrDev
     
  27. sngdan

    sngdan

    Joined:
    Feb 7, 2014
    Posts:
    296
    I had issues with the console in 2017.1.0b1 (null ref for errors and for debug logs in case of double click, right click still worked) and the above changes seem to have fixed it for me. But I only tested this for a single incident...
     
    Flipbookee likes this.
  28. jrDev

    jrDev

    Joined:
    Nov 5, 2008
    Posts:
    1,558
    Hey,

    Maybe I am not replacing the proper stuff. Anyone can upload the actual file please?

    Thanks,
    jrDev
     
  29. sngdan

    sngdan

    Joined:
    Feb 7, 2014
    Posts:
    296
    This is how I replaced it. #79 and #95 just in there for reference to identify the position
    Code (CSharp):
    1. #79   editorWindowPosField = typeof(EditorWindow).GetField("m_Pos", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
    2.  
    3.         #if UNITY_2017_1_OR_NEWER
    4.         logEntriesType = typeof(EditorWindow).Assembly.GetType("UnityEditor.LogEntries");
    5.         #else
    6.         logEntriesType = typeof(EditorWindow).Assembly.GetType("UnityEditorInternal.LogEntries");
    7.         #endif
    8.         if (logEntriesType != null)
    9.         {
    10.             getEntryMethod = logEntriesType.GetMethod("GetEntryInternal", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
    11.             startGettingEntriesMethod = logEntriesType.GetMethod("StartGettingEntries", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
    12.             endGettingEntriesMethod = logEntriesType.GetMethod("EndGettingEntries", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
    13.         }
    14.         #if UNITY_2017_1_OR_NEWER
    15.         logEntryType = typeof(EditorWindow).Assembly.GetType("UnityEditor.LogEntry");
    16.         #else
    17.         logEntryType = typeof(EditorWindow).Assembly.GetType("UnityEditorInternal.LogEntry");
    18.         #endif
    19.  
    20. #95             if (logEntryType != null)
     
    Flipbookee, PhatSiz and jrDev like this.
  30. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    317
    I'm also wondering about the spaces vs tab option, found the old postings about it but latest version still doesn't seem to have that.
     
    Flipbookee likes this.
  31. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,012
    I have a version of Si3 with an option to insert spaces instead of tabs. This will be released with the first next update, but I can also send you a copy before that if you wish?
     
  32. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    317
    I can wait :) (well, unless it'll take months...).
     
    Flipbookee likes this.
  33. PhatSiz

    PhatSiz

    Joined:
    Dec 16, 2016
    Posts:
    1
    Hello, I keep getting these two errors, do you know how to fix this? And "NullReferenceException" keep appear when I double click, I tried to paste the code up there but maybe because of me, it's turn to be a mess. Thank you.

    assembly-unityscript-editor.dll not found
    UnityEngine.Debug:LogWarning(Object)
    ScriptInspector.MonoIslandsHelper:GetReferencedAssembliesFor(String) (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTypeSystem.cs:11387)
    ScriptInspector.AssemblyDefinition:get_referencedAssemblies() (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTypeSystem.cs:11482)
    ScriptInspector.AssemblyDefinition:ResolveInReferencedAssemblies(Leaf, NamespaceDefinition, Int32) (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTypeSystem.cs:12020)
    ScriptInspector.NamespaceDefinition:ResolveMember(Leaf, Scope, Int32, Boolean) (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTypeSystem.cs:5770)
    ScriptInspector.NamespaceScope:Resolve(Leaf, Int32, Boolean) (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTypeSystem.cs:6386)
    ScriptInspector.SymbolDefinition:ResolveNode(BaseNode, Scope, SymbolDefinition, Int32, Boolean) (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTypeSystem.cs:9225)
    ScriptInspector.SymbolDefinition:ResolveNode(BaseNode, Scope, SymbolDefinition, Int32, Boolean) (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTypeSystem.cs:9618)
    ScriptInspector.SymbolDefinition:ResolveNode(BaseNode, Scope, SymbolDefinition, Int32, Boolean) (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTypeSystem.cs:9627)
    ScriptInspector.SymbolDefinition:ResolveNode(BaseNode, Scope, SymbolDefinition, Int32, Boolean) (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTypeSystem.cs:9621)
    ScriptInspector.FGResolver:ResolveNodeInternal(Node) (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTypeSystem.cs:12848)
    ScriptInspector.FGResolver:ResolveNode(Node) (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTypeSystem.cs:12765)
    ScriptInspector.FGTextEditor:GetTokenStyle(SyntaxToken) (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTextEditor.cs:4070)
    ScriptInspector.FGTextEditor:DoGUI(Boolean) (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTextEditor.cs:3619)
    ScriptInspector.FGTextEditor:DoGUIWithAutocomplete(Boolean) (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTextEditor.cs:1849)
    ScriptInspector.FGTextEditor:OnInspectorGUI(Boolean, RectOffset, EditorWindow) (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTextEditor.cs:1797)
    ScriptInspector.ScriptInspector:DoGUI() (at Assets/Plugins/Editor/ScriptInspector3/Scripts/ScriptInspector.cs:76)
    ScriptInspector.ScriptInspector:OnInspectorGUI() (at Assets/Plugins/Editor/ScriptInspector3/Scripts/ScriptInspector.cs:70)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)

    and
    assembly-unityscript-editor-firstpass.dll not found
    UnityEngine.Debug:LogWarning(Object)
    ScriptInspector.MonoIslandsHelper:GetReferencedAssembliesFor(String) (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTypeSystem.cs:11387)
    ScriptInspector.AssemblyDefinition:get_referencedAssemblies() (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTypeSystem.cs:11482)
    ScriptInspector.AssemblyDefinition:ResolveInReferencedAssemblies(Leaf, NamespaceDefinition, Int32) (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTypeSystem.cs:12020)
    ScriptInspector.NamespaceDefinition:ResolveMember(Leaf, Scope, Int32, Boolean) (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTypeSystem.cs:5770)
    ScriptInspector.NamespaceScope:Resolve(Leaf, Int32, Boolean) (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTypeSystem.cs:6386)
    ScriptInspector.SymbolDefinition:ResolveNode(BaseNode, Scope, SymbolDefinition, Int32, Boolean) (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTypeSystem.cs:9225)
    ScriptInspector.SymbolDefinition:ResolveNode(BaseNode, Scope, SymbolDefinition, Int32, Boolean) (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTypeSystem.cs:9618)
    ScriptInspector.SymbolDefinition:ResolveNode(BaseNode, Scope, SymbolDefinition, Int32, Boolean) (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTypeSystem.cs:9627)
    ScriptInspector.SymbolDefinition:ResolveNode(BaseNode, Scope, SymbolDefinition, Int32, Boolean) (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTypeSystem.cs:9621)
    ScriptInspector.FGResolver:ResolveNodeInternal(Node) (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTypeSystem.cs:12848)
    ScriptInspector.FGResolver:ResolveNode(Node) (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTypeSystem.cs:12765)
    ScriptInspector.FGTextEditor:GetTokenStyle(SyntaxToken) (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTextEditor.cs:4070)
    ScriptInspector.FGTextEditor:DoGUI(Boolean) (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTextEditor.cs:3619)
    ScriptInspector.FGTextEditor:DoGUIWithAutocomplete(Boolean) (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTextEditor.cs:1849)
    ScriptInspector.FGTextEditor:OnWindowGUI(EditorWindow, RectOffset) (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGTextEditor.cs:1702)
    ScriptInspector.FGCodeWindow:OnGUI() (at Assets/Plugins/Editor/ScriptInspector3/Scripts/FGCodeWindow.cs:1331)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)
     
    Last edited: Aug 14, 2017
  34. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,012
    Hey @PhatSiz, I think you posted the same warning twice. Please comment that line out in FGTypeSystem.cs (it should be line 11387) and save the change... This warning started showing up in Unity 2017.1 and it's only for me to tell me there's something unexpected happening. I checked that and I haven't found the reason why this started happening in Unity 2017.1, but I know it's safe and there's no harm to ignore that. I'll do something about this in the first next update.
     
    PhatSiz likes this.
  35. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,012
    @Andrew_Howe, thanks for the awesome find! :cool: Also, thanks @sngdan for explaining his post! :)

    @jrDev, sorry I couldn't help with that at that time... Unity 2017.1 broke that and it also made a warning show up in Si3, so I'll update the package on Asset Store with Andrew's fix and a few other fixes.
     
    PhatSiz and JoeStrout like this.
  36. Caronte3D

    Caronte3D

    Joined:
    Sep 16, 2014
    Posts:
    22
    Aaargh!
    SI3 Just disappeared :eek:
    I can't see any reference on my project, and can't reimport because Unity say it's already on my project :confused:
    Any ideas?
    (Unity 2017.1.0f3 Win10)
     
  37. Caronte3D

    Caronte3D

    Joined:
    Sep 16, 2014
    Posts:
    22
    Done!
    I don't know what happened, the only way to have SI3 again was remove the folder and reimport.
    Thanks anyway.
     
    Flipbookee likes this.
  38. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    2,441
    I've got some issues with indentation. If I have a method like this:

    Code (csharp):
    1. void This_Is_A_Method(Class_With_VERY_LONG_Name a, Class_With_VERY_LONG_Name b, Class_With_VERY_LONG_Name c, Class_With_VERY_LONG_Name d) {
    2. ...
    3. }
    I want to split the argument list, like this:

    Code (csharp):
    1. void This_Is_A_Method(Class_With_VERY_LONG_Name a, Class_With_VERY_LONG_Name b,
    2.                       Class_With_VERY_LONG_Name c, Class_With_VERY_LONG_Name d) {
    3. ...
    4. }
    But when I press enter with the cursor just after '{', the code's auto-indented to this:

    Code (csharp):
    1. void This_Is_A_Method(Class_With_VERY_LONG_Name a, Class_With_VERY_LONG_Name b,
    2.     Class_With_VERY_LONG_Name c, Class_With_VERY_LONG_Name d) {
    3.  
    4. }
    which is not what I want!

    Indentation is also very strange inside a method with a wrapped parameter list. It seems to always be one indent further than the last line of the parameters. So with the automatic syntax, we get this:

    Code (csharp):
    1. void This_Is_A_Method(Class_With_VERY_LONG_Name a, Class_With_VERY_LONG_Name b,
    2.     Class_With_VERY_LONG_Name c, Class_With_VERY_LONG_Name d) {
    3.         var foo = 1;
    4.         var bar = 2.5f;
    5.     //The code should start here!
    6. }
    Which is kind of annoying, but if I do the work and change the wrapping to how I want it to look, oh boy:

    Code (csharp):
    1.  
    2. void This_Is_A_Method(Class_With_VERY_LONG_Name a, Class_With_VERY_LONG_Name b,
    3.                       Class_With_VERY_LONG_Name c, Class_With_VERY_LONG_Name d) {
    4.                           var foo = 1;
    5.                           var bar = 2.5f;
    6.     //The code should start here!
    7. }

    I'm also not very fond of how the "decrease line indent" command works in the middle of lines. If I have (as a contrived example), this:

    Code (csharp):
    1. void Foo() {
    2.     var foo =            15;
    3. }
    , place my cursom just to the left of "15" and press shift+tab, I decrease the indentation of the entire line. In all other text editors, it would move the "15" the equivalent of one indentation level to the left.




    Is there any chance to get a way to edit keyboard shortcuts? It looks like you're using the event-systems messages to check for "duplicate" instead of directly checking for ctrl+d, which makes sense*, but it would be nice to have customizable shortcuts.

    Finally, any chance for a delete-current-line option? I use that all the time, and I'm sorely missing it!


    *I actually have no idea why it's common for text editors to have the duplicate current line command (never once found it useful), but it's generally bound to something very prominent, so apparently people need a line of text/code twice often?
     
    Flipbookee likes this.
  39. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    5,600
    Yes, this one annoys me too. It happens with any long block starter (if, while, etc.), not just method declarations. Basically Si3 is finding the closest previous "{", and indenting one level more than wherever that line started. What it should do instead is find the start of the logical line, and indent one more than that one.

    I think @Flipbookee is aware of this, but it's nice to know I'm not the only one.

    I don't quite understand this one. If the cursor is before the "15" and you want to move it one tab to the left, the Delete key does that nicely. Why would you be using shift+tab for that? I think of shift+tab as "outdent this entire line" (perhaps because that is what it does).

    As Si3 is delivered as source code, there's always hacking the source code... but perhaps there's some more elegant solution. I'll have to leave it to others to point it out if so.
     
    Flipbookee likes this.
  40. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    2,441
    Because I'm not guilty of heresy, I use spaces for indentation.

    ;)

    Honestly I don't care either way, but it's company coding style and it's a nightmare to handle space/tab conflicts in git. Also Flipbookee was nice enough to send me the preview of the version that allows for spaces, which is what makes this issue visible.



    The shortcut thing is hard because of how it's implemented - not through checking ctrl+d, but by checking if Unity's sending the "duplicate" command, which happens when you press ctrl+d. To rewrite that, I'd have to (I believe) start listening to a different event, which would mean moving the code around. It's large enough that it'd be hard to keep in sync with the changes to the asset, so I'd rather not.
     
    Flipbookee likes this.
  41. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    5,600
    :eek:

    OK, in that case I guess I can see your beef. Though I think the root cause is much deeper. :)

    Sure, even if it were simple, the pain of updating is a good reason not to do it.

    But actually, rereading your messages, I'm still not sure what you want to change here. Do you want ctrl+d to do something else? Or do you want to duplicate a line with something other than ctrl+d? (I'm guessing not the latter, since you say you never do that — I almost never do either, and when I do need to do it, I'm pretty fast with cmd-left, shift-down, Copy, and Paste Paste Paste.)
     
    Flipbookee likes this.
  42. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,012
    That was weird. But good that you found a solution!
     
  43. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    2,441
    Both!
     
    Flipbookee likes this.
  44. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,012
    Yes @Baste and @JoeStrout, I'm aware that auto-indent is not perfect. And spaces-instead-of-tabs option makes the issue even more annoying... I'll have to fix that.
     
  45. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,012
    Adding an additional shortcut for an existing command in Si3 is easy. It can either be done in Si3 code, which will then make upgrades more difficult, or it can be done outside of Si3 in an editor script that adds a new main menu command with the desired shortcut and a handler method that "translates" that to an event that Si3 already understands. There's a way from the handler method to find the active Si3 tab and to send a keyboard event to it programmatically. I'll check the code and remind myself how to do that and I'll let you know :)
     
    Baste likes this.
  46. olinorwell

    olinorwell

    Joined:
    Aug 24, 2017
    Posts:
    2
    I have the same problem as Caronte3D - Si3 has disappeared so when clicking on a script it opens in MonoDevelop.

    I tried to import Si3 again but it says I've already got the asset imported (which is correct) - I tried to refresh the import, which does that but doesn't solve the problem. I have tried everything I can think of but it's not there. The Si3 console is gone as well.

    I don't really want to delete the asset then import again each time I load Unity, that would really suck. For a $40ish addon I kinda need it to work. Any ideas?
     
  47. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,012
    I see... I didn't understand what @Caronte3D mean by "Si3 has disappeared", but now that you mentioned it opens MonoDevelop on doubleclick I suspect that there was a compile error in the project at the time when you opened it. Because of the compile error, Unity cannot compile the scripts to produce game and editor assemblies. As Si3 comes in source code form, it cannot be compiled and therefore it doesn't run.

    The solution is to fix the compile error in MonoDevelop, save the fixed script and switch to Unity to let it try compile the scripts again. If it succeeds then Si3 and all other editor extensions that come in source code form will start working again. If there are more than one error, then you'll have to fix those errors as well...

    Now I know what you think - this sucks. You have to fix the compile error by editing a script while the script editor (Si3) doesn't work because of that... Well, I know that sucks and that's one of the reasons why with the next update Si3 will come with an option to have it as a DLL. Until then, please use MonoDevelop to fix the compile error, or even better, don't close the project if there are compile errors and the code doesn't compile. ;)

    Si3 was always shipping in source code form, mainly to allow its users to fix issues in its code when Unity releases a new version that breaks the old Si3 code, as it was the case in @Andrew_Howe's post above. This is an advantage for the users, but also a disadvantage in cases like this one when opening a project with a compile error in it. The solution I came up is to keep shipping Si3 in source code and, once the user decides that, to let them easily convert it to a DLL with a simple command from the Si3 main menu.
     
    Novack and JoeStrout like this.
  48. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    5,600
    Ah yes, I've run into that once or twice. Not a huge deal for me since I have my Unity prefs set to edit scripts with BBEdit (which snaps open nearly as fast as Si3) rather than MonoDevelop. But it _is_ startling when it happens.

    I think the DLL option will be great. Besides avoiding this problem, it also means that when I search "Entire Project" for something, it won't be showing me dozens of hits in the Si3 source code! I've been meaning to ask for a way to exclude those from the search scope, but with the DLL option, I think that's unnecessary.

    @Flipbookee, I like this so much that I think you should consider reversing the default — install as DLL by default, and make the source code available through some extra step (if that's possible). Most users will never need or want to poke around in the Si3 source code (and I say this as somebody who has successfully poked around in the past). The DLL works faster and more reliably, and produces a better experience for most users.
     
    Flipbookee and Novack like this.
  49. sngdan

    sngdan

    Joined:
    Feb 7, 2014
    Posts:
    296
    @JoeStrout

    I actually think that @Flipbookee 's suggestion is ingenious, provided he manages to implement that auto compile functionality on a button press.

    This would actually be the go to solution for any compiled asset that comes with source code in my opinion.

    You can customize or bug fix in source code and self produce the dll.

    Once this is avail, I would do exactly this, tweak 1-2 things, compile to dll, delete source. No clouded search box, faster compile, SI3 avail in case of other script compile errors.
     
    Flipbookee and JoeStrout like this.
  50. olinorwell

    olinorwell

    Joined:
    Aug 24, 2017
    Posts:
    2

    Ahh now that makes sense. Yes the previous day I'd added some new classes and had left it with a few compiler errors. Then returning the next day of course I'm opening a project with errors which therefore won't compile and so it can't execute Si3. I'll fix those compile errors and I'm sure it'll come back.

    Thanks for the quick response and explaining the issue, it's fine, the DLL solution will be cool in the future but for now understanding why this will happen means I can work around it.

    Thanks for creating a great editor! It really should be built into Unity - I hope they give you a lot of money for it one day.
     
    Flipbookee, sngdan and JoeStrout like this.