Author Topic: Auto-complete for c# does not work if use @ symbol  (Read 2155 times)

deanj

  • Junior Community Member
  • Posts: 3
  • Hero Points: 0
Auto-complete for c# does not work if use @ symbol
« on: November 22, 2011, 11:21:45 pm »
Hi. I am using SlickEdit 2011 (v16.0.3.0 64-bit). I have the latest cumulative hotfixes. I am noticing that if I define a variable and assign it an xml string in a c# file, then auto-complete for fields/methods following the variable definition no longer works. Here is the repro:

1) Create a c# file, call it myclass.cs. In this file, add the following code:
namespace Company.Department
{
    using System;
    using System.IO;

    public class MyClass
    {
        private bool m_flag1;
        private bool m_flag2;

        public bool Flag1
        {
            get
            {
                return m_flag1;
            }
        }       

        private const string SomeXsdScheme = @"
        <?xml version=""1.0""?>
         <xs:schema xmlns:xs=""http://www.w3.org/2001/XMLSchema"">
         <xs:import namespace=""http://www.w3schools.com/schema""/>
        </xs:schema>";

        public bool Flag2
        {
            get
            {
                return m_flag2;
            }
        }
    }
}

2) Create another c# file, call it usemyclass.cs. In this file, add this code:
namespace Company.Department
{
    using System;
    using System.IO;

    public class UseMyClass
    {
        public UseMyClass
        {           
        }
    }
}

3) In file usemyclass.cs, in the 'public UseMyClass' constructor, create a new MyClass instance and I notice that I will not get autocomplete for the MyClass.Flag2 property. If I remove the 'namespace' attribute from the 'xs:import' element in the xml string assigned to the SomeXsdScheme variable in myclass.cs, autocomplete for the MyClass.Flag2 property does work. For example, if the variable is defined like the following, autocomplete works:

private const string SomeXsdScheme = @"
<?xml version=""1.0""?>
 <xs:schema xmlns:xs=""http://www.w3.org/2001/XMLSchema"">
 <xs:import/>
</xs:schema>";

Does anyone have any insights on this?
« Last Edit: November 30, 2011, 04:37:24 am by deanj »

chrisant

  • Senior Community Member
  • Posts: 1413
  • Hero Points: 131
Re: Auto-complete for c# does not work if have xml as string variable
« Reply #1 on: November 23, 2011, 12:05:35 am »
In C# syntax, isn't there supposed to be a ; at the end of the string declaration?
The sample code in the original post doesn't have a ; statement terminator.

deanj

  • Junior Community Member
  • Posts: 3
  • Hero Points: 0
Re: Auto-complete for c# does not work if use @ symbol
« Reply #2 on: November 23, 2011, 12:11:33 am »
Yes, that was a typo in the sample above. But, still repros. I updated the sample. Also, I am finding that if I remove the '@' and put the xml on one line, autocomplete works. It is looking like '@' could be the crux of the problem. Looks like SE maybe having problems with that type of c# syntax.
« Last Edit: November 30, 2011, 04:37:54 am by deanj »

Phil Barila

  • Senior Community Member
  • Posts: 746
  • Hero Points: 61
Re: Auto-complete for c# does not work if have xml as string variable
« Reply #3 on: November 23, 2011, 12:43:59 am »
I've seen oddities that I thought could have been due to the @ string modifier, but I never chased it down enough to open a support case.  If you open a support ticket (Help->"Contact Product Support" - real intuitive label, there), it is far more likely to get fixed than if you do not.

deanj

  • Junior Community Member
  • Posts: 3
  • Hero Points: 0
Re: Auto-complete for c# does not work if use @ symbol
« Reply #4 on: November 30, 2011, 04:36:59 am »
Yeah, that is probably the best course now. I opened a support case. Will let you all know how it goes.