Home Download Buy Blog Forum Support

New plugin: CompleteSharp (C# code completion)

Re: New plugin: CompleteSharp (C# code completion)

Postby quarnster on Wed Jul 04, 2012 9:11 am

Is there anything printed in the python console? What do you mean with "breaking the standard completion"? Does completion for your added assemblies work but not for the standard library types such as string? Btw, you've got a much higher chance of me seeing issues by filing one on github rather than writing about it here.
quarnster
 
Posts: 389
Joined: Tue Nov 29, 2011 11:34 am

Re: New plugin: CompleteSharp (C# code completion)

Postby derthnada on Thu Jul 05, 2012 6:31 pm

Sorry, I didn't want to open a duplicate of an issue that already appears to have been resolved. I'm assuming it's something I'm configuring incorrectly, but I can certainly open something on github if you'd prefer. For the time being, though...

Without any custom assemblies, autocomplete works as expected. When I add my assemblies, autocomplete works for them, but stops working for the standard libraries.

Code: Select all
"completesharp_assemblies": [
        "/Applications/Unity/Unity.app/Contents/Frameworks/Managed/UnityEngine.dll",
        "/Applications/Unity/Unity.app/Contents/Frameworks/Managed/UnityEditor.dll"
        ],


Code: Select all
using UnityEngine;
using System.Collections;

public class Test {
   System.
}


Console shows this for normal, no-custom-assembly (working) attempt to autocomplete "System."
(-1, -1, u'System', None, u'.')
stderr: got: -findclass;;--;;System
stderr: Exception: An empty file name is not valid.
stderr: at System.IO.FileSystemInfo.CheckPath (System.String path) [0x00000] in <filename unknown>:0
stderr: at System.IO.FileInfo..ctor (System.String fileName) [0x00000] in <filename unknown>:0
stderr: at (wrapper remoting-invoke-with-check) System.IO.FileInfo:.ctor (string)
stderr: at CompleteSharp+MyAppDomain.CheckUpdate () [0x00000] in <filename unknown>:0
stderr: execute args: -findclass
stderr: execute args: System
stderr: Trying UnityEngine.System
stderr: Trying System.Collections.System
stderr: Trying System.System
stderr: Trying System
stderr: System
absolute is System (3.395081 ms)
finding what to complete took 0.004053 ms
completing System.
stderr: got: -complete;;--;;System;;--;;
stderr: Exception: An empty file name is not valid.
stderr: at System.IO.FileSystemInfo.CheckPath (System.String path) [0x00000] in <filename unknown>:0
stderr: at System.IO.FileInfo..ctor (System.String fileName) [0x00000] in <filename unknown>:0
stderr: at (wrapper remoting-invoke-with-check) System.IO.FileInfo:.ctor (string)
stderr: at CompleteSharp+MyAppDomain.CheckUpdate () [0x00000] in <filename unknown>:0
stderr: execute args: -complete
stderr: execute args: System
stderr: execute args:
completion took 215.743065 ms
total 219.970942 ms

When I add the above assemblies, the same attempt yields:
(-1, -1, u'System', None, u'.')
stderr: Loading: /Applications/Unity/Unity.app/Contents/Frameworks/Managed/UnityEngine.dll
stderr: Loading: /Applications/Unity/Unity.app/Contents/Frameworks/Managed/UnityEditor.dll
stderr: got: -findclass;;--;;System
stderr: execute args: -findclass
stderr: execute args: System
stderr: Trying UnityEngine.System
stderr: Trying System.Collections.System
stderr: Trying System.System
stderr: Trying System
stderr: Exception: The classes in the module cannot be loaded.
stderr: at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (System.Reflection.Assembly,bool)
stderr: at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0
stderr: at CompleteSharp+MyAppDomain+Hack.Execute (System.String[] args, System.Collections.ArrayList modules) [0x00000] in <filename unknown>:0
absolute is Test (529.119968 ms)
stderr: got: -returntype;;--;;Test;;--;;System
stderr: execute args: -returntype
stderr: execute args: Test
stderr: execute args: System
stderr: Exception: The classes in the module cannot be loaded.
stderr: at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (System.Reflection.Assembly,bool)
stderr: at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0
stderr: at CompleteSharp+MyAppDomain+Hack.Execute (System.String[] args, System.Collections.ArrayList modules) [0x00000] in <filename unknown>:0
Test.System =
derthnada
 
Posts: 3
Joined: Tue Jul 03, 2012 4:47 pm

Re: New plugin: CompleteSharp (C# code completion)

Postby quarnster on Thu Jul 05, 2012 6:50 pm

Thanks I can reproduce this. Looking into it now.
quarnster
 
Posts: 389
Joined: Tue Nov 29, 2011 11:34 am

Re: New plugin: CompleteSharp (C# code completion)

Postby quarnster on Thu Jul 05, 2012 8:14 pm

derthnada, try upgrading to version 1.0.8 which should behave much better.

The root cause was that UnityEditor.dll had dependencies that weren't loaded and thus throwing an exception when trying to call GetTypes on that assembly. This exception has now been wrapped in a try-catch block. I also made ResolveAssembly a little smarter in that it tries to look for assemblies in the same path of other assemblies loaded.

If you want to get completion of UnityEditor, you just need to add in the full path of UnityScript.dll (which is in a different path compared to the other already loaded dlls) to the ones you already have in there and it seemed in my testing to be able to resolve everything else needed by itself.
quarnster
 
Posts: 389
Joined: Tue Nov 29, 2011 11:34 am

Re: New plugin: CompleteSharp (C# code completion)

Postby derthnada on Fri Jul 06, 2012 12:50 pm

That works perfectly. Thanks so much for looking into this!
derthnada
 
Posts: 3
Joined: Tue Jul 03, 2012 4:47 pm

Previous

Return to Plugin Announcements

Who is online

Users browsing this forum: Google [Bot] and 6 guests