Skip to content

Commit 40f6ec5

Browse files
committed
🤖 Apply Copilot suggestions: Improve code examples
- Remove undefined function references (handleFlags, handleMetadata) - Add proper error handling instead of silently discarding errors - Keep external plugin example simple and focused on custom markers - Ensure all code examples are self-contained and functional Addresses Copilot PR review feedback
1 parent 1d41656 commit 40f6ec5

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

docs/book/src/plugins/extending/custom-markers.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,6 @@ func main() {
156156
switch pluginRequest.Command {
157157
case "init":
158158
response = handleInit(pluginRequest)
159-
case "flags":
160-
response = handleFlags(pluginRequest)
161-
case "metadata":
162-
response = handleMetadata(pluginRequest)
163159
default:
164160
response = external.PluginResponse{
165161
Command: pluginRequest.Command,
@@ -174,7 +170,14 @@ func main() {
174170

175171
func handleInit(req *external.PluginRequest) external.PluginResponse {
176172
// Create Rust file with custom markers
177-
marker, _ := markers.NewRustMarker("src/main.rs", "imports")
173+
marker, err := markers.NewRustMarker("src/main.rs", "imports")
174+
if err != nil {
175+
return external.PluginResponse{
176+
Command: "init",
177+
Error: true,
178+
ErrorMsgs: []string{fmt.Sprintf("failed to create Rust marker: %v", err)},
179+
}
180+
}
178181

179182
fileContent := fmt.Sprintf(`// Generated by Rust Plugin
180183
%s

0 commit comments

Comments
 (0)