26 Commits

Author SHA1 Message Date
PJB3005
9802963933 Add [NotContentImplementable] attribute 2025-12-20 14:11:36 +01:00
Tayrtahn
d7abbad717 Add validation for DirtyField strings (#5713)
* Add ValidateMemberAttribute, analyzer and test

* Use attribute on DirtyFields methods

* Defer member lookup

* Additional test case

* Add support for collection types

* Poke tests

* Revert "Add support for collection types"

This reverts commit 2b8f5534bd.

* break, not continue

* Cheaper attribute check with AttributeHelper

* Clean up unused helper method

---------

Co-authored-by: PJB3005 <pieterjan.briers+git@gmail.com>
2025-12-17 19:32:34 +01:00
Tayrtahn
e771530de2 Mark AutoGenerateComponentStateAttribute fields as readonly (redo) (#6129)
* Mark AutoGenerateComponentStateAttribute fields as readonly

* Remove no-longer-valid test case
2025-08-05 00:48:36 -04:00
Tayrtahn
ce3a5f6bfa Revert "Mark AutoGenerateComponentStateAttribute fields as readonly (#6126)" (#6128)
This reverts commit 1cd802640a.
2025-08-04 18:32:54 -04:00
Tayrtahn
1cd802640a Mark AutoGenerateComponentStateAttribute fields as readonly (#6126) 2025-08-04 18:25:09 -04:00
Pieter-Jan Briers
72d893dec5 Add "obsolete inheritance" analyzer (#5858)
This allows us to make it obsolete to *inherit* from a class, and only that.

Intended so people stop inheriting UI controls for no good reason.

Fixes #5856
2025-04-19 17:29:17 +10:00
Tayrtahn
45bb8740a0 Add ForbidLiteralAttribute and analyzer (#5808)
* Add ForbidLiteral attribute, analyzer, and test

* Removed unused code

* Switch order of methods. It's better this way.
2025-04-08 16:39:38 +02:00
metalgearsloth
9837c33de7 Add sourcegenned field deltas (#5155)
* Remove full "delta" states

* Update MapGridComponentState

* abstract ComponentState

* Release notes

* Fix tests

* Fix nullable errors

* A

* Sourcegen component deltas

* Audio deltas + methids

* Also eye

* Optimise out the dictionary

* Minor fixes

* Physics deltas

* Also this

* Fix field deltas

* remove old release notes

* Make IComponentDelta implement IComponent

* add sourcegen launch settings

* make silent error loud

* Review

* UI deltas

* Slimmer

* Sourcegen bandaid

---------

Co-authored-by: ElectroJr <leonsfriedrich@gmail.com>
2024-12-21 15:48:33 +11:00
Tayrtahn
b6548c870c Add analyzer/fixer for replacing ProtoId<EntityPrototype> with EntProtoId (#5312)
* Add PreferOtherTypeAttribute, analyzer, and test.

* nullable enable

* Add nuget package for CodeFix verifier

* Add fixer for PreferOtherType

* Rename arguments

* Adjust diagnostic message

* Move attribute lookup
2024-07-23 19:01:43 +02:00
Tayrtahn
c3d8080a8e Add PreferNonGenericVariantFor attribute and analyzer (#5190)
Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
2024-07-10 12:33:56 +02:00
Pieter-Jan Briers
75b3431ee6 New "must call base" analyzer. (#5266)
* New "must call base" analyzer.

This enforces that you actually call base when overriding stuff. This is intended for base methods like entity system's, where server/client systems overriding shared ones SHOULD call Initialize() and such.

* Add MustCallBase to entity system methods
2024-06-28 14:44:49 +10:00
Leon Friedrich
3a479cb5f4 Add ComponentEventAttribute to AfterAutoHandleStateEvent (#5243) 2024-06-15 17:32:19 +02:00
Pieter-Jan Briers
b50f68866f Enable roslyn extension tests in CI (#5038)
* Enable roslyn extension tests in CI

* I'll be real I kinda just hoped that last one would work. dotnet test's --help documentation is useless garbage so I couldn't tell if that was supported or not. Guess not.

* Actually fix the Roslyn tests.

As far as I can tell, Roslyn tests haven't worked since #2976.

The tests used a pretty awful technique of linking the test code against the analyzer, so that the analyzer's copy of the relevant attributes got included into the test. This then broke when the namespace got changed by the linked PR.

Now the tests get an EmbeddedResource for the necessary test files compiled instead.

Also applied this to DependencyAssignAnalyzerTest because why not.
2024-04-14 09:26:07 +02:00
Pieter-Jan Briers
ae6cebbfbb Source gen reorganizations + component unpause generator. (#4896)
* Source gen reorganizations + component unpause generator.

This commit (and subsequent commits) aims to clean up our Roslyn plugin (source gens + analyzers) stack to more sanely re-use common code

I also built a new source-gen that automatically generates unpausing implementations for components, incrementing attributed TimeSpan field when unpaused.

* Fix warnings in all Roslyn projects
2024-02-20 10:15:32 +01:00
metalgearsloth
270326e188 Add IComponentState / struct support (#4610)
Still boxes but hey at least the struct dream is real.
2024-01-04 13:42:47 +11:00
DrSmugleaf
1745a12e5a Remove casts to Component (#4495) 2023-10-17 20:45:21 -07:00
DrSmugleaf
4818c3aab4 Make auto comp states infer when data should be cloned (#4461) 2023-09-30 15:14:10 +10:00
DrSmugleaf
66239d23ea Refactor serialization copying to use source generators (#4286) 2023-08-22 17:37:13 -07:00
Kara
85547a9be7 Auto-componentstate source generator (#3684)
* dog what am i doing

* finish gen source part from class symbol

* we are dangerously close to things happening

* generation fixes

* oh? on god?

* stop autogenerating the attribute for no reason + diagnostics

* testing diagnostics

* proper type name handling + clonedata bool

* thank you material storage for making me realize this

* forgot to commit

* p

* fixes for afterautohandlestate

* make it work with access
2023-04-06 12:32:57 -05:00
Paul Ritter
bafbdb6363 Analyzer to check that notnullableflag is being properly used (#3569) 2022-12-21 00:11:04 +01:00
Paul Ritter
ef0c0d0082 Analyzer to warn about using a boxing variant (#3564) 2022-12-20 23:53:02 +01:00
wrexbe
269d229c2d Fix hotreload (#2976) 2022-06-23 10:40:14 +02:00
Vera Aguilera Puerto
82a67ecd99 Add Access Permissions to friends, friend attributes now work in members too. (#2799) 2022-06-07 11:27:36 +02:00
Pieter-Jan Briers
de4d255841 Analyzer to enforce classes to be either [Virtual], abstract, or sealed. (#2469)
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
2022-02-05 19:31:58 +01:00
Vera Aguilera Puerto
c0d4e34089 Add Friend classes to C# with the help of Analyzers and Attributes. (#1928)
* Add Friend classes to C# with the help of Analyzers and Attributes.

* Revert to netstandard2.0

* Use LINQ instead of ^1 for array

* Address review.
Oops, forgot to push.
2021-08-06 09:50:22 +02:00
Paul Ritter
b3976eb8d7 Analyzer Bongaloo 2: The Return (#1512)
Co-authored-by: Paul <ritter.paul1+git@googlemail.com>
2021-02-08 18:05:27 +01:00