-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
126 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
.vscode/** | ||
.vscode-test/** | ||
src/** | ||
snippets | ||
.gitignore | ||
.yarnrc | ||
vsc-extension-quickstart.md | ||
**/tsconfig.json | ||
**/tsup.config.ts | ||
**/.eslintrc.json | ||
**/*.map | ||
**/*.ts | ||
**/*.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Snippets | ||
|
||
This directory contains code snippets that can be used in your projects. Each snippet is a self-contained piece of code that can be copied and pasted into your project. | ||
|
||
## Prerequisites | ||
|
||
Create a `snippets` folder in the `.demo` directory of your project. This is where you will store your snippets. | ||
|
||
> [!NOTE] | ||
> You can change name of the snippets folder, but you will need to update the `contentPath` in the snippet action. | ||
## Insert and highlight code | ||
|
||
The [insert_and_highlight.json](./insert_and_highlight.json) snippet contains a couple of steps to insert code and highlight specific lines after inserting the content. | ||
|
||
You can configure the snippet action as follows: | ||
|
||
```json | ||
{ | ||
"action": "snippet", | ||
"contentPath": "./snippets/insert_and_highlight.json", | ||
"args": { | ||
"MAIN_FILE": "<relative path from workspace to the file to update>", | ||
"CONTENT_PATH": "<relative path in .demo folder to the file with the contents to insert>", | ||
"CONTENT_POSITION": "<line number>", | ||
"HIGHLIGHT_POSITION": "<line number>:<line number>" | ||
} | ||
} | ||
``` | ||
|
||
## Show slide | ||
|
||
The [show_slide.json](./show_slide.json) snippet contains a step to show a slide within Visual Studio Code. | ||
|
||
You can configure the snippet action as follows: | ||
|
||
```json | ||
{ | ||
"action": "snippet", | ||
"contentPath": "./snippets/show_slide.json", | ||
"args": { | ||
"SLIDES_URL": "<URL to the slide>" | ||
} | ||
} | ||
``` | ||
|
||
> [!NOTE] | ||
> I'm making use of [Slidev](https://sli.dev/) to create slides and as it generates a site, I can use the URL to show the slide in Visual Studio Code. | ||
## Reset view after slide | ||
|
||
The [reset_view_after_slide.json](./reset_view_after_slide.json) snippet contains the steps to reset the view after showing a slide. | ||
|
||
You can configure the snippet action as follows: | ||
|
||
```json | ||
{ | ||
"action": "snippet", | ||
"contentPath": "./snippets/reset_view_after_slide.json" | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[ | ||
{ | ||
"action": "unselect", | ||
"path": "{MAIN_FILE}" | ||
}, | ||
{ | ||
"action": "insert", | ||
"path": "{MAIN_FILE}", | ||
"contentPath": "{CONTENT_PATH}", | ||
"position": "{CONTENT_POSITION}" | ||
}, | ||
{ | ||
"action": "waitForTimeout", | ||
"timeout": 500 | ||
}, | ||
{ | ||
"action": "highlight", | ||
"path": "{MAIN_FILE}", | ||
"position": "{HIGHLIGHT_POSITION}" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[{ | ||
"action": "setSetting", | ||
"args": { | ||
"setting": "workbench.statusBar.visible", | ||
"value": null | ||
} | ||
}, { | ||
"action": "setSetting", | ||
"args": { | ||
"setting": "workbench.activityBar.location", | ||
"value": null | ||
} | ||
}, { | ||
"action": "executeVSCodeCommand", | ||
"command": "workbench.action.toggleSidebarVisibility" | ||
}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
[{ | ||
"action": "executeVSCodeCommand", | ||
"command": "workbench.action.closeSidebar" | ||
}, { | ||
"action": "executeVSCodeCommand", | ||
"command": "workbench.action.closePanel" | ||
}, { | ||
"action": "setSetting", | ||
"args": { | ||
"setting": "workbench.statusBar.visible", | ||
"value": false | ||
} | ||
}, { | ||
"action": "setSetting", | ||
"args": { | ||
"setting": "workbench.activityBar.location", | ||
"value": "hidden" | ||
} | ||
}, { | ||
"action": "executeVSCodeCommand", | ||
"command": "simpleBrowser.show", | ||
"args": "{SLIDES_URL}" | ||
}] |