Hidding namespace, using & co in the editor

Hi
I would to know if there is a way to hide all the “using” part, “namespace”, and even the class and method declarations of the editor, while keeping the fact that we are in this class::Method

In my project, i would purpose to my user a way to develop his own method using parameters.
I can load this parameters in memory from Solution::RegisterCode, that’s ok, but now
if i could hide all this code that doesn’t mean anything to the user that would be great

Best regards

Hi,

this sounds like the “SnippetParsers” sample would help here;-).

In the Demo Explorer, you will find it in “WinForms” => “Quickstart Projects” => “Editor” => “Parsers” => “Snippets Parsers”.
The source code is in your AlterNet installation in “C:\Users\Public\Documents\AlterNET Software\AlterNET Studio v.9\Demo\Editor\QuickStarts\Parsers\SnippetsParsers”.

Best regards
Wolfgang

2 Likes

Thanks for the answer, but as i’m not in a class environnement, then, i can’t register property class. (those are collected in the tree).
I would like to specify to the editor i’m in the class myClassName of the Namespace myNameSpaceName without writing it the Editor textBox

EDIT: I found CsParser:.Repository.MemberLookup event
Implemented it in the CodeSnippets project, but it seems it doesn’t work

(no stop on the breakpoint)

Not implemented ?

Hi,

I fear I don’t get your requirement :wink:
Do you won’t to edit only the body of a method in the editor, without showing the method name and arguments, or do you want to edit the class body, allowing the user to code methods and properties?

I use the approach to edit a method body. So, my class body looks like this:

namespace MyNamespace
{
  public class MyClass
  {
    public string MyMethod()
    {
      //Here comes the body of the method that is shown in the editor
    }
  }
}

With this approach, I could add additional properties by simply adding them to the (invisible) part of the code snipet, and thus they would be shown in code completion:

namespace MyNamespace
{
  public class MyClass
  {
    public string toto
    {
      get
      {
    
      }
    }

    public string MyMethod()
    {
      //Here comes the body of the method that is shown in the editor
    }
  }
}

Another approach would be to inherit “MyClass” from a base class in your assembly and code the property there.

Best regards

Wolfgang

1 Like

Yes ! thanks a lot, this is exactly what i want
Now, please, can you give the code sample to add namespace/class/toto to the invisible part
i must be stupid or blind (or both^^), i don’t see it

Did you look at the wrong sample by any chance? You wrote about the “CodeSnippets” sample, but I meant the “SnippetParsers”.

Best regards

Wolfgang

1 Like

You are right, wonderfull !
thanks Wolfgang