Incorrect `sendAction` Command and Quote Marks in Documentation
Bug Report: Incorrect sendAction Command and Quote Marks in Documentation
Issue:
Sketchup::ModelObserver#onTransactionUndo & #onTransactionRedo
The documentation incorrectly suggests using:
Sketchup.sendAction(“editUndo”)
Sketchup.sendAction(“editRedo”)
Issues:
sendActionis outdated; the correct method issend_action.- The action strings require a colon (
:) at the end. - The quote marks (
“ ”) are incorrect for Ruby; they should be standard double quotes (" ").
Correct Usage:
Sketchup.send_action("editUndo:")
Sketchup.send_action("editRedo:")
Steps to Reproduce:
- Run
Sketchup.sendAction(“editUndo”)– Error.
Sketchup.sendAction(“editUndo”)
Error:
#<NameError: undefined local variable or method `“editUndo”' for main:Object>
<main>:in `<main>'
SketchUp:in `eval'
=> nil
Sketchup.sendAction("editUndo:")
Error:
#<NoMethodError: undefined method `sendAction' for Sketchup:Module
Did you mean? send_action>
<main>:in `<main>'
SketchUp:in `eval
- Run
Sketchup.send_action("editUndo:")– it correctly triggers undo.
Suggested Fix:
Update the documentation to use Sketchup.send_action("editUndo:") and Sketchup.send_action("editRedo:"), ensuring correct method names, colons, and quote marks.
Aside from the documentation issues, please avoid Sketchup.sendAction if possible. It's an API we should have marked deprecated a long time ago.
Aside from the documentation issues, please avoid
Sketchup.sendActionif possible. It's an API we should have marked deprecated a long time ago.
I think since Sketchup.sendAction is not a valid method and raises a NoMethodError (checked back to SU2016), there's no need to worry about deprecating it - it simply doesn't exist.
I meant Sketchup.send_action.
Could you clarify why Sketchup.send_action should be avoided? Is it due to potential future deprecation, instability, or another reason? I'm currently using send_action for simple tool selections, like Sketchup.send_action('selectMoveTool:')
Edit: I found your comment on that https://github.com/SketchUp/api-issue-tracker/issues/542#issuecomment-704834945 . Now I get it.