Author Topic: C# auto-complete getting confused by generics/properties  (Read 824 times)

evanratt

  • Senior Community Member
  • Posts: 300
  • Hero Points: 23
C# auto-complete getting confused by generics/properties
« on: January 25, 2016, 05:28:44 pm »
My implementation of a Singleton class in C# seems to be confusing the auto-complete and parameter help functionality. I don't know if it's my use of generics or properties that is causing the confusion.

Say I have the following code:
Code: [Select]
public abstract class FooSingleton<T>
where T: FooSingleton<T>, new() {
protected static T m_instance;

public static T Instance {
get {
if (m_instance == null) {
m_instance = new T();
}
return m_instance;
}
}
}

public class Foo : FooSingleton<Foo>
{
public void Baz() {
}
}

public class Test
{
public void TestFn() {
Foo.Instance.Baz();
}
}

In Test.TestFn(), if I have my cursor after "Foo.Instance." and press Ctrl+Space (codehelp-complete), I get the following message on the status bar:
Quote
Unable to locate definition of expression type: 'Foo.Instance.'
I would expect it to either display Baz() in a dropdown list, or auto-fill-in Baz(), depending on my auto-complete configuration.

If I put my cursor inside the parens of Foo.Instance.Baz() and press Alt+, (function-argument-help), I get this message:
Quote
No help found for this function: Foo.Instance.
I would expect it to display a tooltip with the Baz() function declaration: "void Foo.Baz()".


Version information:
Code: [Select]
SlickEdit Pro 2015 (v20.0.1.2 64-bit)

Serial number: WB824242
Licensed number of users: Single user
License file: C:\ProgramData\slickedit\20\slickedit.lic

Build Date: December 11, 2015
Emulation: Epsilon

OS: Windows 7 x64
OS Version: 6.01.7601  Service Pack 1
Memory: 51% Load, 8478MB/16309MB Physical, 9313MB/32617MB Page File, 500MB/8388607MB Virtual
Shell Information: C:\TCCLE13x64\tcc.exe
Screen Size: 1920 x 1200, 1920 x 1200

Project Type: (Other)
Language: .cs (C#)
Encoding: Automatic

Installation Directory: C:\Program Files\SlickEdit Pro 20.0.1\ (non-removable drive,NTFS,45798MB free)
Configuration Directory: C:\Users\evan\Documents\My SlickEdit Config\20.0.1\ (non-removable drive,NTFS,45798MB free)
Migrated from: C:\Users\evan\Documents\My SlickEdit Config\20.0.0\
Spill File: c:\temp\$slk.12740 (non-removable drive,NTFS,45798MB free)


Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2834
  • Hero Points: 429
Re: C# auto-complete getting confused by generics/properties
« Reply #1 on: January 26, 2016, 09:54:50 pm »
A fix for this issue will be in the next hot-fix for V20.0.1.

Thanks for the succinct example.