SyntaxEditor as Roslyn script textbox

SyntaxEditor .NET Languages Add-on for WPF Forum

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was before this thread was created.
Posted 20 days ago by Nick Witvrouwen
Version: 19.1.0683
Avatar

I am trying to use the SyntaxEditor + c# addon as a Roslyn script textbox.

To accomplish this, I try to wrap the expression body in a dummy footer/header that is ignored by the Roslyn script compiler

Document.SetHeaderAndFooterText(
@"using System;class _class_{static void _main_(){return ",
@"}}");

This seems to work, but does feel like a nasty hack.

Is there any other better way of getting the same result?

A problem with my approach is that the dummy "_class_" and "_main_" identifiers show up in the intellisense completion box.

Is there a way to ignore these entries?

Comments (2)

Answer - Posted 20 days ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Nick,

What you are doing is correct since you do need to wrap the "expression" portion being edited with a legitimate C# type/member, or else IntelliPrompt won't work. 

I'd probably suggest adding this attribute on both your "_class_" and "_main_".  We watch for this attribute and prevent types/members with it from showing in the IntelliPrompt completion list:

[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]


Actipro Software Support

Posted 20 days ago by Nick Witvrouwen
Avatar

Excellent! 

thanks for the quick response.

Add Comment

Please log in to a validated account to post comments.