Skip to content

Conversation

@linonetwo
Copy link
Contributor

@linonetwo linonetwo commented Dec 26, 2025

69ec62492eefdf68a2121e1c79316c38

Plugin author could forget to return value when calling hook. I'd like to discuss if it is necessary to warn them (in this case, it is me, my streams-outliner-lib plugin (based on @saqimtiaz's streams) forget to return the value).
Otherwise it will cause error on other authors' plugin (in this case, error is from my external-attachment-plugin)

https://github.com/saqimtiaz/streams/blob/main/plugins/streams/delete-hook/hook.js

@github-actions
Copy link

Confirmed: linonetwo has already signed the Contributor License Agreement (see contributing.md)

@github-actions
Copy link

github-actions bot commented Dec 26, 2025

📊 Build Size Comparison: empty.html

Branch Size
Base (master) 2451.4 KB
PR 2451.8 KB

Diff: ⬆️ Increase: +0.4 KB


⚠️ Change Note Status

This PR appears to contain code changes but doesn't include a change note.

Please add a change note by creating a .tid file in editions/tw5.com/tiddlers/releasenotes/<version>/

📚 Documentation: Release Notes and Changes

💡 Note: If this is a documentation-only change, you can ignore this message.

@netlify
Copy link

netlify bot commented Dec 26, 2025

Deploy Preview for tiddlywiki-previews ready!

Name Link
🔨 Latest commit da84d7b
🔍 Latest deploy log https://app.netlify.com/projects/tiddlywiki-previews/deploys/694e99a94837b80008e9cb36
😎 Deploy Preview https://deploy-preview-9519--tiddlywiki-previews.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@pmario
Copy link
Member

pmario commented Dec 26, 2025

@linonetwo ... Can you provide a screenshot of the dev console warning, that will be created with your PR?

@linonetwo
Copy link
Contributor Author

I think warning like this could reduce debug time, but I'm not sure console.warn like this is good enough. I can't get the plugin name here. If I'm gonna write a plugin/MOD based game, I will require adding plugin-name metadata when registering anything, so I can log them.

截屏2025-12-26 22 00 32

Might be an add-on to #6345

linonetwo added a commit to tiddly-gittly/streams-outliner-lib that referenced this pull request Dec 26, 2025
@linonetwo
Copy link
Contributor Author

linonetwo commented Dec 26, 2025

(new screenshots)
截屏2025-12-26 22 17 34
(after click on it)
截屏2025-12-26 22 17 43

Seems I can click on f to open the source, and plugin based on https://github.com/tiddly-gittly/Modern.TiddlyDev auto add file-level source-map comment to show plugin name.

But I still think, instead of console.warn, I'd like to have a VSCode style diagnoist system:

const diagnostic = new vscode.Diagnostic(
    range,
    'This is an error message from my extension',
    vscode.DiagnosticSeverity.Error // Or Warning, Information, Hint
);
const diagnostics: vscode.Diagnostic[] = [];
diagnostics.push(diagnostic);

const uri = vscode.window.activeTextEditor.document.uri; // file URI, or our tiddler title if we want it
const diagnosticCollection = vscode.languages.createDiagnosticCollection('myExtension');
diagnosticCollection.set(uri, diagnostics);

(VScode problems panel)
截屏2025-12-26 22 22 53

This will allow user to debug plugin problem inside wiki, without using devtool console.

While we still need other mechanism to get plugin-name in this case. plugin-name is only view from source code comment in devtool.
VSCode will record extension ID when evaluate extension command/message-handler registion code, and append that ID as metadata.

@Jermolene
Copy link
Member

Hi @linonetwo this is a good idea, and reasonable to merge given that the modest size of the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants