diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index 9d6e17a..d56aace 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -4,8 +4,43 @@ SLNE-Development + Surf Framework is a comprehensive IntelliJ IDEA plugin that enhances development experience + for projects using the Surf ecosystem: surf-api, surf-redis, and surf-database-r2dbc. +

+ +

Features

+ +

Surf API Support (Paper/Velocity/Core)

+ + +

Surf Redis Support

+ + +

Surf Database R2DBC Support

+ + +

General

+ ]]>
com.intellij.modules.compose diff --git a/src/main/resources/inspectionDescriptions/MustBeInvokedByOverridersInspection.html b/src/main/resources/inspectionDescriptions/MustBeInvokedByOverridersInspection.html index 5365a23..00a62b5 100644 --- a/src/main/resources/inspectionDescriptions/MustBeInvokedByOverridersInspection.html +++ b/src/main/resources/inspectionDescriptions/MustBeInvokedByOverridersInspection.html @@ -1,27 +1,43 @@ -Write your description here. -Start the description with a verb in 3rd person singular, like reports, detects, highlights. -In the first sentence, briefly explain what exactly the inspection helps you detect. -Make sure the sentence is not very long and complicated. +Reports overriding methods that do not call the annotated super method.

- The first sentence must be in a dedicated paragraph separated from the rest of the text. This will make the - description easier to read. - Make sure the description doesn’t just repeat the inspection title. + Detects when a method overrides a function annotated with + @MustBeInvokedByOverriders or @OverridingMethodsMustInvokeSuper + but does not include a super.methodName() call.

- See https://plugins.jetbrains.com/docs/intellij/inspections.html#descriptions for more information. + Example of problematic code:

+

+open class Parent {
+    @MustBeInvokedByOverriders
+    open fun initialize() {
+        // important setup logic
+    }
+}
+
+class Child : Parent() {
+    override fun initialize() {
+        // Missing super.initialize() call - reported
+        doSomething()
+    }
+}
+

- Embed code snippets: + Correct code:


-// automatically highlighted according to inspection registration 'language' attribute
+class Child : Parent() {
+    override fun initialize() {
+        super.initialize()  // Required call
+        doSomething()
+    }
+}
 
-

Text after this comment will only be shown in the settings of the inspection.

- -

To open related settings directly from the description, add a link with `settings://$` optionally followed by `?$` to - pre-select a UI element.

+

+ The quick-fix adds a super.methodName() call at the beginning of the method body. +

- \ No newline at end of file + diff --git a/src/main/resources/inspectionDescriptions/RedisEventHandlerParameterInspection.html b/src/main/resources/inspectionDescriptions/RedisEventHandlerParameterInspection.html index 5365a23..ef023bb 100644 --- a/src/main/resources/inspectionDescriptions/RedisEventHandlerParameterInspection.html +++ b/src/main/resources/inspectionDescriptions/RedisEventHandlerParameterInspection.html @@ -1,27 +1,36 @@ -Write your description here. -Start the description with a verb in 3rd person singular, like reports, detects, highlights. -In the first sentence, briefly explain what exactly the inspection helps you detect. -Make sure the sentence is not very long and complicated. +Reports @OnRedisEvent handler methods with incorrect parameter signatures.

- The first sentence must be in a dedicated paragraph separated from the rest of the text. This will make the - description easier to read. - Make sure the description doesn’t just repeat the inspection title. + An @OnRedisEvent handler must have exactly one parameter, and that parameter + must be a subtype of RedisEvent. The framework uses this parameter type to + determine which events to route to the handler.

- See https://plugins.jetbrains.com/docs/intellij/inspections.html#descriptions for more information. + Example of problematic code:

+

+@OnRedisEvent
+fun onEvent() { }  // Missing parameter
+
+@OnRedisEvent
+fun onEvent(event: MyEvent, extra: String) { }  // Too many parameters
+
+@OnRedisEvent
+fun onEvent(data: String) { }  // Parameter is not a RedisEvent subtype
+

