Skip to content

Commit

Permalink
Update black formatter extension to latest extension template. (micro…
Browse files Browse the repository at this point in the history
…soft#108)

* Update github actions

* Update launch.json

* Update build yml

* Update python code.

* Update packages.

* Add language translation to webpack.

* rename bundled path to tool.

* Update nox build support functions

* Update packages.

* Restore flake8 linting

* Update typescript code

* Update python test code.

* Fix multi python tests.

* Fix tests.

* Update package json

* Update readme

* Clean up logging.
  • Loading branch information
karthiknadig authored Aug 3, 2022
1 parent cf05523 commit d95c51d
Show file tree
Hide file tree
Showing 36 changed files with 2,818 additions and 979 deletions.
7 changes: 3 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,22 @@ updates:
schedule:
interval: monthly
labels:
- 'skip news'
- 'no-changelog'
- 'debt'

- package-ecosystem: 'pip'
directory: /src/test/python_tests
schedule:
interval: daily
labels:
- 'skip news'
- 'no-changelog'
- 'debt'

- package-ecosystem: 'pip'
directory: /
schedule:
interval: daily
labels:
- 'news'
- 'debt'
commit-message:
include: 'scope'
Expand All @@ -32,7 +31,7 @@ updates:
schedule:
interval: monthly
labels:
- 'skip news'
- 'no-changelog'
- 'debt'
ignore:
- dependency-name: '@types/vscode'
Expand Down
13 changes: 5 additions & 8 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
changelog:
exclude:
labels:
- 'skip news'
- 'no-changelog'

categories:
- title: Bug Fixes
labels:
- 'bug'
- 'news'

- title: Enhancements
labels:
- 'feature-request'
- 'news'

- title: Bug Fixes
labels:
- 'bug'

- title: Code Health
labels:
- 'debt'
- 'news'
5 changes: 3 additions & 2 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ env:
# Force a path with spaces and unicode chars to test extension works in these scenarios
special-working-directory: './🐍 🐛'
special-working-directory-relative: '🐍 🐛'
DISABLE_TRANSLATIONS: true

jobs:
build-vsix:
Expand Down Expand Up @@ -55,7 +56,7 @@ jobs:

# Install bundled libs using 3.7 even though you test it on other versions.
- name: Use Python 3.7
uses: actions/setup-python@v4.0.0
uses: actions/setup-python@v4
with:
python-version: '3.7'

Expand All @@ -71,7 +72,7 @@ jobs:
# Now that the bundle is installed to target using python 3.7
# switch back the python we want to test with
- name: Use Python ${{ matrix.python }}
uses: actions/setup-python@v4.0.0
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

Expand Down
43 changes: 12 additions & 31 deletions .github/workflows/pr-labels.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,21 @@
name: PR labels

name: 'PR labels'
on:
pull_request:
types: ['opened', 'reopened', 'synchronize', 'labeled', 'unlabeled']

permissions:
pull-requests: write
types:
- 'opened'
- 'reopened'
- 'labeled'
- 'unlabeled'
- 'synchronize'

jobs:
# From https://github.com/marketplace/actions/github-script#apply-a-label-to-an-issue.
add-pr-label:
name: 'Ensure Required Labels'
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
- name: 'PR impact specified'
uses: mheap/github-action-required-labels@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const result = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
})
const labels = result.data.labels.map((label) => label.name)
const hasNewsLabels = labels.some((label) => label === 'news' || label === 'skip news' )
if (hasNewsLabels) {
console.log('This PR has the required "news" or "skip news" labels.')
} else {
core.setFailed('Please add "news" or "skip news" labels to the PR.')
}
const hasLabels = labels.some((label) => label === 'bug' || label === 'feature-request' || label === 'debt' )
if (hasLabels) {
console.log('This PR has the required "bug", "feature-request" or "debt" labels.')
} else {
core.setFailed('Please add "bug", "feature-request" or "debt" labels to the PR.')
}
mode: exactly
count: 1
labels: 'bug, debt, feature-request, no-changelog'
4 changes: 2 additions & 2 deletions .github/workflows/push-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:

# Install bundled libs using 3.7 even though you test it on other versions.
- name: Use Python 3.7
uses: actions/setup-python@v4.0.0
uses: actions/setup-python@v4
with:
python-version: '3.7'

