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

Passing a string to actions.find #39

Open
amandatennent opened this issue Jul 19, 2018 · 3 comments
Open

Passing a string to actions.find #39

amandatennent opened this issue Jul 19, 2018 · 3 comments

Comments

@amandatennent
Copy link

I'm trying to create a macro that will find a certain string (a regex string that I use a lot), that will then replace it with another regex string. I have set it up, but instead of the find string being placed in the find box, it's being placed in the text editor. Is there another argument I should be using instead of text?

	"macros": {
		"addSpacesAfterCommas" : [
			"actions.find",
				{"command": "type", "args": {"text": "search string here"}}
		]
	}
@rsxdalv
Copy link

rsxdalv commented Oct 26, 2018

This is caused by delay in the editor, to verify it you can add a bunch of write commands (and you'll see that they eventually write in the find window)

Solution: #13

@MythicLionMan
Copy link

Just in case anyone else lands here, the solution I landed on was:

    "macros": {
        "upgradeFMODEvent": [
            {"command": "editor.actions.findWithArgs", "args": {"searchString": "[FMODUnity.EventRef]"} },
            "editor.action.nextMatchFindAction",
         ]
    }

@linyu003
Copy link

linyu003 commented Sep 29, 2023

Just in case anyone else lands here, the solution I landed on was:

    "macros": {
        "upgradeFMODEvent": [
            {"command": "editor.actions.findWithArgs", "args": {"searchString": "[FMODUnity.EventRef]"} },
            "editor.action.nextMatchFindAction",
         ]
    }

That helps a lot. Thank you.
And I give another example for anyone who lands here.

        "json2-": [
            {
                "command": "editor.actions.findWithArgs",
                "args": {
                    "searchString": "^ *('|\")(.+?)('|\") *: *('|\")(.+?)('|\"),? *$",
                    "replaceString": "-$2=$5",
                    "isRegex": true
                }
            },
            "editor.action.replaceAll"
        ]

To know the full args of editor.actions.findWithArgs, refer this

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

4 participants