- Embed code snippets: + Correct code:


-// automatically highlighted according to inspection registration 'language' attribute
+@OnRedisEvent
+fun onEvent(event: MyEvent) {
+    // handle event
+}
 
-

Text after this comment will only be shown in the settings of the inspection.

- -

To open related settings directly from the description, add a link with `settings://$` optionally followed by `?$` to - pre-select a UI element.

+

+ Ensure the handler has exactly one parameter of a type that extends RedisEvent. +

- \ No newline at end of file + diff --git a/src/main/resources/inspectionDescriptions/RedisEventHandlerParameterNameInspection.html b/src/main/resources/inspectionDescriptions/RedisEventHandlerParameterNameInspection.html index 5365a23..c5aefe3 100644 --- a/src/main/resources/inspectionDescriptions/RedisEventHandlerParameterNameInspection.html +++ b/src/main/resources/inspectionDescriptions/RedisEventHandlerParameterNameInspection.html @@ -1,27 +1,23 @@ -Write your description here. -Start the description with a verb in 3rd person singular, like reports, detects, highlights. -In the first sentence, briefly explain what exactly the inspection helps you detect. -Make sure the sentence is not very long and complicated. +Reports @OnRedisEvent handler parameters that do not follow the naming convention.

- The first sentence must be in a dedicated paragraph separated from the rest of the text. This will make the - description easier to read. - Make sure the description doesn’t just repeat the inspection title. + By convention, the event parameter in @OnRedisEvent handlers should be named + event for consistency and readability across the codebase.

- See https://plugins.jetbrains.com/docs/intellij/inspections.html#descriptions for more information. -

-

- Embed code snippets: + Example:


-// automatically highlighted according to inspection registration 'language' attribute
+@OnRedisEvent
+fun onEvent(e: MyEvent) { }  // 'e' should be renamed to 'event'
+
+@OnRedisEvent
+fun onEvent(event: MyEvent) { }  // Correct
 
-

Text after this comment will only be shown in the settings of the inspection.

- -

To open related settings directly from the description, add a link with `settings://$` optionally followed by `?$` to - pre-select a UI element.

+

+ The quick-fix renames the parameter to event. +

- \ No newline at end of file + diff --git a/src/main/resources/inspectionDescriptions/RedisEventMissingSerializable.html b/src/main/resources/inspectionDescriptions/RedisEventMissingSerializable.html index d5f869d..97518ad 100644 --- a/src/main/resources/inspectionDescriptions/RedisEventMissingSerializable.html +++ b/src/main/resources/inspectionDescriptions/RedisEventMissingSerializable.html @@ -1,27 +1,28 @@ -Write your description here. -Start the description with a verb in 3rd person singular, like reports, detects, highlights. -In the first sentence, briefly explain what exactly the inspection helps you detect. -Make sure the sentence is not very long and complicated. +Reports classes that extend RedisEvent, RedisRequest, or RedisResponse +but are missing the @Serializable annotation.

- The first sentence must be in a dedicated paragraph separated from the rest of the text. This will make the - description easier to read. - Make sure the description doesn’t just repeat the inspection title. + All Redis message types must be serializable to be transmitted over the Redis pub/sub channel. + Without the @Serializable annotation from kotlinx.serialization, the message + cannot be encoded/decoded and will cause runtime errors.

- See https://plugins.jetbrains.com/docs/intellij/inspections.html#descriptions for more information. + Example of problematic code:

+

+class MyEvent(val data: String) : RedisEvent  // Missing @Serializable
+

- Embed code snippets: + Correct code:


-// automatically highlighted according to inspection registration 'language' attribute
+@Serializable
+class MyEvent(val data: String) : RedisEvent
 
-

Text after this comment will only be shown in the settings of the inspection.

- -

To open related settings directly from the description, add a link with `settings://$` optionally followed by `?$` to - pre-select a UI element.

+

