Quantcast
Channel: SharpDevelop Community
Viewing all articles
Browse latest Browse all 1764

Using standalone code completion for my custom application

$
0
0

Hello!

As described in this post, I'm trying to use some functionalities for my custom application.

Here are some fragments of code that I have written in order to show completion list:

  • Initialization:

           var core = new CoreStartup("MyApp");
           core.ConfigureExternalAddIns(@"C:\Program Files (x86)\SharpDevelop\4.2\AddIns\ICSharpCode.SharpDevelop.addin"); // default IDE addins
           core.StartCoreServices();

 

  •  TextEditor creation:

 

var service = new AvalonEditorControlService();

           object control = null;
           service.CreateEditor(out control);
           textEditor = (SharpDevelopTextEditor)control;
           textEditor.SyntaxHighlighting = HighlightingManager.Instance.GetDefinitionByExtension(".cs");
           CodeCompletionEditorAdapter completionAdapter = new MyCustomCodeCompletionEditorAdapter(textEditor); // just overrides FileName returning "temp.cs"
           textEditor.TextArea.TextView.Services.AddService(typeof(ITextEditor), completionAdapter);

  • Completion Trigger (in some button or anything else) 

 

            ITextEditor editor = (ITextEditor)textEditor.TextArea.GetService(typeof(ITextEditor));
            new DotCodeCompletionItemProvider().ShowCompletion(editor);

 

  • I have also modified this method to public and called it on the initialization
    public static void InitializeParserService

 

When I debug ParserService.cs(line 212 - "foreach (ParserDescriptor descriptor in parserDescriptors) {", parserDescriptors is empty, and it causes "CodeCompletionItemProvider.GetExpressionFromOffset" to return ExpressionResult.Empty, empty intellisense items and no intellisense =/

In my project there is no concept of project or solutions, but I do have my imported dlls and scoped variables.

Are there any guidelines that would help me in this task?

Thanks for the help and for the great work on this library! 


Viewing all articles
Browse latest Browse all 1764

Trending Articles