Expand All @@ -76,7 +76,7 @@ jobs:
# Now that the bundle is installed to target using python 3.7
# switch back the python we want to test with
- name: Use Python ${{ matrix.python }}
uses: actions/setup-python@v4.0.0
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

Expand Down
71 changes: 67 additions & 4 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,82 @@
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"name": "Debug Extension Only",
"type": "extensionHost",
"request": "launch",
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
"preLaunchTask": "${defaultBuildTask}"
"preLaunchTask": "npm: watch",
"presentation": {
"hidden": false,
"group": "",
"order": 2
}
},
{
"name": "Python: Attach using Process Id",
"name": "Python Attach",
"type": "python",
"request": "attach",
"processId": "${command:pickProcess}",
"justMyCode": false
"justMyCode": false,
"presentation": {
"hidden": false,
"group": "",
"order": 3
}
},
{
"name": "Python Config for test explorer (hidden)",
"type": "python",
"request": "launch",
"console": "integratedTerminal",
"purpose": ["debug-test"],
"justMyCode": true,
"presentation": {
"hidden": true,
"group": "",
"order": 4
}
},
{
"name": "Debug Extension (hidden)",
"type": "extensionHost",
"request": "launch",
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
"env": {
"USE_DEBUGPY": "True"
},
"presentation": {
"hidden": true,
"group": "",
"order": 4
}
},
{
"name": "Python debug server (hidden)",
"type": "python",
"request": "attach",
"listen": { "host": "localhost", "port": 5678 },
"justMyCode": true,
"presentation": {
"hidden": true,
"group": "",
"order": 4
}
}
],
"compounds": [
{
"name": "Debug Extension and Python",
"configurations": ["Python debug server (hidden)", "Debug Extension (hidden)"],
"stopAll": true,
"preLaunchTask": "npm: watch",
"presentation": {
"hidden": false,
"group": "",
"order": 1
}
}
]
}
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,14 @@ If you want to disable Black formatter, you can [disable this extension](https:/

## Settings

| Settings | Default | Description |
| --------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| black-formatter.args | `[]` | Custom arguments passed to `black`. E.g `"black-formatter.args" = ["--config", "<file>"]` |
| black-formatter.trace | `error` | Sets the tracing level for the extension. |
| black-formatter.path | `[]` | Setting to provide custom `black` executable. This will slow down formatting, since we will have to run `black` executable every time or file save or open. Example 1: `["~/global_env/black"]` Example 2: `["conda", "run", "-n", "lint_env", "python", "-m", "black"]` |
| Settings | Default | Description |
| -------------------------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| black-formatter.args | `[]` | Custom arguments passed to `black`. E.g `"black-formatter.args" = ["--config", "<file>"]` |
| black-formatter.trace | `error` | Sets the tracing level for the extension. |
| black-formatter.path | `[]` | Setting to provide custom `black` executable. This will slow down formatting, since we will have to run `black` executable every time or file save or open. Example 1: `["~/global_env/black"]` Example 2: `["conda", "run", "-n", "lint_env", "python", "-m", "black"]` |
| black-formatter.interpreter | `[]` | Path to a python interpreter to use to run the linter server. |
| black-formatter.importStrategy | `useBundled` | Setting to choose where to load `black` from. `useBundled` picks black bundled with the extension. `fromEnvironment` uses `black` available in the environment. |
| black-formatter.showNotification | `off` | Setting to control when a notification is shown. |

## Commands

Expand Down
2 changes: 2 additions & 0 deletions build/azure-pipeline.pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ resources:
extends:
template: azure-pipelines/extension/pre-release.yml@templates
parameters:
locTsConfigs: $(Build.SourcesDirectory)/tsconfig.json
locBundleDestination: $(Build.SourcesDirectory)/dist
buildSteps:
- task: NodeTool@0
inputs:
Expand Down
2 changes: 2 additions & 0 deletions build/azure-pipeline.stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ parameters:
extends:
template: azure-pipelines/extension/stable.yml@templates
parameters:
locTsConfigs: $(Build.SourcesDirectory)/tsconfig.json
locBundleDestination: $(Build.SourcesDirectory)/dist
publishExtension: ${{ parameters.publishExtension }}
buildSteps:
- task: NodeTool@0
Expand Down
Loading

0 comments on commit d95c51d

Please sign in to comment.