+ The quick-fix adds the @Serializable annotation from kotlinx.serialization. +

- \ No newline at end of file + diff --git a/src/main/resources/inspectionDescriptions/RedisHandlerModifierInspection.html b/src/main/resources/inspectionDescriptions/RedisHandlerModifierInspection.html index 5365a23..a384f60 100644 --- a/src/main/resources/inspectionDescriptions/RedisHandlerModifierInspection.html +++ b/src/main/resources/inspectionDescriptions/RedisHandlerModifierInspection.html @@ -1,27 +1,37 @@ -Write your description here. -Start the description with a verb in 3rd person singular, like reports, detects, highlights. -In the first sentence, briefly explain what exactly the inspection helps you detect. -Make sure the sentence is not very long and complicated. +Reports Redis handler methods with modifiers that are incompatible with MethodHandles.Lookup.

- The first sentence must be in a dedicated paragraph separated from the rest of the text. This will make the - description easier to read. - Make sure the description doesn’t just repeat the inspection title. + Methods annotated with @OnRedisEvent or @HandleRedisRequest + are invoked via reflection using MethodHandles. Certain modifiers like + abstract, open, override, and inline + can interfere with this mechanism.

- See https://plugins.jetbrains.com/docs/intellij/inspections.html#descriptions for more information. + Example of problematic code:

+

+@OnRedisEvent
+abstract fun onEvent(event: MyEvent)  // abstract not allowed
+
+@OnRedisEvent
+open fun onEvent(event: MyEvent) { }  // open not recommended
+
+@OnRedisEvent
+inline fun onEvent(event: MyEvent) { }  // inline not allowed
+

- Embed code snippets: + Correct code:


-// automatically highlighted according to inspection registration 'language' attribute
+@OnRedisEvent
+fun onEvent(event: MyEvent) {
+    // handle event
+}
 
-

Text after this comment will only be shown in the settings of the inspection.

- -

To open related settings directly from the description, add a link with `settings://$` optionally followed by `?$` to - pre-select a UI element.

+

+ The quick-fix removes the problematic modifier from the function declaration. +

- \ No newline at end of file + diff --git a/src/main/resources/inspectionDescriptions/RedisHandlerSuspendFunction.html b/src/main/resources/inspectionDescriptions/RedisHandlerSuspendFunction.html index 5365a23..536813c 100644 --- a/src/main/resources/inspectionDescriptions/RedisHandlerSuspendFunction.html +++ b/src/main/resources/inspectionDescriptions/RedisHandlerSuspendFunction.html @@ -1,27 +1,36 @@ -Write your description here. -Start the description with a verb in 3rd person singular, like reports, detects, highlights. -In the first sentence, briefly explain what exactly the inspection helps you detect. -Make sure the sentence is not very long and complicated. +Reports Redis handler methods that are declared as suspend functions.

- The first sentence must be in a dedicated paragraph separated from the rest of the text. This will make the - description easier to read. - Make sure the description doesn’t just repeat the inspection title. + Methods annotated with @OnRedisEvent or @HandleRedisRequest + must not be suspend functions. The Redis handler framework invokes these methods + synchronously using reflection, and suspend functions are not compatible with this mechanism.

- See https://plugins.jetbrains.com/docs/intellij/inspections.html#descriptions for more information. + Example of problematic code:

+

+@OnRedisEvent
+suspend fun onEvent(event: MyEvent) {  // suspend not allowed
+    // ...
+}
+

- Embed code snippets: + Correct code:


-// automatically highlighted according to inspection registration 'language' attribute
+@OnRedisEvent
+fun onEvent(event: MyEvent) {
+    myCoroutineScope.launch {
+        // async work here
+    }
+}
 
-

Text after this comment will only be shown in the settings of the inspection.

- -

To open related settings directly from the description, add a link with `settings://$` optionally followed by `?$` to - pre-select a UI element.

+

+ The quick-fix removes the suspend modifier. If you need to perform + asynchronous operations, launch a coroutine inside the handler using your own + CoroutineScope. +

