Is there a way to make a c++ header & code file editor only?

Was wondering if there was a way to make an entire c++ file editor only, rather than just encasing the entire script with WITH_EDITOR preprocessor. Seems kind of dumb to make the compiler open up an (effectively) empty script. I feel like this sort of thing surely exists within the editor by default.

Also worth mentioning this is within a plugin. I’d like this script to be marked editor only by default in any projects this plugin is added to.

Any info is greatly appreciated

You need to change the module type in your .uplugin for this (Unkooked Only or Editor).
This code does not get into the packaged project.

But what if I only want only a specific script in the plugin to not be packaged? Or would the editor only bits need to be moved to another plugin to achieve this?

A plugin can have any number of modules (one with the same name is simply created by default).
Code for the editor and runtime should be in separate modules. You can connect (include) the runtime module to the editor module (but not vice versa).

OH okay awesome, I was under the impression the plugin was just a type of module, and couldn’t contain inner modules