Skip to content

Features

Insert console.log

Select a variable or expression and press Ctrl+Alt+L. The extension parses the file's AST and inserts console.log at the most suitable position.

Placement Rules

ScenarioInsertion point
Variable in a declarationAfter the declaration statement
Variable in a return statementBefore the return
Function parameterFirst line of the function body
Empty block {}Expanded to multiline, log placed inside
Single-expression arrow functionBody wrapped with {}, return value preserved
Unparseable codeFallback to the line below the selection

Multi-Cursor Batch Insertion

Hold Alt and click to create multiple cursors, select several variables, then press Ctrl+Alt+L. All logs are inserted in a single atomic edit — one Ctrl+Z undoes everything.

Template Files

For Vue, HTML, Svelte and Astro files, the <script> block containing the selection is extracted and parsed; the rest of the file is untouched.

Snippet Cursor Control

When the template contains snippet syntax ($1, ${1:placeholder}, $0), the cursor lands at the specified position after insertion, and Tab cycles through the stops.

json
"hiasConsoleLog.template": "${value}$1, `${name}`$0"

Delete console.log

Press Ctrl+Alt+D to delete every line matching the current template format, with a count notification.

Comment console.log

Press Ctrl+Alt+C to prefix all matched console.log lines with // . Your cursor and selections are preserved.

Uncomment console.log

Press Ctrl+Alt+U to remove comment markers, supporting both forms:

js
// console.log(obj, `obj`)     ← line comment
/* console.log(obj, `obj`) */  ← block comment

Clipboard Extraction

With hiasConsoleLog.copyToClipboard enabled and hiasConsoleLog.clipboardPattern configured, content extracted by the pattern is copied to the clipboard on insertion.

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 — handy for global-searching your logs later.

TIP

The ${line} variable extracts the full statement, e.g. console.log(params, \log_params`)`.

Matching Rules

Delete / comment / uncomment build their matching regex from the current hiasConsoleLog.template, so only logs generated by this extension are affected — hand-written logs are left alone. After changing the template, logs generated with the old format are no longer matched.

Released under the MIT License.