Skip to content

Commit 89b05ea

Browse files
authored
feat: add console context snippets
1 parent 201cb32 commit 89b05ea

File tree

5 files changed

+678
-307
lines changed

5 files changed

+678
-307
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@ Fixed for any bug fixes.
99
Security to invite users to upgrade in case of vulnerabilities.
1010
-->
1111

12+
## 1.7.0 - 2025/03/01
13+
14+
### Added
15+
16+
- Console context snippets support
17+
18+
### Changed
19+
20+
- bump vitest version
21+
1222
## 1.6.0 - 2024/11/16
1323

1424
### Changed

README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ The quick and easy way to debug your code and styles with [VS Code](https://code
2121
- [Supported Languages](#supported-languages)
2222
- [Snippets](#snippets)
2323
- [Code](#code)
24+
- [Context](#context)
25+
- [React](#react)
2426
- [Styles](#styles)
2527
- [Keyboard](#keyboard)
2628
- [Settings](#settings)
@@ -113,6 +115,60 @@ Below is a list of all available snippets and the triggers of each one. The `░
113115
| `cgw→` | group wrapper | <code>console.group(░label)<br/>█<br/>console.groupEnd(░label)</code> |
114116
| `clr→` | [clear](https://developer.mozilla.org/en-US/docs/Web/API/Console/clear) | `console.clear()█` |
115117

118+
### Context
119+
120+
> [!WARNING]
121+
> experimental feature available only in Chromium-based browsers (Chrome and Edge).
122+
123+
| Trigger | Description | Result JS/TS |
124+
| ------: | ------------------------------- | ------------------------------------------------------------- |
125+
| `cx→` | context | `const ░context = console.context(░label)█` |
126+
127+
The `console.context()` API provides a convenient mechanism for filtering log messages, thereby helping to mitigate the issue of logs from other scripts or packages obscuring relevant information.
128+
129+
| Trigger | Description | Result JS/TS |
130+
| -------: | ------------------------------ | ---------------------------------------------------------------------- |
131+
| `cxl→` | log | `░context.log(░name)█` |
132+
| `cxlm→` | log with message | `░context.log('░name:', ░name)█` |
133+
| `cxld→` | log with destructuring | `░context.log({░name})█` |
134+
| `cxlj→` | log with json | `░context.log('░obj:', JSON.stringify(░obj, null, 2))█` |
135+
| `cxd→` | debug | `░context.debug(░name)█` |
136+
| `cxdm→` | debug with message | `░context.debug('░name:', ░name)█` |
137+
| `cxdd→` | debug with destructuring | `░context.debug({░name})█` |
138+
| `cxdj→` | debug with json | `░context.debug('░obj:', JSON.stringify(░obj, null, 2))█` |
139+
| `cxi→` | info | `░context.info(░name)█` |
140+
| `cxim→` | info with message | `░context.info('░name:', ░name)█` |
141+
| `cxid→` | info with destructuring | `░context.info({░name})` |
142+
| `cxij→` | info with json | `░context.info('░obj:', JSON.stringify(░obj, null, 2))█` |
143+
| `cxe→` | error | `░context.error(░name)█` |
144+
| `cxem→` | error with message | `░context.error('░name:', ░name)█` |
145+
| `cxed→` | error with destructuring | `░context.error({░name})█` |
146+
| `cxej→` | info with json | `░context.error('░obj:', JSON.stringify(░obj, null, 2))█` |
147+
| `cxw→` | warn | `░context.warn(░name)█` |
148+
| `cxwm→` | warn with message | `░context.warn('░name:', ░name)█` |
149+
| `cxwd→` | warn with destructuring | `░context.warn({░name}█)` |
150+
| `cxwj→` | info with json | `░context.warn('░obj:', JSON.stringify(░obj, null, 2))█` |
151+
| `cxt→` | table | `░context.table(░collection)█` |
152+
| `cxtd→` | table with destructuring | `░context.table({░name})█` |
153+
| `cxa→` | assert | `░context.assert(░expression, ░name)█` |
154+
| `cxdr→` | dir | `░context.dir(░name)█` |
155+
| `cxtr→` | trace | `░context.trace(░name)█` |
156+
| `cxc→` | count | `░context.count(░label)█` |
157+
| `cxcr→` | count reset | `░context.countReset(░label)█` |
158+
| `cxps→` | profile start | `░context.profile()█` |
159+
| `cxpe→` | profile end | `░context.profileEnd()█` |
160+
| `cxpw→` | profile wrapper | <code>░context.profile()<br/>█<br/>░context.profileEnd()</code> |
161+
| `cxts→` | time start | `░context.time(░label)█` |
162+
| `cxtl→` | time log | `░context.timeLog(░label)█` |
163+
| `cxte→` | time end | `░context.timeEnd(░label)█` |
164+
| `cxtw→` | time wrapper | <code>░context.time(░label)<br/>█<br/>░context.timeEnd(░label)</code> |
165+
| `cxgs→` | group start | `░context.group(░label)█` |
166+
| `cxge→` | group end | `░context.groupEnd(░label)█` |
167+
| `cxgw→` | group wrapper | <code>░context.group(░label)<br/>█<br/>░context.groupEnd(░label)</code> |
168+
| `cxlr→` | clear | `░context.clear()█` |
169+
170+
In the Developer Tools console of your browser, you can filter logs by typing `context:<label>`. This allows you to view only the logs associated with the specified label.
171+
116172
### React
117173

118174
| Trigger | Description | Result JSX/TSX |

0 commit comments

Comments
 (0)