- \ No newline at end of file + diff --git a/src/main/resources/inspectionDescriptions/RedisRequestHandlerParameterInspection.html b/src/main/resources/inspectionDescriptions/RedisRequestHandlerParameterInspection.html index 5365a23..fb48212 100644 --- a/src/main/resources/inspectionDescriptions/RedisRequestHandlerParameterInspection.html +++ b/src/main/resources/inspectionDescriptions/RedisRequestHandlerParameterInspection.html @@ -1,27 +1,38 @@ -Write your description here. -Start the description with a verb in 3rd person singular, like reports, detects, highlights. -In the first sentence, briefly explain what exactly the inspection helps you detect. -Make sure the sentence is not very long and complicated. +Reports @HandleRedisRequest handler methods with incorrect parameter signatures.

- The first sentence must be in a dedicated paragraph separated from the rest of the text. This will make the - description easier to read. - Make sure the description doesn’t just repeat the inspection title. + A @HandleRedisRequest handler must have exactly one parameter of type + RequestContext<T>, where T is a subtype of RedisRequest. + The RequestContext provides access to the incoming request and the mechanism to + send a response.

- See https://plugins.jetbrains.com/docs/intellij/inspections.html#descriptions for more information. + Example of problematic code:

+

+@HandleRedisRequest
+fun handle() { }  // Missing parameter
+
+@HandleRedisRequest
+fun handle(context: RequestContext<MyRequest>, extra: String) { }  // Too many parameters
+
+@HandleRedisRequest
+fun handle(request: MyRequest) { }  // Wrong parameter type
+

- Embed code snippets: + Correct code:


-// automatically highlighted according to inspection registration 'language' attribute
+@HandleRedisRequest
+fun handle(context: RequestContext<MyRequest>) {
+    val request = context.request
+    context.respond(MyResponse(...))
+}
 
-

Text after this comment will only be shown in the settings of the inspection.

- -

To open related settings directly from the description, add a link with `settings://$` optionally followed by `?$` to - pre-select a UI element.

+

+ Ensure the handler has exactly one parameter of type RequestContext<T : RedisRequest>. +

- \ No newline at end of file + diff --git a/src/main/resources/inspectionDescriptions/RedisRequestHandlerParameterNameInspection.html b/src/main/resources/inspectionDescriptions/RedisRequestHandlerParameterNameInspection.html index 5365a23..748c4e8 100644 --- a/src/main/resources/inspectionDescriptions/RedisRequestHandlerParameterNameInspection.html +++ b/src/main/resources/inspectionDescriptions/RedisRequestHandlerParameterNameInspection.html @@ -1,27 +1,23 @@ -Write your description here. -Start the description with a verb in 3rd person singular, like reports, detects, highlights. -In the first sentence, briefly explain what exactly the inspection helps you detect. -Make sure the sentence is not very long and complicated. +Reports @HandleRedisRequest handler parameters that do not follow the naming convention.

- The first sentence must be in a dedicated paragraph separated from the rest of the text. This will make the - description easier to read. - Make sure the description doesn’t just repeat the inspection title. + By convention, the RequestContext parameter in @HandleRedisRequest + handlers should be named context for consistency and readability across the codebase.

- See https://plugins.jetbrains.com/docs/intellij/inspections.html#descriptions for more information. -

-

- Embed code snippets: + Example:


-// automatically highlighted according to inspection registration 'language' attribute
+@HandleRedisRequest
+fun handle(ctx: RequestContext<MyRequest>) { }  // 'ctx' should be 'context'
+
+@HandleRedisRequest
+fun handle(context: RequestContext<MyRequest>) { }  // Correct
 
-

Text after this comment will only be shown in the settings of the inspection.

- -

To open related settings directly from the description, add a link with `settings://$` optionally followed by `?$` to - pre-select a UI element.

+

+ The quick-fix renames the parameter to context. +

- \ No newline at end of file +