Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After last VS Code update, something doesn't works fine #53

Open
ottopic opened this issue Aug 22, 2019 · 3 comments
Open

After last VS Code update, something doesn't works fine #53

ottopic opened this issue Aug 22, 2019 · 3 comments

Comments

@ottopic
Copy link

ottopic commented Aug 22, 2019

I'm using this extension from 8 months, but I think from last VS code version 1.37.1 my macro doesn't work anymore.
${CLIPBOARD} is not replaced anymore from selected text. In some case all snippet is pasted replacing all document text instead insert it after the newline.

Anyone can help me?

settings.json

`

"macros": { 
    "printr": [
        "editor.action.smartSelect.grow",
        "editor.action.clipboardCopyAction",
        "editor.action.insertLineAfter",
        {
         "command": "editor.action.insertSnippet",
            "args": {
                "name": "customprintr",
                "langId": "php",
            }
       },
       "editor.action.insertLineAfter",
       "editor.action.clipboardCopyAction",
    ]
}, 

`

snippets/php.json

`

 "customprintr": { 
	"prefix": "customprintr",
 	"body": [
		"\t",
		"\t    echo '<pre style=\"text-align:left\">';",
		"\t    \\$printMe = ${CLIPBOARD}; print_r(\\$printMe);",
		"\t    echo '</pre>';",
		"\t    die;",
		"\t",
		"\t"
 	],
 	"description": "Insert custom print_r"
},
"br": {
	"prefix": "br",
	"body": ["<br />"]
}

`

@ottopic
Copy link
Author

ottopic commented Aug 23, 2019

@geddski are you supporting this extension?
According with vs code team the problem is that now clipboard is async.

vscode.commands.executeCommand which returns a promise but that extension isn't awaiting those promises, see https://github.com/geddski/macros/blob/master/extension.js#L34. Reading from the clipboard is now async and mostly like a command is started before the previous command is done.

Probably it can be fixed add 'await' param before vscode.commands.executeCommand. https://code.visualstudio.com/api/references/commands

@oloryn
Copy link

oloryn commented Nov 21, 2019

@jeff-hykin has made a fork of this extension: macro-commander, and it's available in the marketplace. It appears to handle this problem and has been working for me in the current version of VSCode.

@jeff-hykin
Copy link

Yeah I had issues with async commands so I added an await to all of them. Although I don't have time at the moment to add more features, I do plan on actively maintaining the extension in terms of bugs and merging pull requests.

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

No branches or pull requests

3 participants