Skip to content

Add semantic model AI metadata scripts#31

Open
data-goblin wants to merge 2 commits into
TabularEditor:masterfrom
data-goblin:kurt/ex004/semantic-model-ai-metadata-scripts
Open

Add semantic model AI metadata scripts#31
data-goblin wants to merge 2 commits into
TabularEditor:masterfrom
data-goblin:kurt/ex004/semantic-model-ai-metadata-scripts

Conversation

@data-goblin

Copy link
Copy Markdown

Adds a Semantic Model AI Metadata folder with three C# scripts: non-interactive AI metadata management, TE3 AI instructions editor, and TE3 AI schema editor. Includes README usage docs and top-of-file script documentation. Validation: git diff --cached --check.

var type = assembly.GetType("ScintillaNET.Scintilla", true);
var control = (Control)Activator.CreateInstance(type);
ConfigureScintilla(control, lexerName, wordWrap);
return new ScriptTextEditor(control, null, wordWrap);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Applies to linse 356-362)

On my machine, I could not get Scintilla to load this way. Most likely because the assembly name is Scintilla.NET (with a dot). But even if I fix that, Scintilla still doesn't syntax highlight markdown/JSON the way that was probably intended.

I suggest removing everything related to Scintilla from these scripts, and just always rely on default Winforms textbox (like the fallback below). This should also make the script work in TE2 and make it less brittle, in case we move away from Scintilla in a future update of TE3.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, there's lot of Scintilla specific configuration code (which also uses reflection) further down in the script. That should be trimmed out as well.

if (helperType == null) return false;

var method = helperType.GetMethod("ImportCulture", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
if (method == null) return false;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(applies to lines 265-269)

It's OK to keep this in, even though it's technically accessing internals, there's an argument to be made that the ImportCulture method should be available for the public scripting API. I've added this to our internal backlog. Once that's implemented, we can then update this script to use the public surface instead of reflection.

var type = assembly.GetType("ScintillaNET.Scintilla", true);
var control = (Control)Activator.CreateInstance(type);
ConfigureScintilla(control, lexerName, wordWrap);
return new ScriptTextEditor(control, null, wordWrap);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment as for the AI Instructions script; let's avoid using Scintilla (and trim down the Scintilla config code in this script), and just rely on the standard WinForms TextBox instead.

@data-goblin

Copy link
Copy Markdown
Author

@otykier Done, ready for re-review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants