Skip to content

Commit

Permalink
feat: Add snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
hverlin committed Nov 13, 2024
1 parent ff9f267 commit 68e186a
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ If you want to add one, you can open a PR that updates [src/utils/supportedExten
### Environment Variables
- 🌍 View [mise environment variables](https://mise.jdx.dev/environments.html)

### Snippets
- 📝 Snippets to create tasks in `mise.toml` and task files

## 🚀 Getting Started

1. Install the extension from [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=hverlin.mise-vscode#overview) or [Open VSX](https://open-vsx.org/extension/hverlin/mise-vscode)
Expand Down
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@
"icon": "resources/icon.png",
"main": "./dist/extension.js",
"contributes": {
"snippets": [
{
"language": "toml",
"path": "./snippets/toml-tasks-snippets.json"
},
{
"language": "shellscript",
"path": "./snippets/file-tasks-snippets.json"
}
],
"configuration": {
"title": "Mise",
"properties": {
Expand Down
15 changes: 15 additions & 0 deletions snippets/file-tasks-snippets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"mise File Task Configuration": {
"prefix": "mise-task",
"scope": "shellscript",
"description": "Insert a file task configuration block",
"body": [
"#MISE alias=\"${1:taskname}\"",
"#MISE sources=[${2:\"src/**/*\"}]",
"#MISE outputs=[${3:\"target/output\"}]",
"#MISE env={${4:VARIABLE = \"value\"}}",
"#MISE depends=[${5:\"dependency\"}]",
"$0"
]
}
}
61 changes: 61 additions & 0 deletions snippets/toml-tasks-snippets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"tomlTask": {
"prefix": "task",
"description": "Create a new mise task with common options",
"body": [
"[tasks.${1:taskname}]",
"${2:description = '${3:Task description}'\n}${4:depends = [${5:'dependency'}]\n}run = \"echo 'running...'\"",
"$0"
]
},
"tomlTaskArray": {
"prefix": "taska",
"description": "Create a mise task with multiple commands",
"body": [
"[tasks.${1:taskname}]",
"${2:description = '${3:Task description}'\n}${4:depends = [${5:'dependency'}]\n}run = [",
" \"echo 'running step 1...'\",",
" \"echo 'running step 2...'\"",
"]",
"$0"
]
},
"tomlTaskSimple": {
"prefix": "tasks",
"description": "Create a simple mise task",
"body": ["[tasks.${1:taskname}]", "run = \"echo 'running...'\"", "$0"]
},
"tomlTaskScript": {
"prefix": "taskscript",
"description": "Create a mise task with multiline script",
"body": [
"[tasks.${1:taskname}]",
"${2:description = '${3:Task description}'\n}run = \"\"\"",
"#!/usr/bin/env ${4|bash,sh,python|}",
"${5:# your script here}",
"\"\"\"",
"$0"
]
},
"tomlTaskFull": {
"prefix": "taskfull",
"description": "Create a mise task with all possible options",
"body": [
"[tasks.${1:taskname}]",
"description = '${2:Task description}'",
"depends = [${3:'dependency'}]",
"alias = '${4:shortname}'",
"dir = '${5:{{cwd}}}'",
"env = {${6:KEY = 'value'}}",
"hide = ${7|true,false|}",
"sources = [${8:'src/**/*'}]",
"outputs = [${9:'dist/**/*'}]",
"shell = '${10:bash -c}'",
"run = [",
" \"echo 'running step 1...'\",",
" \"echo 'running step 2...'\"",
"]",
"$0"
]
}
}

0 comments on commit 68e186a

Please sign in to comment.