Skip to content

[DOCS] Configuring VSCode shortcuts to publish actions and sources #4478

Open
@alysonturing

Description

@alysonturing

Context:
Possibility to include docs with information of how to configure VSCode shortcuts (and possibly other editors) to easier the publishing of sources and actions built with javascript and typescript.

Additionally, somebody with windows environment could work on a version of the snippet for windows.

The following steps shows how it can be configured:

  • Installed on VSCODE the extension: terminal-command-keys
  • Using cmd+shift+p look for Open keyboard shortcuts (JSON)
  • Replace your shortcut’s array with the array on the snippet below (or copy its inner items to the current array)
  • You will be able to publish your actions and sources (currently focused file) by pressing cmd+r

Snippet for MAC

[
  {
    "key": "cmd+r",
    "command": "terminalCommandKeys.run",
    "args": {
      "cmd": "/usr/bin/env cd ${fileWorkspaceFolder} && pd publish ${relativeFile}",
      "match": ".*"
    },
    "when": "resourcePath =~ /actions/ && resourceLangId == javascript"
  },
  {
    "key": "cmd+r",
    "command": "terminalCommandKeys.run",
    "args": {
      "cmd": "/usr/bin/env cd ${fileWorkspaceFolder} && pd dev ${relativeFile}",
      "match": ".*"
    },
    "when": "resourcePath =~ /sources/ && resourceLangId == javascript"
  },
  {
    "key": "cmd+r",
    "command": "terminalCommandKeys.run",
    "args": {
      "cmd": "/usr/bin/env cd ${fileWorkspaceFolder} && npm run build && currentFile=${relativeFile} && compiledFile=${${currentFile//\\/actions\\//\/dist\\/actions\\/}//.ts/.mjs} && while [ ! -f $compiledFile ]; do sleep 1; done && pd publish $compiledFile",
      "match": ".*"
    },
    "when": "resourcePath =~ /actions/ && resourceLangId == typescript"
  },
  {
    "key": "cmd+r",
    "command": "terminalCommandKeys.run",
    "args": {
      "cmd": "/usr/bin/env cd ${fileWorkspaceFolder} && npm run build && currentFile=${relativeFile} && compiledFile=${${currentFile//\\/sources\\//\/dist\\/sources\\/}//.ts/.mjs} && while [ ! -f $compiledFile ]; do sleep 1; done && pd dev $compiledFile",
      "match": ".*"
    },
    "when": "resourcePath =~ /sources/ && resourceLangId == typescript"
  },
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    actions-and-sources-docsFor maintainers: Add this label to send an automated message about action AND source developmentdocsenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions