Saving self-written code - xtend - code-generation

I want to know if it is possible to save self-written code within a generated file. If you change the model and then push the save button, all code is overwritten. I want to save some of the code of the old file.

Xtend uses a source generating compiler thus the produced Java code for Xtend itself cannot be altered on the source level.
Nevertheless, if you use Xtend's template expression to generate code, you can of course insert protected regions to allow users to modify the generated code. This OS project on Github implements support for protected regions in Xtend.

Related

What's the point of using UnityEditor assembly if you can't build project?

As the title says.
I use a couple of scripts that extend the Unity editor functionality, like SceneAsset class or TagSelector attribute, but now I just realized I can't build my project because of them and now I have to delete all of these and replace them with normal string and fill it myself, which I was avoiding until now.
Do I use these classes only for development? I know I can use #if UNITY_EDITOR #endif so part of the code will only work if built via Unity Editor, but in my case, this seems ugly because I want to declare fields via the inspector. Do I have to declare multiple fields for the same thing and separate the usage or is it possible to make two versions for one field so I don't have to change the code?
You can't have anything using UnityEditor in a build since this namespace is completely stripped of.
You only use it so you can implement editor scripts that simply only extend the functionality of the Unity Editor itself ... custom Inspectors/Windows etc.
Make sure you
Either put these in folders called Editor! these are excluded from the build automatically
Or use the pre-processors as you mentioned
Serialized fields should be used for both, editor and build (otherwise you will always get some warning about mismatching serialization layouts). If you need them for the editor, just keep them for the build as well even if they are not really of use there - they don't hurt and nobody will see them anyway.

Evaluating Environment Variables in VS Code Extension

I'm developing an extension in VS Code to add language support for OpenSCAD (Script-based 3D modeling program). Currently, I have been working on a way to open / preview a file in OpenSCAD from VS Code, which I have been able to do successfully using my own preview manager.
My issue is that I want to add configurable naming formats when exporting an OpenSCAD file that use environment variables similar to those used in the tasks.json file. More info can be found here: https://code.visualstudio.com/docs/editor/variables-reference. As an example, taking the file test.scad and the export configuration ${fileBasenameNoExtension}.stl would export to the file test.stl.
Additionally, I want to add a custom variable, ${#} that would evaluate after all other variables as a unique version number to avoid duplicate exported files. Using the example file: test.scad and the export configuration, ${fileBasenameNoExtension}_${#}.stl, the extension would export to the file test_1.stl for the first time. Then, seeing that test_1.stl exists, it would export to test_2.stl, and so on. I implement similar functionality in all of my exporting utilities, so it is important I can implement it here.
Now that the intro is done, on to the actual question: To anyone who knows more about the VS Code API than I do, in order to best get the functionality described above, should I implement environment variable evaluation into my custom preview manager or reimplement the preview manager I have using tasks? Because I have already implemented my own preview manager that I am happy with, I would prefer to do the former. However, I have been unable to find any functions in the VS Code API that will evaluate the environment variables in a string. Is there a typescript function to evaluate environment variables in the API that I have missed?
If re-implementing this functionality using tasks is a better way to achieve my goal, would I have to sacrifice the control I have in my preview manager, such as being able to selectively kill open previews and dispalying active exports?
Or, is there a compromise that could use all of the power from tasks without losing any functionality I've already developed?
Link to branch of my extension's repository: https://github.com/Antyos/vscode-openscad/tree/PreviewModel

VS Code resx file extension

Seems like there is no way to automatically create and manage resx files in VS Code now. Does someone know extension for it?
P.S. Yeah, I know that I can edit resx file as bare xml, but it`s not a right way.
The problem with resx is that it uses a Visual Studio "Custom Tool" to generate the code for the resources, and so requires Visual Studio to function fully.
I've been working on a replacement to resx that should also work from VS Code. It uses json rather than xml to define the resources, but otherwise behaves much like a resx file. The json resources file uses a ".resj" extension, and has a very simple structure. It currently only supports string resources that can be defined either inline in the json, or in an external file reference.
The project is open source on GitHub here:
https://github.com/MarkPflug/Elemental.JsonResource/
This is available as a nuget package "Elemental.JsonResource", currently only pre-release. Simply add this package to your project to enable using resj files. It doesn't add a runtime dependency to your project, everything is done at build-time. My hope is to provide feature-parity with what a resx file can do, but it could be useful even in its current state.

Doxygen Automatic Stub Generation

I am curious if doxygen itself can be used to automatically add doxygen comment stubs to my partially documented C++ project.
I use the DoxygenToolkit in vim, but :Dox above each function in a rather large project is rather taxing. I'd rather spend that energy actually writing documentation.
I am not asking about a plugin to an IDE for newly written code, such as:
Automatic generation of function stubs
but massive amounts of preexisting code.
No, Doxygen cannot modify your source. This is an editor feature.

automatic code generation for IDL (ITTVIS/exelis) in eclipse IDE?

I was hoping to find a way to automatically generate some code based on existing code.
The actual functionality would be very similar to javadoc or in this case IDLdoc or to automatic get/set functions.
I want to create some generic code based on some already listed parameters.
How do I accomplish this within eclipse?
I think an example would be best, so here is what I would like to accomplish:
keyword1: stuffIdontCareAbout, $;comments
keyword2: otherStuffIdontCareAbout, $;more comments
keyword3: lastStuffIdontCareAbout $
What do I need to do in eclipse so that I can have eclipse quickly parse the above block and output the following for another part of the code?
KEYWORD1=inp_keyword1, KEYWORD2=inp_keyword2, KEYWORD3=inp_keyword3
Thanks
My usual knee-jerk response is to suggest that you use JET as that what it's designed for.
For this specific case, however, you might be better off just writing a simple popup action (use the new plugin project with the popup action template) that parses the properties file (looks simple enough to do in Java) and writes out the target code to another file, the console or, if you're clever, back into an existing file in the right place.
Once you have the plugin generated for you with the template, the rest should be simple Java.