Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support bats files #238

Merged
merged 4 commits into from
Nov 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .azure-pipelines/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ trigger:
# no `pr` keyword because we want all PRs to run this

pool:
vmImage: ubuntu-16.04
vmImage: ubuntu-latest

steps:
# for convenience, we tag CI-produced packages with a version number
Expand Down
2 changes: 1 addition & 1 deletion .azure-pipelines/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
displayName: 'Run tests'
- job: Linux
pool:
name: Hosted Ubuntu 1604
name: Hosted Ubuntu latest
demands: npm
steps:
- task: NodeTool@0
Expand Down
2 changes: 1 addition & 1 deletion .azure-pipelines/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ trigger: none
pr: none

pool:
vmImage: ubuntu-16.04
vmImage: ubuntu-latest

steps:
# release version should be correctly set in package.json
Expand Down
2 changes: 1 addition & 1 deletion .azure-pipelines/release-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ trigger: none
pr: none

pool:
vmImage: ubuntu-16.04
vmImage: ubuntu-latest

steps:
# release version should be correctly set in package.json
Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@

Check [Keep a Changelog](https://keepachangelog.com/) for recommendations on how to structure this file.

## 7.2.0

- bats files support

## 7.1.1

- bump shfmt to 3.3.1

## 7.1.0

- bump shfmt to 3.2.4
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


[Get it on the VS Code Marketplace!](https://marketplace.visualstudio.com/items?itemName=foxundermoon.shell-format)

# supported file types or languages
Expand All @@ -12,6 +10,7 @@
| properties | .properties | java properties files |
| jvmoptions | .vmoptions , jvm.options | jvm options file |
| hosts | /etc/hosts | hosts file |
| bats | .bats | Bats test file |

---

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 11 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "shell-format",
"displayName": "shell-format",
"description": "shellscript、Dockerfile、properties、gitignore、dotenv、hosts、jvmoptions... DocumentFormat",
"version": "7.1.1",
"version": "7.2.0",
"publisher": "foxundermoon",
"engines": {
"vscode": "^1.30.0"
Expand All @@ -19,7 +19,8 @@
"onLanguage:jvmoptions",
"onLanguage:properties",
"onLanguage:spring-boot-properties",
"onLanguage:azcli"
"onLanguage:azcli",
"onLanguage:bats"
],
"main": "./dist/extension",
"capabilities": {
Expand Down Expand Up @@ -137,6 +138,12 @@
"extensions": [
".azcli"
]
},
{
"id": "bats",
"extensions": [
".bats"
]
}
],
"configuration": {
Expand Down Expand Up @@ -171,7 +178,8 @@
"gitignore",
"properties",
"spring-boot-properties",
"azcli"
"azcli",
"bats"
],
"description": "the trigger effect on the language"
},
Expand Down
2 changes: 1 addition & 1 deletion renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"lockFileMaintenance": {
"enabled": true,
"automerge": true
}
}
}
8 changes: 6 additions & 2 deletions src/shFormat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ export class Formatter {

let shfmtFlags = []; // TODO: Add user configuration
let shfmtIndent = false;
if (/\.bats$/.test(document.fileName)) {
shfmtFlags.push('--ln=bats');
}

if (binPath) {
if (fileExists(binPath)) {
Expand Down Expand Up @@ -388,8 +391,9 @@ function isExecutedFmtCommand(): Boolean {
export function getSettings(key: string) {
let settings = vscode.workspace.getConfiguration(configurationPrefix);
if (key === 'path' && settings[key]) {
let workspaceFolder = vscode.workspace.workspaceFolders && vscode.workspace.workspaceFolders[0].uri.fsPath;
return settings[key].replace(/\${workspaceFolder}/g, workspaceFolder || "");
let workspaceFolder =
vscode.workspace.workspaceFolders && vscode.workspace.workspaceFolders[0].uri.fsPath;
return settings[key].replace(/\${workspaceFolder}/g, workspaceFolder || '');
}
return key !== undefined ? settings[key] : null;
}
Loading