Skip to content

Configuration

Search for hiasConsoleLog in VSCode settings, or edit settings.json directly:

json
{
  // Enable the extension
  "hiasConsoleLog.enable": true,

  // console.log argument template
  "hiasConsoleLog.template": "${value}, `${name}`",

  // Copy extracted content to clipboard after insertion
  "hiasConsoleLog.copyToClipboard": false,

  // Clipboard extraction pattern
  "hiasConsoleLog.clipboardPattern": ""
}

hiasConsoleLog.enable

  • Type: boolean
  • Default: true

Master switch. When disabled, all commands are no-ops.

hiasConsoleLog.template

  • Type: string
  • Default: ${value}, \${name}``

The console.log argument template that shapes the inserted statement.

Variables

VariableDescription
${value}The selected text
${name}The original text (used as a label)
${name:prefix,suffix}Original text with prefix/suffix, e.g. ${name:log_,}log_obj

Snippet Syntax

VSCode snippet syntax controls the cursor after insertion:

SyntaxDescription
$1, $2Tab stops, visited in order
${1:placeholder}Tab stop with placeholder text
$0Final cursor position

TIP

A trailing $0 is automatically moved after the closing ), so the cursor ends up at the end of the statement instead of inside the parentheses.

Examples

TemplateResult (selecting obj)
${value}, \${name}``console.log(obj, \obj`)`
'>>> ${name}', ${value}console.log('>>> obj', obj)
${value}, \${name:log_,}``console.log(obj, \log_obj`)`
${value}$1, \${name}`$0`Same as default, cursor stops at $1

hiasConsoleLog.copyToClipboard

  • Type: boolean
  • Default: false

Whether to extract content via clipboardPattern and copy it to the clipboard after insertion.

hiasConsoleLog.clipboardPattern

  • Type: string
  • Default: "" (no copy)

Clipboard extraction pattern. Uses the same variable syntax as template, plus:

VariableDescription
${line}The full console.log statement

Example

json
"hiasConsoleLog.enable": true,
"hiasConsoleLog.template": "${value}$1, `${name:log_,}`$0",
"hiasConsoleLog.copyToClipboard": true,
"hiasConsoleLog.clipboardPattern": "${name:log_,}"

Selecting params copies log_params to the clipboard.

Released under the MIT License.