Problem with CodeFragment

SyntaxEditor for Windows Forms Forum

Posted 11 years ago by Marco La Tona
Version: 4.0.0272
Avatar
Hi,

in my project, the code fragments don`t work. I have add following code to the header property:

using System;
using Software4You.VAR;
namespace Software4You.VAR {
private class Formula {
private decimal Calculate(RatioClass Ratio, InputClass Input) {

and following code to the footer property:

}
private class RatioClass {
public decimal COMPANYJAHRUMSATZ { get { return 0; } }
public decimal PATENTE { get { return 0; } }
}
private class InputClass {
public decimal KEY1 { get { return 0; } }
public decimal KEY2 { get { return 0; } }
}
}
}

In your example it works fine. But when I create a new project and add this code to the properties, the IntelliSense dont`t work when I use the Function parameter 'Input' and 'Ratio'.
This code I use in the Form_Load event:

DotNetProjectResolver dotNetProjectResolver = new DotNetProjectResolver();
dotNetProjectResolver.AddExternalReferenceForSystemAssembly("System");
dotNetProjectResolver.AddAllAssembliesInAppDomainAsExternalReferences();
CSharpSyntaxLanguage language = new CSharpSyntaxLanguage();

syntaxEditor1.Document.Language = language;
syntaxEditor1.Document.LanguageData = dotNetProjectResolver;
syntaxEditor1.Document.HeaderText = ...
syntaxEditor1.Document.FooterText = ...
syntaxEditor1.Document.Reparse();

What`s wrong? Why works it only with your example?

Regards
Marco

Comments (4)

Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Marco,

There are several steps of things you MUST do to configure the .NET Languages Add-on. In the overview topic for the add-on in the documentation, please read the Key Steps for Getting Started section. For instance I can see you are missing a cache path setting, which is essential, and you don't appear to be starting the semantic parser service either. But be sure you follow all those steps indicated in the documentation. Then it should work fine.


Actipro Software Support

Posted 11 years ago by Marco La Tona
Avatar
Hi,

thank you for the answer. After I set the Document.Filename property, it works.
But it works only correct, when I use the c# language.
Please insert following code in your vb sample.

HeaderText =

Imports System
Imports Software4You.VAR

Namespace Software4You.VAR
Public Class Formula
Public Sub New()
End Sub
Public Function Calculate() As Decimal

FooterText =

End Function
Private Ratio As RatioClass = New RatioClass()
Private Class RatioClass
Public Sub New()
End Sub
Public ReadOnly Property COMPANYJAHRUMSATZ()
Get
Return 0
End Get
End Property
Public ReadOnly Property PATENTE()
Get
Return 0
End Get
End Property
End Class
End Class
End Namespace


When you type the key word 'Ratio' in the syntax editor, no intelli sense is visible. But the class Ratio have two properties. In the c# sample it works.

Regards
Marco
Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
A common mistake is if you don't ensure there is a line terminator at the end of the header text. Remember that VB statements and declarations require that line terminator. Try inserting that and I bet it will work.


Actipro Software Support

Posted 11 years ago by Marco La Tona
Avatar
Hi,

thank you for your answer. Now it works. I have forgot the line terminator at the begin of the footer text.

Regards
Marco
The latest build of this product (v2018.1 build 0341) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.