Skip to content

Add _MACRO_MSG support: converter, creator panel, preview#1

Open
AstrandPallas wants to merge 2 commits intomainfrom
macro-msg-features
Open

Add _MACRO_MSG support: converter, creator panel, preview#1
AstrandPallas wants to merge 2 commits intomainfrom
macro-msg-features

Conversation

@AstrandPallas
Copy link
Collaborator

Summary

  • talkMsgConverter.ts: Right-click context menu command to convert _TALKMSG/_TALK_KEYWAIT/_EASY_OBJ_MSG/_EASY_BOARD_MSG lines to _MACRO_MSG(...) macros. Looks up message text via DataManager and embeds it inline with proper escape sequences (\n, \r, \f). Handles ASCII apostrophe → smart quote conversion for ANTLR grammar compatibility.
  • TalkMsgCreatorPanel.ts: Webview panel for composing new _MACRO_MSG calls with dropdowns for message type and bundle file, text input with live preview, and insert-at-cursor / copy-to-clipboard actions.
  • extension.ts: Updated message preview regex to recognize _MACRO_MSG('TYPE', 'bundle', 'label', 'text') lines (including with trailing args). Registered both new commands.
  • package.json: Added relumistudio.convertToMacro and relumistudio.openMsgCreator commands with editor context menu entries.

Test plan

  • Open a .ev file with a _TALKMSG('file%label') line, right-click → "Convert to Macro" — verify it produces correct _MACRO_MSG(...) with message text
  • Open Message Creator panel, fill in fields, click Insert — verify macro inserted at cursor
  • Place cursor on a _MACRO_MSG(...) line — verify message preview panel shows the inline text
  • Verify existing _TALKMSG preview still works

- talkMsgConverter.ts: Right-click "Convert to _MACRO_MSG" command
  that converts _TALKMSG/etc lines to _MACRO_MSG() with looked-up text
- TalkMsgCreatorPanel.ts: Webview panel for composing new _MACRO_MSG
  calls with type/bundle/label/text inputs and live preview
- extension.ts: Register new commands + add _MACRO_MSG preview regex
- package.json: Add commands and editor context menu entries
- Add Content Security Policy with nonce to TalkMsgCreatorPanel webview
- Add localResourceRoots restriction
- Fix apostrophe → smart quote conversion in buildMacro() (ANTLR grammar compat)
- Await editor.edit() in _insertAtCursor
- Await convertToMacro in command registration
- Remove unused DataManager import
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.

1 participant