diff --git a/SourceGen/DisasmProject.cs b/SourceGen/DisasmProject.cs index 7bb655b..82080f7 100644 --- a/SourceGen/DisasmProject.cs +++ b/SourceGen/DisasmProject.cs @@ -2029,7 +2029,15 @@ namespace SourceGen { UpdateCpuDef(); if (needExternalFileReload) { - LoadExternalFiles(); + string errMsgs = LoadExternalFiles(); + + // TODO(someday): if the plugin failed to compile, we will have + // one or more error messages, which we are currently discarding + // because we can't create UI here. We either need a "change + // messages" feature, or we need to pre-flight the plugin and + // report the failure elsewhere. (We also want a manual + // "reload all external files and plugins" command, which might + // run through here.) } } // ignore affectedOffsets diff --git a/SourceGen/RuntimeData/Help/advanced.html b/SourceGen/RuntimeData/Help/advanced.html index 7521fe1..6315e47 100644 --- a/SourceGen/RuntimeData/Help/advanced.html +++ b/SourceGen/RuntimeData/Help/advanced.html @@ -113,6 +113,21 @@ will fail.
A project may load multiple scripts. The order in which they are invoked is not defined.
+Sometimes a manual refresh (F5) is required. Plugins are executed during +the code analysis pass, but SourceGen doesn't perform code analysis on +every change. If you add or change a label that a plugin is looking +for, you won't see the effects until you do something that causes the +code analysis pass to be run. Hitting F5 does this. (There's no easy +way around this -- either we have to re-run code analysis on every label +change, or we need a way to know which labels a plugin is interested in.)
+When a project is opened, any errors encountered by the script compiler +are reported to the user. If the project is already open, and a script +is added to the project through the Project Properties editor, compiler +messages are silently discarded. (This also applies if you undo/redo across +the property edit.)
+The easiest way to develop extension scripts is inside the 6502bench @@ -123,13 +138,15 @@ Visual Studio.)
If you have the solution configured for debug builds, SourceGen will set the IncludeDebugInformation flag to true when compiling scripts. This -causes a .PDB file to be created.
+causes a .PDB file to be created. While this can help with debugging, +it can sometimes get in the way: if you edit the script source code and +reload the project, SourceGen will recompile the script, but the old .PDB +file will still be open by VisualStudio and you'll get error messages.Some commonly useful functions are defined in the PluginCommon.Util class, which is available to plugins. These call into the CommonUtil library, -which is shared with SourceGen.
- -While plugins can use CommonUtil directly, they should avoid doing so. The +which is shared with SourceGen. +While plugins can use CommonUtil directly, they should avoid doing so. The APIs there are not guaranteed to be stable, so plugins that rely on them may break in a subsequent release of SourceGen.
diff --git a/SourceGen/Tests/GenTest.cs b/SourceGen/Tests/GenTest.cs index f7f8737..79a621d 100644 --- a/SourceGen/Tests/GenTest.cs +++ b/SourceGen/Tests/GenTest.cs @@ -477,7 +477,10 @@ namespace SourceGen.Tests { FileLoadReport unused = new FileLoadReport("test"); project.SetFileData(fileData, Path.GetFileName(dataPathName), ref unused); project.ProjectPathName = projectPathName; - project.LoadExternalFiles(); + string extMsgs = project.LoadExternalFiles(); + if (!string.IsNullOrEmpty(extMsgs)) { + ReportErrMsg(extMsgs); + } } TaskTimer genTimer = new TaskTimer();