12-24-2021, 11:23 PM
This took me a bit to figure out exactly what was causing the issue. It seems if I have a Script file that includes two class files (in my case partial classes) that BOTH reference the same assembly, the editor gets funky when trying to edit the top-level script. All auto-indenting, code completion and other editor extensions seem to stop working.
If I'm doing something wrong or there is another approach I can I'm open to suggestions. Essentially I have a shared library of common functions for a larger project I'm working on. Trying to split up the code into multiple partial class files so that it's easier to maintain and edit in the future. In this example I created two partial class files that both reference an assembly (Class1). The Script is referencing the partial class files. When I stop referencing the assembly in the partial class files, I of course get errors in that code.
In the end, the code will still run if I only attach the assembly to the Script level, but it makes modifying the partial classes harder without code completion / auto documentation.
Here's some sample code:
Class1 (shared and compiled to .dll as a Class Library):
Partial1:
Partial2:
Script that references the partials:
If I remove Partial2.cs from the meta comment at the top, my autocompletion comes back in that file.
If I'm doing something wrong or there is another approach I can I'm open to suggestions. Essentially I have a shared library of common functions for a larger project I'm working on. Trying to split up the code into multiple partial class files so that it's easier to maintain and edit in the future. In this example I created two partial class files that both reference an assembly (Class1). The Script is referencing the partial class files. When I stop referencing the assembly in the partial class files, I of course get errors in that code.
In the end, the code will still run if I only attach the assembly to the Script level, but it makes modifying the partial classes harder without code completion / auto documentation.
Here's some sample code:
Class1 (shared and compiled to .dll as a Class Library):
C# code:
// class "" /*/ role classLibrary; outputPath %folders.ThisApp%\Libraries; /*/
public class ExampleSharedClass {
public static void Function1() {
print.it("Function1 from ExampleSharedClass");
}
}
Partial1:
C# code:
// class "Partial1.cs" /// Part of a partial class in a project folder.
/*/ r Libraries\Class1.dll; /*/
partial class Example {
private ExampleSharedClass example = new ExampleSharedClass();
void Function1() {
print.it("Output from Func1 in Partial Classfile 1");
}
}
Partial2:
C# code:
// class "Partial2.cs" /// Part of a partial class in a project folder.
/*/ r Libraries\Class1.dll; /*/
partial class Example {
void Function1() {
print.it("Output from Func1 in Partial Classfile 2");
}
}
Script that references the partials:
C# code:
// script "" /*/ c Partial1.cs; c Partial2.cs; /*/
script.setup(trayIcon: true);
If I remove Partial2.cs from the meta comment at the top, my autocompletion comes back in that file.