Compare commits
94 Commits
Author | SHA1 | Date |
---|---|---|
|
29879c9c50 | |
|
f8ac9fdddd | |
|
83879f19b9 | |
|
3807dd4c7c | |
|
dcf0138dc6 | |
|
3a40496053 | |
|
bc3c31fde7 | |
|
a4e868e155 | |
|
9df84f7b03 | |
|
bd38964ec7 | |
|
45f4d187f9 | |
|
4f8ae8fd28 | |
|
b26d0fe557 | |
|
86fcb138e6 | |
|
dbb3458abb | |
|
7af4c38280 | |
|
a407622bea | |
|
9bd430f7c0 | |
|
797a8f926d | |
|
d3e079abc8 | |
|
f2c1806ecc | |
|
85d0539168 | |
|
721397fbe5 | |
|
6416e0636f | |
|
f706ab6c81 | |
|
8798824062 | |
|
ea0558a0ac | |
|
4b9c2bc1d0 | |
|
11a263a39f | |
|
561bd5f840 | |
|
43dac4fd47 | |
|
ea92a6881c | |
|
dc8b84db1b | |
|
15876b52b2 | |
|
c4cfe02e4a | |
|
167393ca86 | |
|
fa188d92c4 | |
|
2761b8147e | |
|
9eaaffae76 | |
|
5188ae6c0c | |
|
e0f65c2376 | |
|
0c6387ade9 | |
|
95c4a2e3e0 | |
|
2e01d11b55 | |
|
7e5f2a45f8 | |
|
759d882c40 | |
|
6118cb6eb2 | |
|
275616e6d6 | |
|
8a7094b572 | |
|
ee0788177a | |
|
84a3ef00f2 | |
|
bbfa2dea94 | |
|
3e50b9cbd6 | |
|
0739575d19 | |
|
94c69474ab | |
|
ce588474d9 | |
|
0bbe953f47 | |
|
6d0e077664 | |
|
eac9132746 | |
|
03b4c60805 | |
|
eec0881fc1 | |
|
f50b223a71 | |
|
e8602cd013 | |
|
3882127f14 | |
|
58fb211eaa | |
|
3642590829 | |
|
aa16d41420 | |
|
12c5f1378d | |
|
cd0c0f80d0 | |
|
f260de99d5 | |
|
3940e1f16f | |
|
167429b3a7 | |
|
b59e0bb244 | |
|
156b73cd35 | |
|
5373b209e3 | |
|
9190b7050f | |
|
ccbb16f8ac | |
|
afecbb70a5 | |
|
74dfa1ebe3 | |
|
18a38c7999 | |
|
bb084fb172 | |
|
4801c12a0d | |
|
d8f51b4fcd | |
|
362f7ab148 | |
|
b0b9b63a2b | |
|
6a88caada4 | |
|
bd76d5da33 | |
|
1ad4c5eed5 | |
|
853f7fdf00 | |
|
d7ec76e87d | |
|
6de9f8eb1b | |
|
578633f12f | |
|
e81023eaa7 | |
|
7611383486 |
|
@ -1,16 +1,22 @@
|
|||
name: Build
|
||||
run-name: "Build: ${{ github.event_name != 'workflow_dispatch' && 'Automatic' || 'Release' }}"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "**"
|
||||
- '**'
|
||||
tags:
|
||||
- v*
|
||||
paths-ignore:
|
||||
- '**/*.md'
|
||||
pull_request:
|
||||
branches:
|
||||
- '**'
|
||||
paths-ignore:
|
||||
- '**/*.md'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
|
||||
test-latest:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
|
@ -29,11 +35,11 @@ jobs:
|
|||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "22.x"
|
||||
node-version: '22.x'
|
||||
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: "1.23.8"
|
||||
go-version: '1.23.8'
|
||||
|
||||
- run: npm install
|
||||
working-directory: vscode-extension
|
||||
|
@ -52,6 +58,12 @@ jobs:
|
|||
- run: xvfb-run --auto-servernum --server-args='-screen 0 1920x1080x24' npm test
|
||||
working-directory: vscode-extension
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: failure()
|
||||
with:
|
||||
name: screenshots
|
||||
path: /tmp/test-resources/screenshots/
|
||||
|
||||
test-release:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
|
@ -60,7 +72,7 @@ jobs:
|
|||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "22.x"
|
||||
node-version: '22.x'
|
||||
|
||||
- run: npm install
|
||||
|
||||
|
@ -68,7 +80,14 @@ jobs:
|
|||
|
||||
- run: xvfb-run --auto-servernum --server-args='-screen 0 1920x1080x24' npm test
|
||||
|
||||
build:
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: failure()
|
||||
with:
|
||||
name: screenshots
|
||||
path: /tmp/test-resources/screenshots/
|
||||
|
||||
upload:
|
||||
if: github.event_name != 'workflow_dispatch'
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- test-latest
|
||||
|
@ -77,42 +96,33 @@ jobs:
|
|||
strategy:
|
||||
matrix:
|
||||
os: [alpine, linux, win32, darwin]
|
||||
arch: [amd64, arm64]
|
||||
nodearch: [x64, arm64]
|
||||
include:
|
||||
- arch: amd64
|
||||
nodearch: x64
|
||||
- arch: arm64
|
||||
nodearch: arm64
|
||||
- os: win32
|
||||
nodeos: win32
|
||||
ext: .exe
|
||||
- os: darwin
|
||||
nodeos: darwin
|
||||
ext: ""
|
||||
ext: ''
|
||||
- os: linux
|
||||
nodeos: linux
|
||||
ext: ""
|
||||
ext: ''
|
||||
- os: alpine
|
||||
nodeos: linux
|
||||
ext: ""
|
||||
ext: ''
|
||||
|
||||
steps:
|
||||
- name: actions/checkout@v4 (docker/vscode-extension)
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: vscode-extension
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "22.x"
|
||||
node-version: '22.x'
|
||||
|
||||
- working-directory: vscode-extension
|
||||
run: |
|
||||
- run: |
|
||||
NODE_OS=${{ matrix.nodeos }} NODE_ARCH=${{ matrix.nodearch }} npm install
|
||||
|
||||
- name: Set variables
|
||||
id: set-variables
|
||||
working-directory: vscode-extension
|
||||
run: |
|
||||
VERSION=$(npm pkg get version | tr -d \")
|
||||
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
|
||||
|
@ -120,44 +130,113 @@ jobs:
|
|||
SHA=$(git rev-parse --short HEAD)
|
||||
echo "SHA=$SHA" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Build the extension (refs/heads)
|
||||
if: startsWith(github.ref, 'refs/heads')
|
||||
- name: Build the extension
|
||||
env:
|
||||
VERSION: ${{ steps.set-variables.outputs.VERSION }}
|
||||
SHA: ${{ steps.set-variables.outputs.SHA }}
|
||||
working-directory: vscode-extension
|
||||
run: |
|
||||
npm install -g @vscode/vsce
|
||||
vsce package --target ${{ matrix.os }}-${{ matrix.nodearch }} -o docker-vscode-extension-${{ matrix.os }}-${{ matrix.nodearch }}-$VERSION-$SHA.vsix
|
||||
|
||||
- name: actions/upload-artifact@v4 (refs/heads)
|
||||
if: startsWith(github.ref, 'refs/heads')
|
||||
uses: actions/upload-artifact@v4
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: docker-vscode-extension-${{ matrix.os }}-${{ matrix.nodearch }}-${{ steps.set-variables.outputs.VERSION }}-${{ steps.set-variables.outputs.SHA }}.vsix
|
||||
path: vscode-extension/docker-vscode-extension-${{ matrix.os }}-${{ matrix.nodearch }}-${{ steps.set-variables.outputs.VERSION }}-${{ steps.set-variables.outputs.SHA }}.vsix
|
||||
path: docker-vscode-extension-${{ matrix.os }}-${{ matrix.nodearch }}-${{ steps.set-variables.outputs.VERSION }}-${{ steps.set-variables.outputs.SHA }}.vsix
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Build the extension (refs/tags/v)
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
create-release:
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- test-latest
|
||||
- test-release
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22.x'
|
||||
|
||||
- name: Set variables
|
||||
id: set-variables
|
||||
run: |
|
||||
VERSION=$(npm pkg get version | tr -d \")
|
||||
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Generate release notes
|
||||
run: |
|
||||
node build/releaser.mjs generate-release-notes > release-notes.tmp
|
||||
|
||||
- name: Get current date
|
||||
id: date
|
||||
run: echo "current_date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
|
||||
|
||||
- uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2.0.8 https://github.com/softprops/action-gh-release/commit/c062e08bd532815e2082a85e87e3ef29c3e6d191
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
name: v${{ steps.set-variables.outputs.version }} - ${{ steps.date.outputs.current_date }}
|
||||
tag_name: v${{ steps.set-variables.outputs.version }}
|
||||
body_path: release-notes.tmp
|
||||
fail_on_unmatched_files: true
|
||||
|
||||
upload-release-binaries:
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- create-release
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
os: [alpine, linux, win32, darwin]
|
||||
nodearch: [x64, arm64]
|
||||
include:
|
||||
- os: win32
|
||||
nodeos: win32
|
||||
ext: .exe
|
||||
- os: darwin
|
||||
nodeos: darwin
|
||||
ext: ''
|
||||
- os: linux
|
||||
nodeos: linux
|
||||
ext: ''
|
||||
- os: alpine
|
||||
nodeos: linux
|
||||
ext: ''
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22.x'
|
||||
|
||||
- run: |
|
||||
NODE_OS=${{ matrix.nodeos }} NODE_ARCH=${{ matrix.nodearch }} npm install
|
||||
|
||||
- name: Set variables
|
||||
id: set-variables
|
||||
run: |
|
||||
VERSION=$(npm pkg get version | tr -d \")
|
||||
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Build the extension
|
||||
env:
|
||||
VERSION: ${{ steps.set-variables.outputs.VERSION }}
|
||||
working-directory: vscode-extension
|
||||
run: |
|
||||
npm install -g @vscode/vsce
|
||||
vsce package --target ${{ matrix.os }}-${{ matrix.nodearch }} -o docker-vscode-extension-${{ matrix.os }}-${{ matrix.nodearch }}-$VERSION.vsix
|
||||
|
||||
- name: actions/upload-artifact@v4 (refs/tags/v)
|
||||
uses: actions/upload-artifact@v4
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: docker-vscode-extension-${{ matrix.os }}-${{ matrix.nodearch }}-${{ steps.set-variables.outputs.VERSION }}.vsix
|
||||
path: vscode-extension/docker-vscode-extension-${{ matrix.os }}-${{ matrix.nodearch }}-${{ steps.set-variables.outputs.VERSION }}.vsix
|
||||
path: docker-vscode-extension-${{ matrix.os }}-${{ matrix.nodearch }}-${{ steps.set-variables.outputs.VERSION }}.vsix
|
||||
if-no-files-found: error
|
||||
|
||||
- uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2.0.8 https://github.com/softprops/action-gh-release/commit/c062e08bd532815e2082a85e87e3ef29c3e6d191
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
files: vscode-extension/docker-vscode-extension-${{ matrix.os }}-${{ matrix.nodearch }}-${{ steps.set-variables.outputs.VERSION }}.vsix
|
||||
tag_name: v${{ steps.set-variables.outputs.version }}
|
||||
files: docker-vscode-extension-${{ matrix.os }}-${{ matrix.nodearch }}-${{ steps.set-variables.outputs.VERSION }}.vsix
|
||||
if-no-files-found: error
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
name: Prepare release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version_type:
|
||||
description: Version type
|
||||
required: true
|
||||
default: minor
|
||||
type: choice
|
||||
options:
|
||||
- patch
|
||||
- minor
|
||||
- major
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
prepare-release:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22.x
|
||||
|
||||
- name: Update versions in package.json and package-lock.json
|
||||
id: version
|
||||
run: |
|
||||
npm version ${{ github.event.inputs.version_type }} --no-git-tag-version
|
||||
NEW_VERSION=$(npm pkg get version | tr -d \")
|
||||
echo "New version (${{ github.event.inputs.version_type }}): $NEW_VERSION"
|
||||
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Update changelog to version ${{ steps.version.outputs.new_version }}
|
||||
run: |
|
||||
node build/releaser.mjs update-changelog ${{ steps.version.outputs.new_version }}
|
||||
|
||||
- name: Configure Git
|
||||
run: |
|
||||
git config --local user.email "${{ github.actor }}@users.noreply.github.com"
|
||||
git config --local user.name "${{ github.actor }}"
|
||||
|
||||
- name: Create pull request
|
||||
# https://github.com/peter-evans/create-pull-request/releases/tag/v7.0.8
|
||||
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
base: main
|
||||
branch: bot/prepare-release-v${{ steps.version.outputs.new_version }}
|
||||
commit-message: |
|
||||
Prepare for the v${{ steps.version.outputs.new_version }} release
|
||||
|
||||
This commit was generated by a GitHub Action workflow. It was triggered
|
||||
by ${{ github.actor }}.
|
||||
signoff: true
|
||||
delete-branch: true
|
||||
title: 'Prepare for the v${{ steps.version.outputs.new_version }} release (triggered by ${{ github.actor }})'
|
||||
body: |
|
||||
This pull request was generated by `./github/workflows/prepare-release.yml`.
|
||||
|
||||
It modifies the following three files:
|
||||
- `CHANGELOG.md` (update the section header to ${{ steps.version.outputs.new_version }} with today's date in UTC and the links at the bottom)
|
||||
- `package.json` (update version number to ${{ steps.version.outputs.new_version }} )
|
||||
- `package-lock.json` (update version number to ${{ steps.version.outputs.new_version }})
|
||||
draft: false
|
||||
add-paths: |
|
||||
CHANGELOG.md
|
||||
package.json
|
||||
package-lock.json
|
||||
assignees: ${{ github.actor }}
|
||||
reviewers: ${{ github.actor }}
|
|
@ -9,8 +9,5 @@ bin
|
|||
.vscode-test/
|
||||
.test-extensions
|
||||
syntaxes/
|
||||
|
||||
.github/workflows/build.yml
|
||||
|
||||
|
||||
misc/
|
||||
*/coverage
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
"type": "extensionHost",
|
||||
"request": "launch",
|
||||
"args": [
|
||||
"--extensionDevelopmentPath=${workspaceFolder}"
|
||||
"--extensionDevelopmentPath=${workspaceFolder}",
|
||||
"${workspaceFolder}/test/workspace"
|
||||
],
|
||||
"outFiles": [
|
||||
"${workspaceFolder}/dist/**/*.js"
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
// Place your settings in this file to overwrite default and user settings.
|
||||
{
|
||||
"editor.formatOnSave": true,
|
||||
"[javascript]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||
},
|
||||
"[json]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||
},
|
||||
"[typescriptreact]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||
},
|
||||
|
|
|
@ -7,6 +7,7 @@ out/**
|
|||
resources/readme/**
|
||||
src/**
|
||||
test/**
|
||||
misc/**
|
||||
.gitignore
|
||||
.yarnrc
|
||||
webpack.config.js
|
||||
|
|
170
CHANGELOG.md
|
@ -2,6 +2,169 @@
|
|||
|
||||
All notable changes to the Docker DX extension will be documented in this file.
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
|
||||
- Dockerfile
|
||||
- textDocument/inlayHint
|
||||
- show when an image was last pushed ([docker/docker-language-server#431](https://github.com/docker/docker-language-server/issues/431))
|
||||
- Compose
|
||||
- textDocument/completion
|
||||
- suggest image tags for images from Docker Hub ([docker/docker-language-server#375](https://github.com/docker/docker-language-server/issues/375))
|
||||
- textDocument/documentLink
|
||||
- support providing links for the `env_file` attribute of a service object ([docker/docker-language-server#436](https://github.com/docker/docker-language-server/issues/436))
|
||||
- support providing links for the `env_file` for included paths ([docker/docker-language-server#438](https://github.com/docker/docker-language-server/issues/438))
|
||||
- Bake
|
||||
- textDocument/completion
|
||||
- provide local file and folder name suggestions ([docker/docker-language-server#414](https://github.com/docker/docker-language-server/issues/414))
|
||||
- `context` attribute in a `target` block
|
||||
- `contexts` attribute in a `target` block
|
||||
- `dockerfile` attribute in a `target` block
|
||||
|
||||
### Fixed
|
||||
|
||||
- Dockerfile
|
||||
- textDocument/hover
|
||||
- ignore 4XX errors when hovering over images with a non-standard tag ([docker/docker-language-server#371](https://github.com/docker/docker-language-server/issues/371))
|
||||
- Compose
|
||||
- textDocument/completion
|
||||
- correct file system suggestions if an absolute path is used ([docker/docker-language-server#443](https://github.com/docker/docker-language-server/issues/443))
|
||||
- textDocument/documentLink
|
||||
- stop returning links for alias nodes in included paths ([docker/docker-language-server#439](https://github.com/docker/docker-language-server/issues/439))
|
||||
- Bake
|
||||
- textDocument/completion
|
||||
- check the type of the block before suggesting items ([docker/docker-language-server#422](https://github.com/docker/docker-language-server/issues/422))
|
||||
|
||||
## [0.15.0] - 2025-08-13
|
||||
|
||||
### Added
|
||||
|
||||
- added a language configuration for the `dockerbake` language to improve the editing experience ([#184](https://github.com/docker/vscode-extension/issues/184))
|
||||
- Compose
|
||||
- updated Compose schema to the latest version
|
||||
|
||||
### Fixed
|
||||
|
||||
- Bake
|
||||
- textDocument/hover
|
||||
- fix error when hovering inside a comment ([docker/docker-language-server#410](https://github.com/docker/docker-language-server/issues/410))
|
||||
|
||||
## [0.14.0] - 2025-08-06
|
||||
|
||||
### Added
|
||||
|
||||
- Compose
|
||||
- textDocument/completion
|
||||
- provide local file and folder name suggestions when modifying simple strings
|
||||
- service volumes ([docker/docker-language-server#376](https://github.com/docker/docker-language-server/issues/376))
|
||||
- `context` attribute of a `build` object of a service ([docker/docker-language-server#403](https://github.com/docker/docker-language-server/issues/403))
|
||||
- `dockerfile` attribute of a `build` object of a service ([docker/docker-language-server#403](https://github.com/docker/docker-language-server/issues/403))
|
||||
- `file` attribute of a `credential_spec` object of a service ([docker/docker-language-server#403](https://github.com/docker/docker-language-server/issues/403))
|
||||
- `env_file` of a service ([docker/docker-language-server#403](https://github.com/docker/docker-language-server/issues/403))
|
||||
- `path` attribute of an `env_file` array item of a service ([docker/docker-language-server#403](https://github.com/docker/docker-language-server/issues/403))
|
||||
- `file` attribute of an `extends` object of a service ([docker/docker-language-server#403](https://github.com/docker/docker-language-server/issues/403))
|
||||
- `label_file` of a service ([docker/docker-language-server#403](https://github.com/docker/docker-language-server/issues/403))
|
||||
- `file` attribute of a config ([docker/docker-language-server#403](https://github.com/docker/docker-language-server/issues/403))
|
||||
- `file` attribute of a secret ([docker/docker-language-server#403](https://github.com/docker/docker-language-server/issues/403))
|
||||
- string items of include objects ([docker/docker-language-server#403](https://github.com/docker/docker-language-server/issues/403))
|
||||
- `env_file` attribute of include objects ([docker/docker-language-server#403](https://github.com/docker/docker-language-server/issues/403))
|
||||
- `path` attribute of include objects ([docker/docker-language-server#403](https://github.com/docker/docker-language-server/issues/403))
|
||||
|
||||
### Fixed
|
||||
|
||||
- fix Dockerfile Language Server crash with tabbed heredoc delimiters ([#171](https://github.com/docker/vscode-extension/issues/171))
|
||||
- fix Buildx debugger integration so that it works on Windows ([#181](https://github.com/docker/vscode-extension/issues/181))
|
||||
- allow switching the builder used for debug sessions ([#183](https://github.com/docker/vscode-extension/pull/183))
|
||||
- Compose
|
||||
- textDocument/completion
|
||||
- fix build stage lookups for files in a folder under the `\\wsl$` host ([docker/docker-language-server#382](https://github.com/docker/docker-language-server/issues/382))
|
||||
- textDocument/documentLink
|
||||
- improve handling of malformed image attribute values with registry prefixes ([docker/docker-language-server#369](https://github.com/docker/docker-language-server/issues/369))
|
||||
- convert links properly if a WSL URI with a dollar sign is used ([docker/docker-language-server#366](https://github.com/docker/docker-language-server/issues/366))
|
||||
- Bake
|
||||
- textDocument/codeLens
|
||||
- refactor the URI handling code so it will accept a WSL URI with a dollar sign ([docker/docker-language-server#388](https://github.com/docker/docker-language-server/issues/388))
|
||||
- textDocument/completion
|
||||
- fix build stage and ARG name inference completion items for files in a folder under the `\\wsl$` host ([docker/docker-language-server#396](https://github.com/docker/docker-language-server/issues/396))
|
||||
- textDocument/definition
|
||||
- handle WSL URIs with a dollar sign properly to fix build stage lookups on those hosts ([docker/docker-language-server#390](https://github.com/docker/docker-language-server/issues/390))
|
||||
- handle WSL URIs with a dollar sign properly to fix build ARG reference lookups on those hosts ([docker/docker-language-server#393](https://github.com/docker/docker-language-server/issues/393))
|
||||
- textDocument/documentLink
|
||||
- convert links properly if a WSL URI with a dollar sign is used ([docker/docker-language-server#378](https://github.com/docker/docker-language-server/issues/378))
|
||||
- textDocument/inlayHint
|
||||
- refactor the URI handling code so it will process a WSL URI with a dollar sign correctly ([docker/docker-language-server#395](https://github.com/docker/docker-language-server/issues/395))
|
||||
- textDocument/inlineCompletion
|
||||
- convert links properly if a WSL URI with a dollar sign is used ([docker/docker-language-server#384](https://github.com/docker/docker-language-server/issues/384))
|
||||
- textDocument/publishDiagnostics
|
||||
- update the URI handling so that a WSL URI with a dollar sign can be scanned for errors ([docker/docker-language-server#386](https://github.com/docker/docker-language-server/issues/386))
|
||||
|
||||
## [0.13.0] - 2025-07-17
|
||||
|
||||
### Added
|
||||
|
||||
- Compose
|
||||
- textDocument/documentLink
|
||||
- add anchor resolution for all supported document links ([docker/docker-language-server#348](https://github.com/docker/docker-language-server/issues/348))
|
||||
- return document links for the `file` attribute of a service object's `extends` attribute object ([docker/docker-language-server#172](https://github.com/docker/docker-language-server/issues/172))
|
||||
- provide document links for models on Docker Hub and Hugging Face ([docker/docker-language-server#356](https://github.com/docker/docker-language-server/issues/356))
|
||||
- return document links for the `label_file` attribute of a service object ([docker/docker-language-server#360](https://github.com/docker/docker-language-server/issues/360))
|
||||
- textDocument/hover
|
||||
- support hovering over referenced models ([docker/docker-language-server#343](https://github.com/docker/docker-language-server/issues/343))
|
||||
|
||||
### Changed
|
||||
|
||||
- errors with the Docker Language Server will no longer be hidden
|
||||
|
||||
### Fixed
|
||||
|
||||
- stop the language server from crashing when opened inside a WSL folder with a dollar sign ([#165](https://github.com/docker/vscode-extension/issues/165))
|
||||
- Compose
|
||||
- textDocument/completion
|
||||
- prevent wildcard object attribute suggestions if the text cursor is not at the right indentation for attributes to be inserted ([docker/docker-language-server#342](https://github.com/docker/docker-language-server/issues/342))
|
||||
- textDocument/documentLink
|
||||
- fix bounds index error if a quoted string just has a registry and the colon character at the end ([docker/docker-language-server#351](https://github.com/docker/docker-language-server/issues/351))
|
||||
|
||||
## [0.12.0] - 2025-07-09
|
||||
|
||||
### Added
|
||||
|
||||
- a new experimental `docker.extension.enableBuildDebugging` setting for developing and testing the upcoming build debugging feature
|
||||
- this feature is under active development and is not ready for general use
|
||||
- Compose
|
||||
- update schema to the latest version
|
||||
- textDocument/completion
|
||||
- support completing model object names ([docker/docker-language-server#343](https://github.com/docker/docker-language-server/issues/343))
|
||||
- textDocument/definition
|
||||
- support jumping to referenced model objects ([docker/docker-language-server#343](https://github.com/docker/docker-language-server/issues/343))
|
||||
- textDocument/documentHighlight
|
||||
- support highlighting referenced models objects ([docker/docker-language-server#343](https://github.com/docker/docker-language-server/issues/343))
|
||||
- textDocument/documentLink
|
||||
- support recursing into anchors when searching for document links ([docker/docker-language-server#329](https://github.com/docker/docker-language-server/issues/329))
|
||||
- return document links for the `file` attribute of a service object's `credential_spec` ([docker/docker-language-server#338](https://github.com/docker/docker-language-server/issues/338))
|
||||
- textDocument/documentSymbol
|
||||
- show model objects in the document symbol tree ([docker/docker-language-server#343](https://github.com/docker/docker-language-server/issues/343))
|
||||
- textDocument/prepareRename
|
||||
- allow preparing rename on model objects ([docker/docker-language-server#343](https://github.com/docker/docker-language-server/issues/343))
|
||||
- textDocument/rename
|
||||
- support renaming model objects ([docker/docker-language-server#343](https://github.com/docker/docker-language-server/issues/343))
|
||||
|
||||
### Fixed
|
||||
|
||||
- Compose
|
||||
- textDocument/completion
|
||||
- prevent errors if an empty JSON object is the content of the YAML file ([docker/docker-language-server#330](https://github.com/docker/docker-language-server/issues/330))
|
||||
- check character offset before processing to prevent errors ([docker/docker-language-server#333](https://github.com/docker/docker-language-server/issues/333))
|
||||
|
||||
## [0.11.0] - 2025-06-23
|
||||
|
||||
### Added
|
||||
|
||||
- Dockerfile
|
||||
- include the Dockerfile Language Server written in TypeScript into the extension
|
||||
- draw horizontal lines between each `FROM` instruction to help users visually distinguish the different parts of a Dockerfile ([#147](https://github.com/docker/vscode-extension/issues/147))
|
||||
- a new `docker.extension.editor.dockerfileBuildStageDecorationLines` setting to toggle the divider lines, defaults to `true`
|
||||
|
||||
## [0.10.0] - 2025-06-12
|
||||
|
||||
### Added
|
||||
|
@ -340,7 +503,12 @@ All notable changes to the Docker DX extension will be documented in this file.
|
|||
- error reporting
|
||||
- Compose outline support
|
||||
|
||||
[Unreleased]: https://github.com/docker/vscode-extension/compare/v0.10.0...main
|
||||
[Unreleased]: https://github.com/docker/docker-language-server/compare/v0.15.0...main
|
||||
[0.15.0]: https://github.com/docker/docker-language-server/compare/v0.14.0...v0.15.0
|
||||
[0.14.0]: https://github.com/docker/vscode-extension/compare/v0.13.0...v0.14.0
|
||||
[0.13.0]: https://github.com/docker/vscode-extension/compare/v0.12.0...v0.13.0
|
||||
[0.12.0]: https://github.com/docker/vscode-extension/compare/v0.11.0...v0.12.0
|
||||
[0.11.0]: https://github.com/docker/vscode-extension/compare/v0.10.0...v0.11.0
|
||||
[0.10.0]: https://github.com/docker/vscode-extension/compare/v0.9.0...v0.10.0
|
||||
[0.9.0]: https://github.com/docker/vscode-extension/compare/v0.8.1...v0.9.0
|
||||
[0.8.1]: https://github.com/docker/vscode-extension/compare/v0.8.0...v0.8.1
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
# Build Debugging
|
||||
|
||||
> ⚠️ This feature is under **active** development and there may be breaking changes as we continue experimenting and fine tuning it. If you have feedback about this feature, please [open an issue](https://github.com/docker/vscode-extension/issues) or [start a discussion thread](https://github.com/docker/vscode-extension/discussions) and let us know what you think.
|
||||
|
||||
## Overview
|
||||
|
||||
Buildx provides an implementation of the [Debug Adapter Protocol](https://microsoft.github.io/debug-adapter-protocol/). This means development tools that support and implement the protocol can interface with Buildx directly and step through the build process in real-time.
|
||||
|
||||
## Requirements
|
||||
|
||||
To use the build debugging feature, you will need to have [Buildx](https://github.com/docker/buildx) installed. The minimum supported version is v0.26.1. You can install Buildx manually by following the instructions [here](https://github.com/docker/buildx?tab=readme-ov-file#manual-download).
|
||||
|
||||
1. Run `docker buildx version` to check your Buildx version.
|
||||
2. Run `BUILDX_EXPERIMENTAL=1 docker buildx dap` to check that the `dap` subcommand is available in your Buildx installation.
|
||||
3. Search for "docker enable build debugging" in the VS Code settings (<kbd>Ctrl+,</kbd> or <kbd>Command+,</kbd>) and enable the experimental "Enable Build Debugging" setting.
|
||||
4. Restart VS Code for the setting to take effect.
|
||||
|
||||

|
||||
|
||||
## Features
|
||||
|
||||
### Debugging without a Launch Configuration
|
||||
|
||||
The Docker DX extension will fill in a debug configuration on a best effort basis. If you do not have a `launch.json` file or if it does not define any launch configurations, you can start debugging by simply opening a Dockerfile and then clicking on the "Run and Debug" button in the "Run and Debug" side panel.
|
||||
|
||||

|
||||
|
||||
### Debugging with a Launch Configuration
|
||||
|
||||
For more complicated build configurations, you can use the `launch.json` to define launch configurations for the buildx debugger.
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
```jsonc
|
||||
{
|
||||
"type": "dockerfile", // required, must not be modified
|
||||
"request": "launch", // required, must not be modified
|
||||
"name": "Docker: Build", // required, configurable
|
||||
"dockerfile": "Dockerfile", // required, configurable
|
||||
"contextPath": "${workspaceFolder}",
|
||||
"target": "test", // optional, should be a build stage in the Dockerfile
|
||||
"args": [
|
||||
// additional arguments for the build command
|
||||
"--build-arg",
|
||||
"NODE_ENV=development"
|
||||
],
|
||||
"stopOnEntry": true, // if the debugger should suspend on the first line, defaults to false
|
||||
}
|
||||
```
|
||||
|
||||
### Setting Breakpoints
|
||||
|
||||
The build debugger integration supports setting line breakpoints on an instruction. Visual Studio Code offers various ways for setting a breakpoint which you can read more about [here](https://code.visualstudio.com/docs/debugtest/debugging#_breakpoints).
|
||||
|
||||

|
||||
|
||||
### Opening a Shell Inside the Image Being Built
|
||||
|
||||
> ⚠️ Note that this feature is still being fine tuned.
|
||||
|
||||
When crafting a Dockerfile in the beginning, it is common to make changes and rerun the build again and again. With the shell exec feature, you can quickly open a shell for the image you are building and test commands there before copying them back into your Dockerfile.
|
||||
|
||||
1. Set a breakpoint in the build.
|
||||
2. When the build process has been suspended, open the Debug Console.
|
||||
3. Type in `exec` and press <kbd>Enter</kbd>.
|
||||
4. A new terminal with a shell inside the paused build image will be opened.
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
### Inspecting Variables
|
||||
|
||||
The Variables pane in Visual Studio Code lets you view the value of `ARG` and `ENV` variables. The pane can help clarify what a value is if variable substitutions are involved.
|
||||
|
||||

|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If you encounter errors or issues with this feature, the DAP logs may help. Open the Output panel and select "Docker Buildx DAP" from the drop down.
|
||||
|
||||

|
37
FAQ.md
|
@ -12,6 +12,30 @@ Please refer to [this blog post](https://www.docker.com/blog/docker-dx-extension
|
|||
|
||||
For information regarding telemetry, please refer to [TELEMETRY.md](./TELEMETRY.md).
|
||||
|
||||
### Where can I find the language server logs?
|
||||
|
||||
The language server logs can be enabled by modifying your settings. After turning them on, you can look for "Docker Language Server" and/or "Docker Language Server" in the Output view.
|
||||
|
||||
```JSONC
|
||||
{
|
||||
// Docker Language Server (https://github.com/docker/docker-language-server)
|
||||
"dockerLanguageClient.trace.server": "verbose",
|
||||
// Dockerfile Language Server (https://github.com/rcjsuen/dockerfile-language-server)
|
||||
"dockerfile-language-server.trace.server": "verbose"
|
||||
}
|
||||
```
|
||||
|
||||
### How can I disable warnings related to vulnerabilities in images?
|
||||
|
||||
To disable everything, you can set the `docker.lsp.experimental.vulnerabilityScanning` setting to `false`.
|
||||
|
||||
If you would like to disable specific warnings about vulnerabilities, you can opt in or out of them individually as well.
|
||||
|
||||
- `docker.lsp.experimental.scout.criticalHighVulnerabilities`
|
||||
- `docker.lsp.experimental.scout.notPinnedDigest`
|
||||
- `docker.lsp.experimental.scout.recommendedTag`
|
||||
- `docker.lsp.experimental.scout.vulnerabilities`
|
||||
|
||||
### I am seeing duplicated editor features (such as code completion suggestions, hover tooltips, etc.) in Compose files.
|
||||
|
||||
Do you have any of the following extensions installed?
|
||||
|
@ -23,12 +47,11 @@ Do you have any of the following extensions installed?
|
|||
If yes, you can refer to the steps below to remove the duplicates. Alternatively, if you would prefer to disable the Compose editing features that _this_ extension is providing, you can set the `docker.extension.enableComposeLanguageServer` setting to `false` and then restart Visual Studio Code.
|
||||
|
||||
- [Red Hat's YAML extension](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml) (powered by [redhat-developer/yaml-language-server](https://github.com/redhat-developer/yaml-language-server))
|
||||
1. To disable duplicates from this extension, create a JSON file with `{}` as its content and save it somewhere. Let's say it is at `/home/user/empty.json`.
|
||||
2. Open the [Command Palette](https://code.visualstudio.com/api/ux-guidelines/command-palette) in Visual Studio Code and open "Preferences: Open User Settings (JSON)".
|
||||
3. Set `docker.extension.enableComposeLanguageServer` to `true` by following the snippet below.
|
||||
4. Create an object attribute for `yaml.schemas` if it does not already exist.
|
||||
5. Inside the `yaml.schemas` object, map your empty JSON file to Compose YAML files by following the snippet below.
|
||||
6. YAML files named `compose*y*ml` or `docker-compose*y*ml` will now no longer have the Compose schema associated with them in Red Hat's extension so Red Hat's extension will stop providing YAML features for Compose files. This admittedly is a strange way to disable YAML features for a given file but it is the only known workaround for resolving this until [redhat-developer/vscode-yaml#1088](https://github.com/redhat-developer/vscode-yaml/issues/1088) is implemented.
|
||||
1. To disable duplicates from this extension, open the [Command Palette](https://code.visualstudio.com/api/ux-guidelines/command-palette) in Visual Studio Code and open "Preferences: Open User Settings (JSON)".
|
||||
2. Set `docker.extension.enableComposeLanguageServer` to `true` by following the snippet below.
|
||||
3. Create an object attribute for `yaml.schemas` if it does not already exist.
|
||||
4. Inside the `yaml.schemas` object, copy the URL to [this empty JSON file](https://raw.githubusercontent.com/docker/vscode-extension/6a88caada42b57090df7ce91ec2a6561b422afe1/misc/empty.json) to Compose YAML files by following the snippet below.
|
||||
5. YAML files named `compose*y*ml` or `docker-compose*y*ml` will now no longer have the Compose schema associated with them in Red Hat's extension so Red Hat's extension will stop providing YAML features for Compose files. This admittedly is a strange way to disable YAML features for a given file but it is the only known workaround for resolving this until [redhat-developer/vscode-yaml#245](https://github.com/redhat-developer/vscode-yaml/issues/245) is implemented.
|
||||
|
||||
```JSONC
|
||||
{
|
||||
|
@ -40,7 +63,7 @@ If yes, you can refer to the steps below to remove the duplicates. Alternatively
|
|||
// this tells Red Hat's YAML extension to consider Compose YAML
|
||||
// files as not having a schema so it will stop suggesting code
|
||||
// completion items, hover tooltips, and so on
|
||||
"/home/user/empty.json": ["compose*y*ml", "docker-compose*y*ml"]
|
||||
"https://raw.githubusercontent.com/docker/vscode-extension/6a88caada42b57090df7ce91ec2a6561b422afe1/misc/empty.json": ["compose*y*ml", "docker-compose*y*ml"]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
|
30
README.md
|
@ -30,7 +30,7 @@ If you are on an unsupported system, let us know of your interest in this extens
|
|||
|
||||
You can get linting checks from [BuildKit](https://github.com/moby/buildkit) and [BuildX](https://github.com/docker/buildx) when editing your Dockerfiles.
|
||||
|
||||
Any references to images with vulnerabilities are also flagged. Note: This is an experimental feature.
|
||||
Any references to images with vulnerabilities are also flagged. This is an **experimental** feature and may change in the future. Refer to our [FAQ.md](./FAQ.md) to see how you can opt in or out of these warnings.
|
||||
|
||||
Errors are visible directly in your editor or you can look at them by opening up the Problems panel (<kbd>Ctrl+Shift+M</kbd> on Windows/Linux, <kbd>Shift+Command+M</kbd> on Mac).
|
||||
|
||||
|
@ -56,6 +56,12 @@ The extension provides inline suggestions to generate a Bake target to correspon
|
|||
|
||||

|
||||
|
||||
### Build Debugging (EXPERIMENTAL)
|
||||
|
||||
This feature is under active development and requires version `v0.26.1` of `docker buildx` or newer. This is disabled by default. Open [DEBUGGING.md](./DEBUGGING.md) to learn more about this feature in Visual Studio Code and how to enable it.
|
||||
|
||||
For information about Buildx and the Debug Adapter Protocol, go [here](https://github.com/docker/buildx/blob/master/docs/dap.md). If you have any bugs, feature requests, or feedback about Buildx's support for Debug Adapter Protocol, please report them [here](https://github.com/docker/buildx/issues/new/choose).
|
||||
|
||||
## Builds
|
||||
|
||||
[GitHub Actions](https://github.com/docker/vscode-extension/actions) builds eight `.vsix` files - one for each platform combination (Windows, macOS, Linux, Alpine Linux x `amd64`/`arm64`).
|
||||
|
@ -64,6 +70,11 @@ Note: The language server binary from these builds are not signed and/or notariz
|
|||
|
||||
## Development
|
||||
|
||||
To develop this extension, you should first make sure you have the following extensions installed:
|
||||
|
||||
- [Prettier - Code formatter](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
|
||||
- [TypeScript + Webpack Problem Matchers](https://marketplace.visualstudio.com/items?itemName=amodio.tsl-problem-matcher)
|
||||
|
||||
To debug the VS Code extension, clone this repository and then run `npm install`. This will download a binary of the [Docker Language Server](https://github.com/docker/docker-language-server/releases) to the `bin` folder. If you would like to test your own custom build of the language server, simply replace the file in the `bin` folder with your own binary.
|
||||
|
||||
### Debugging both the extension and language server
|
||||
|
@ -77,6 +88,19 @@ To debug the VS Code extension, clone this repository and then run `npm install`
|
|||
|
||||
Run `npm test` to launch the UI tests.
|
||||
|
||||
### Releasing
|
||||
|
||||
Follow the following steps to create a new release of the Docker DX Visual Studio Code extension:
|
||||
|
||||
1. Run the "[prepare release](https://github.com/docker/vscode-extension/actions/workflows/prepare-release.yml)" workflow with the desired bump in semantic versioning. This workflow will update `CHANGELOG.md`, `package.json`, and `package-lock.json` and create a pull request with the three files.
|
||||
2. Review the generated [pull request](https://github.com/docker/vscode-extension/pulls).
|
||||
1. The pull request's description will describe the changes to the three files. Verify that the changes make sense.
|
||||
2. If the changes look good and the builds and checks have completed and passed, approve the pull request and merge it manually.
|
||||
3. Now that the pull request has been merged into the `main` branch, a build named "Build: Automatic" will be triggered. Wait for the automated build from the "[build](https://github.com/docker/vscode-extension/actions/workflows/build.yml)" workflow to complete.
|
||||
4. If the build has completed successfully, use the "Run workflow" button to manually trigger the "[build](https://github.com/docker/vscode-extension/actions/workflows/build.yml)" workflow.
|
||||
5. This manually triggered workflow will start a "Build: Release" which will run the tests, create the release, build the binaries, and attach the binaries to the release.
|
||||
6. When the workflow has completed, open the [releases](https://github.com/docker/vscode-extension/releases) page. It should have been automatically generated by the workflow and the resulting VSIX files should be attached to the release.
|
||||
|
||||
## Telemetry
|
||||
|
||||
The Docker DX extension collects telemetry. We collect this telemetry so that we can improve the extension by understanding usage patterns and catching crashes and errors for diagnostic purposes. Note that if you have already opted out of sending telemetry in Visual Studio Code then no telemetry will be sent.
|
||||
|
@ -86,3 +110,7 @@ See [TELEMETRY.md](./TELEMETRY.md) for details about what kind of telemetry we c
|
|||
## FAQ
|
||||
|
||||
Please refer to [FAQ.md](./FAQ.md) for our list of frequently asked questions.
|
||||
|
||||
## License
|
||||
|
||||
[Apache License Version 2.0](./LICENSE)
|
||||
|
|
|
@ -77,7 +77,7 @@ async function downloadLanguageServerBinary() {
|
|||
const platform = getPlatform();
|
||||
const arch = getArch();
|
||||
const suffix = platform === 'windows' ? '.exe' : '';
|
||||
const version = '0.12.0';
|
||||
const version = '0.17.0';
|
||||
const binaryFile = `docker-language-server-${platform}-${arch}-v${version}${suffix}`;
|
||||
const targetFile = `docker-language-server-${platform}-${arch}${suffix}`;
|
||||
const url = `https://github.com/docker/docker-language-server/releases/download/v${version}/${binaryFile}`;
|
||||
|
|
|
@ -0,0 +1,170 @@
|
|||
import * as fs from 'fs';
|
||||
import * as readline from 'readline';
|
||||
|
||||
const changelogPath = 'CHANGELOG.md';
|
||||
|
||||
const args = process.argv.slice(2);
|
||||
if (args.length < 1) {
|
||||
console.error(
|
||||
`Usage: node releaser.mjs <update-changelog|generate-release-notes> [args...]`,
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const command = args[0].toLowerCase();
|
||||
|
||||
if (command === 'update-changelog') {
|
||||
if (args.length < 2) {
|
||||
console.error(`Usage: node releaser.js update-changelog <version>`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const version = args[1];
|
||||
if (!/^\d+\.\d+\.\d+$/.test(version)) {
|
||||
console.error(`Error: version must be in format x.y.z (e.g., 1.2.3)`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
updateChangelog(changelogPath, changelogPath, version)
|
||||
.then(() =>
|
||||
console.log(`Successfully updated CHANGELOG.md with version ${version}`),
|
||||
)
|
||||
.catch((err) => {
|
||||
console.error(`Error: ${err.message}`);
|
||||
process.exit(1);
|
||||
});
|
||||
} else if (command === 'generate-release-notes') {
|
||||
generateReleaseNotes(changelogPath)
|
||||
.then((content) => console.log(content))
|
||||
.catch((err) => {
|
||||
console.error(`Error: ${err.message}`);
|
||||
process.exit(1);
|
||||
});
|
||||
} else {
|
||||
console.error(
|
||||
`Error: unknown command '${command}'. Use 'update-changelog' or 'generate-release-notes'`,
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
function readFileLines(filePath) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const lines = [];
|
||||
const rl = readline.createInterface({
|
||||
input: fs.createReadStream(filePath),
|
||||
crlfDelay: Infinity,
|
||||
});
|
||||
|
||||
rl.on('line', (line) => lines.push(line));
|
||||
rl.on('close', () => resolve(lines));
|
||||
rl.on('error', reject);
|
||||
});
|
||||
}
|
||||
|
||||
async function updateChangelog(inputPath, outputPath, newVersion) {
|
||||
const lines = await readFileLines(inputPath);
|
||||
|
||||
let unreleasedIndex = -1;
|
||||
let nextVersionIndex = -1;
|
||||
let linksStartIndex = -1;
|
||||
let previousVersion = '';
|
||||
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
const line = lines[i];
|
||||
|
||||
if (line.includes('## [Unreleased]')) {
|
||||
unreleasedIndex = i;
|
||||
} else if (
|
||||
nextVersionIndex === -1 &&
|
||||
unreleasedIndex !== -1 &&
|
||||
line.startsWith('## [') &&
|
||||
!line.includes('Unreleased')
|
||||
) {
|
||||
nextVersionIndex = i;
|
||||
const match = line.match(/^## \[([0-9]+\.[0-9]+\.[0-9]+)\]/);
|
||||
if (match) {
|
||||
previousVersion = match[1];
|
||||
}
|
||||
} else if (
|
||||
linksStartIndex === -1 &&
|
||||
line.startsWith('[') &&
|
||||
line.includes(']: https://github.com/')
|
||||
) {
|
||||
linksStartIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (unreleasedIndex === -1) {
|
||||
throw new Error("could not find 'Unreleased' section in changelog");
|
||||
}
|
||||
if (nextVersionIndex === -1 || !previousVersion) {
|
||||
throw new Error(
|
||||
"could not find previous version section after 'Unreleased'",
|
||||
);
|
||||
}
|
||||
if (linksStartIndex === -1) {
|
||||
throw new Error('could not find links section in changelog');
|
||||
}
|
||||
|
||||
const today = new Date().toISOString().split('T')[0];
|
||||
|
||||
lines[unreleasedIndex] = `## [${newVersion}] - ${today}`;
|
||||
|
||||
const updatedLinks = updateLinks(
|
||||
lines.slice(linksStartIndex),
|
||||
newVersion,
|
||||
previousVersion,
|
||||
);
|
||||
const updatedContent = lines.slice(0, linksStartIndex).concat(updatedLinks);
|
||||
|
||||
await fs.promises.writeFile(outputPath, updatedContent.join('\n') + '\n');
|
||||
}
|
||||
|
||||
function updateLinks(linkLines, newVersion, previousVersion) {
|
||||
// first link unreleased, second link with the new tag
|
||||
const newLinks = [
|
||||
`[Unreleased]: https://github.com/docker/docker-language-server/compare/v${newVersion}...main`,
|
||||
`[${newVersion}]: https://github.com/docker/docker-language-server/compare/v${previousVersion}...v${newVersion}`,
|
||||
];
|
||||
|
||||
// all other links can be from the original, after skipping the first one
|
||||
for (let i = 1; i < linkLines.length; i++) {
|
||||
newLinks.push(linkLines[i]);
|
||||
}
|
||||
|
||||
return newLinks;
|
||||
}
|
||||
|
||||
async function generateReleaseNotes(filePath) {
|
||||
const lines = await readFileLines(filePath);
|
||||
|
||||
let firstHeader = -1,
|
||||
secondHeader = -1;
|
||||
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
if (lines[i].startsWith('## ')) {
|
||||
if (firstHeader === -1) {
|
||||
firstHeader = i;
|
||||
} else if (secondHeader === -1) {
|
||||
secondHeader = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (secondHeader === -1) {
|
||||
throw new Error('could not find two ## headers in the changelog');
|
||||
}
|
||||
|
||||
// remove leading and trailing empty newlines
|
||||
const content = lines.slice(firstHeader + 1, secondHeader);
|
||||
while (content.length > 0 && content[0].trim() === '') {
|
||||
content.shift();
|
||||
}
|
||||
while (content.length > 0 && content[content.length - 1].trim() === '') {
|
||||
content.pop();
|
||||
}
|
||||
|
||||
return content.join('\n');
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"comments": {
|
||||
"blockComment": ["/*", "*/"],
|
||||
"lineComment": {
|
||||
"comment": "//",
|
||||
"noIndent": false
|
||||
}
|
||||
},
|
||||
"brackets": [
|
||||
["{", "}"],
|
||||
["[", "]"],
|
||||
["(", ")"]
|
||||
],
|
||||
"autoClosingPairs": [
|
||||
{ "open": "{", "close": "}" },
|
||||
{ "open": "[", "close": "]" },
|
||||
{ "open": "(", "close": ")" },
|
||||
{ "open": "\"", "close": "\"", "notIn": ["string"] },
|
||||
{ "open": "/*", "close": " */", "notIn": ["string"] }
|
||||
],
|
||||
"surroundingPairs": [
|
||||
["{", "}"],
|
||||
["[", "]"],
|
||||
["(", ")"],
|
||||
["\"", "\""]
|
||||
]
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
{}
|
109
package.json
|
@ -2,8 +2,8 @@
|
|||
"name": "docker",
|
||||
"displayName": "Docker DX",
|
||||
"description": "Edit smarter, ship faster with an enhanced Docker-development experience",
|
||||
"version": "0.10.0",
|
||||
"icon": "resources/docker-logo-vertical-blue.png",
|
||||
"version": "0.15.0",
|
||||
"icon": "resources/logo-256x256.png",
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"vscode": "^1.92.0"
|
||||
|
@ -11,14 +11,16 @@
|
|||
"publisher": "docker",
|
||||
"categories": [
|
||||
"Programming Languages",
|
||||
"Linters"
|
||||
"Linters",
|
||||
"Debuggers"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/docker/vscode-extension"
|
||||
},
|
||||
"activationEvents": [
|
||||
"onLanguage:dockerbake",
|
||||
"onDebugResolve:dockerfile",
|
||||
"onDebugDynamicConfigurations:dockerfile",
|
||||
"onLanguage:dockercompose",
|
||||
"onLanguage:dockerfile"
|
||||
],
|
||||
|
@ -34,6 +36,10 @@
|
|||
"title": "Scan for CVEs with Docker Scout",
|
||||
"command": "docker.scout.imageScan",
|
||||
"enablement": "(view == dockerImages || view == vscode-containers.views.images) && viewItem == image"
|
||||
},
|
||||
{
|
||||
"title": "Build with Debugger",
|
||||
"command": "docker.debug.editorContents"
|
||||
}
|
||||
],
|
||||
"languages": [
|
||||
|
@ -42,7 +48,8 @@
|
|||
"filenames": [
|
||||
"docker-bake.hcl",
|
||||
"docker-bake.override.hcl"
|
||||
]
|
||||
],
|
||||
"configuration": "./configs/dockerbake-language-configuration.json"
|
||||
}
|
||||
],
|
||||
"grammars": [
|
||||
|
@ -61,9 +68,90 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"breakpoints": [
|
||||
{
|
||||
"language": "dockerfile"
|
||||
}
|
||||
],
|
||||
"debuggers": [
|
||||
{
|
||||
"type": "dockerfile",
|
||||
"languages": [
|
||||
"dockerfile"
|
||||
],
|
||||
"label": "Docker: Build",
|
||||
"configurationAttributes": {
|
||||
"launch": {
|
||||
"required": [
|
||||
"contextPath"
|
||||
],
|
||||
"properties": {
|
||||
"dockerfile": {
|
||||
"type": "string",
|
||||
"description": "Relative path from the context to the dockerfile.",
|
||||
"default": "Dockerfile"
|
||||
},
|
||||
"contextPath": {
|
||||
"type": "string",
|
||||
"description": "Path to the context.",
|
||||
"default": "${workspaceFolder}"
|
||||
},
|
||||
"target": {
|
||||
"type": "string",
|
||||
"description": "Target build stage to build."
|
||||
},
|
||||
"stopOnEntry": {
|
||||
"type": "boolean",
|
||||
"description": "Stop the docker build on the first instruction.",
|
||||
"default": false
|
||||
},
|
||||
"builder": {
|
||||
"type": "string",
|
||||
"description": "Builder to use."
|
||||
},
|
||||
"args": {
|
||||
"type": "array",
|
||||
"description": "Arguments to pass to the build."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"initialConfigurations": [
|
||||
{
|
||||
"type": "dockerfile",
|
||||
"request": "launch",
|
||||
"name": "Docker: Build",
|
||||
"dockerfile": "Dockerfile",
|
||||
"contextPath": "${workspaceFolder}"
|
||||
}
|
||||
],
|
||||
"configurationSnippets": [
|
||||
{
|
||||
"label": "Docker: Build",
|
||||
"description": "A new configuration for debugging a user selected Dockerfile.",
|
||||
"body": {
|
||||
"type": "dockerfile",
|
||||
"request": "launch",
|
||||
"name": "Docker: Build",
|
||||
"dockerfile": "${2:Dockerfile}",
|
||||
"contextPath": "^\"\\${workspaceFolder}\""
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"configuration": {
|
||||
"title": "Docker DX",
|
||||
"properties": {
|
||||
"docker.extension.enableBuildDebugging": {
|
||||
"type": "boolean",
|
||||
"description": "Enables build debugging features from the Docker DX extension. This feature is under active development. Note that changing this value requires a restart of Visual Studio Code to take effect.",
|
||||
"markdownDescription": "Enable build debugging features from the Docker DX extension. This feature is under active development. Note that changing this value requires a **restart** of Visual Studio Code to take effect.",
|
||||
"default": false,
|
||||
"tags": [
|
||||
"experimental"
|
||||
]
|
||||
},
|
||||
"docker.extension.enableComposeLanguageServer": {
|
||||
"type": "boolean",
|
||||
"description": "Enable Compose editing features from the Docker DX extension. Note that changing this value requires a restart of Visual Studio Code to take effect.",
|
||||
|
@ -77,6 +165,12 @@
|
|||
"default": true,
|
||||
"scope": "application"
|
||||
},
|
||||
"docker.extension.editor.dockerfileBuildStageDecorationLines": {
|
||||
"type": "boolean",
|
||||
"description": "Render a divider line between each build stage of a Dockerfile.",
|
||||
"default": true,
|
||||
"scope": "resource"
|
||||
},
|
||||
"docker.lsp.telemetry": {
|
||||
"type": "string",
|
||||
"description": "Determines what telemetry is collected by Docker. If vscode.env.isTelemetryEnabled is false, then telemetry collection is disabled regardless of what has been set for this configuration value.",
|
||||
|
@ -161,6 +255,8 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@bugsnag/js": "~8.2.0",
|
||||
"dockerfile-ast": "0.7.1",
|
||||
"dockerfile-language-server-nodejs": "0.14.1",
|
||||
"vscode-languageclient": "9.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
@ -179,7 +275,8 @@
|
|||
"prettier": "^3.5.3",
|
||||
"ts-loader": "^9.5.1",
|
||||
"typescript": "^5.4.5",
|
||||
"vscode-extension-tester": "^8.13.0",
|
||||
"umd-compat-loader": "^2.1.2",
|
||||
"vscode-extension-tester": "^8.17.0",
|
||||
"webpack": "^5.92.1",
|
||||
"webpack-cli": "^5.1.4"
|
||||
}
|
||||
|
|
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 125 KiB |
After Width: | Height: | Size: 115 KiB |
After Width: | Height: | Size: 84 KiB |
After Width: | Height: | Size: 106 KiB |
After Width: | Height: | Size: 74 KiB |
Before Width: | Height: | Size: 244 KiB |
After Width: | Height: | Size: 2.0 KiB |
|
@ -0,0 +1,182 @@
|
|||
import * as vscode from 'vscode';
|
||||
import { registerCommand } from '../extension';
|
||||
import { getExtensionSetting } from '../utils/settings';
|
||||
|
||||
export const DebugEditorContentsCommandId = 'docker.debug.editorContents';
|
||||
|
||||
class DebugAdapterExecutableFactory
|
||||
implements vscode.DebugAdapterDescriptorFactory
|
||||
{
|
||||
createDebugAdapterDescriptor(
|
||||
session: vscode.DebugSession,
|
||||
): vscode.ProviderResult<vscode.DebugAdapterDescriptor> {
|
||||
var args = ['buildx'];
|
||||
if (session.configuration?.builder) {
|
||||
args = args.concat(['--builder', session.configuration?.builder]);
|
||||
}
|
||||
args = args.concat(['dap', 'build']);
|
||||
if (session.configuration?.args) {
|
||||
args = args.concat(session.configuration?.args);
|
||||
}
|
||||
|
||||
const options = {
|
||||
cwd: session.workspaceFolder?.uri.fsPath,
|
||||
env: { BUILDX_EXPERIMENTAL: '1' },
|
||||
};
|
||||
|
||||
return new vscode.DebugAdapterExecutable('docker', args, options);
|
||||
}
|
||||
}
|
||||
|
||||
class DockerfileConfigurationProvider
|
||||
implements vscode.DebugConfigurationProvider
|
||||
{
|
||||
resolveDebugConfiguration(
|
||||
_folder: vscode.WorkspaceFolder | undefined,
|
||||
config: vscode.DebugConfiguration,
|
||||
): vscode.ProviderResult<vscode.DebugConfiguration> {
|
||||
// this can happen when debugging without anything in launch.json
|
||||
if (!config.type && !config.request && !config.name) {
|
||||
const editor = vscode.window.activeTextEditor;
|
||||
if (editor !== undefined && editor.document.languageId === 'dockerfile') {
|
||||
config.type = 'dockerfile';
|
||||
config.name = 'Docker: Build';
|
||||
config.request = 'launch';
|
||||
config.dockerfile = editor.document.uri.fsPath;
|
||||
config.contextPath = '${workspaceFolder}';
|
||||
}
|
||||
}
|
||||
return config;
|
||||
}
|
||||
}
|
||||
|
||||
class DockerfileDebugAdapterTracker implements vscode.DebugAdapterTracker {
|
||||
constructor(
|
||||
private id: string,
|
||||
private name: string,
|
||||
private channel: vscode.OutputChannel,
|
||||
) {}
|
||||
|
||||
log(logLevel: string, message: any): void {
|
||||
message.id = this.id;
|
||||
message.name = this.name;
|
||||
this.channel.appendLine(
|
||||
`${new Date().toISOString()} [${logLevel}] ${JSON.stringify(message)}`,
|
||||
);
|
||||
}
|
||||
|
||||
onWillStartSession(): void {
|
||||
this.log('debug', { message: 'DAP session about to be started' });
|
||||
}
|
||||
|
||||
onWillStopSession(): void {
|
||||
this.log('debug', { message: 'DAP session about to be stopped' });
|
||||
}
|
||||
|
||||
onWillReceiveMessage(message: any): void {
|
||||
this.log('debug', {
|
||||
message: 'DAP message will be received from the editor',
|
||||
dapMessage: message,
|
||||
});
|
||||
}
|
||||
|
||||
onDidSendMessage(message: any): void {
|
||||
this.log('debug', {
|
||||
message: 'DAP message has been sent to the editor',
|
||||
dapMessage: message,
|
||||
});
|
||||
}
|
||||
|
||||
onExit(code: number | undefined, signal: string | undefined): void {
|
||||
const message = { message: 'DAP exited', code: code, signal: signal };
|
||||
if (code === 0) {
|
||||
this.log('debug', message);
|
||||
} else {
|
||||
this.log('error', message);
|
||||
}
|
||||
}
|
||||
|
||||
onError(error: Error): void {
|
||||
this.log('error', {
|
||||
message: 'DAP error occurred',
|
||||
dapMessage: { error: String(error) },
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export function setupDebugging(ctx: vscode.ExtensionContext) {
|
||||
if (!getExtensionSetting<boolean>('enableBuildDebugging')) {
|
||||
// the command is still contributed to the Command Palette because of package.json
|
||||
registerCommand(ctx, DebugEditorContentsCommandId, async () => {
|
||||
vscode.window.showErrorMessage(
|
||||
'Build Debugging for Docker is an experimental feature that is under active development. ' +
|
||||
'Enable the feature by toggling the docker.extension.enableBuildDebugging setting to true and restarting your client.',
|
||||
);
|
||||
return Promise.resolve(false);
|
||||
});
|
||||
|
||||
// the debugger is still contributed and technically registered because of package.json
|
||||
ctx.subscriptions.push(
|
||||
vscode.debug.registerDebugConfigurationProvider('dockerfile', {
|
||||
resolveDebugConfiguration(): vscode.ProviderResult<vscode.DebugConfiguration> {
|
||||
vscode.window.showErrorMessage(
|
||||
'Build Debugging for Docker is an experimental feature that is under active development. ' +
|
||||
'Enable the feature by toggling the docker.extension.enableBuildDebugging setting to true and restarting your client.',
|
||||
);
|
||||
return undefined;
|
||||
},
|
||||
}),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
let channel = vscode.window.createOutputChannel('Docker Buildx DAP', 'log');
|
||||
|
||||
registerCommand(
|
||||
ctx,
|
||||
DebugEditorContentsCommandId,
|
||||
async (resource: vscode.Uri) => {
|
||||
let targetResource = resource;
|
||||
if (!targetResource && vscode.window.activeTextEditor) {
|
||||
targetResource = vscode.window.activeTextEditor.document.uri;
|
||||
}
|
||||
if (targetResource) {
|
||||
vscode.debug.startDebugging(undefined, {
|
||||
type: 'dockerfile',
|
||||
name: 'Docker: Build',
|
||||
request: 'launch',
|
||||
dockerfile: targetResource.fsPath,
|
||||
contextPath: '${workspaceFolder}',
|
||||
});
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
return Promise.resolve(false);
|
||||
},
|
||||
);
|
||||
|
||||
ctx.subscriptions.push(
|
||||
vscode.debug.registerDebugConfigurationProvider(
|
||||
'dockerfile',
|
||||
new DockerfileConfigurationProvider(),
|
||||
),
|
||||
);
|
||||
|
||||
ctx.subscriptions.push(
|
||||
vscode.debug.registerDebugAdapterDescriptorFactory(
|
||||
'dockerfile',
|
||||
new DebugAdapterExecutableFactory(),
|
||||
),
|
||||
);
|
||||
|
||||
vscode.debug.registerDebugAdapterTrackerFactory('dockerfile', {
|
||||
createDebugAdapterTracker(
|
||||
session,
|
||||
): vscode.ProviderResult<vscode.DebugAdapterTracker> {
|
||||
return new DockerfileDebugAdapterTracker(
|
||||
session.id,
|
||||
session.name,
|
||||
channel,
|
||||
);
|
||||
},
|
||||
});
|
||||
}
|
|
@ -21,6 +21,8 @@ import {
|
|||
inspectExtensionSetting,
|
||||
} from './utils/settings';
|
||||
import { redact } from './telemetry/filter';
|
||||
import { hookDecorators } from './utils/editor';
|
||||
import { setupDebugging } from './dap/config';
|
||||
|
||||
export const BakeBuildCommandId = 'dockerLspClient.bake.build';
|
||||
export const ScoutImageScanCommandId = 'docker.scout.imageScan';
|
||||
|
@ -89,7 +91,7 @@ function registerCommands(ctx: vscode.ExtensionContext) {
|
|||
});
|
||||
}
|
||||
|
||||
function registerCommand(
|
||||
export function registerCommand(
|
||||
ctx: vscode.ExtensionContext,
|
||||
id: string,
|
||||
commandCallback: (...args: any[]) => Promise<boolean>,
|
||||
|
@ -152,6 +154,8 @@ async function toggleComposeLanguageServerSetting(): Promise<string> {
|
|||
}
|
||||
|
||||
export async function activate(ctx: vscode.ExtensionContext) {
|
||||
setupDebugging(ctx);
|
||||
hookDecorators(ctx);
|
||||
const composeSetting = await toggleComposeLanguageServerSetting();
|
||||
extensionVersion = String(ctx.extension.packageJSON.version);
|
||||
Bugsnag.start({
|
||||
|
|
|
@ -1,64 +0,0 @@
|
|||
import {
|
||||
BottomBarPanel,
|
||||
EditorView,
|
||||
MarkerType,
|
||||
ProblemsView,
|
||||
VSBrowser,
|
||||
} from 'vscode-extension-tester';
|
||||
import * as path from 'path';
|
||||
import { expect } from 'chai';
|
||||
|
||||
describe('Docker Bake', function () {
|
||||
let bottomBar: BottomBarPanel;
|
||||
|
||||
before(async function () {
|
||||
bottomBar = new BottomBarPanel();
|
||||
await bottomBar.toggle(true);
|
||||
});
|
||||
|
||||
after(async function () {
|
||||
await bottomBar.toggle(false);
|
||||
});
|
||||
|
||||
describe('Problems', function () {
|
||||
let view: ProblemsView;
|
||||
|
||||
async function problemsExist(view: ProblemsView) {
|
||||
const markers = await view.getAllVisibleMarkers(MarkerType.Any);
|
||||
return markers.length > 0;
|
||||
}
|
||||
|
||||
before(async function () {
|
||||
this.timeout(30000);
|
||||
|
||||
view = await bottomBar.openProblemsView();
|
||||
|
||||
await VSBrowser.instance.openResources(
|
||||
path.join('test', 'resources', 'docker-bake.hcl'),
|
||||
);
|
||||
|
||||
await view.getDriver().wait(async function () {
|
||||
return await problemsExist(view);
|
||||
}, 15000);
|
||||
});
|
||||
|
||||
after(async function () {
|
||||
await new EditorView().closeAllEditors();
|
||||
});
|
||||
|
||||
it('Bake file has an error about not being able to find an ARG', async function () {
|
||||
const errors = await view.getAllVisibleMarkers(MarkerType.Error);
|
||||
expect(errors.length).equals(1);
|
||||
|
||||
const errorText = await errors[0].getText();
|
||||
expect(errorText).equal(
|
||||
"Error: 'var' not defined as an ARG in your Dockerfile at line 3 and character 9. generated by Docker DX (docker-language-server)",
|
||||
);
|
||||
});
|
||||
|
||||
it('Bake file has no warnings', async function () {
|
||||
const warnings = await view.getAllVisibleMarkers(MarkerType.Warning);
|
||||
expect(warnings).is.empty;
|
||||
});
|
||||
});
|
||||
});
|
|
@ -10,12 +10,21 @@ import * as fs from 'fs';
|
|||
import * as path from 'path';
|
||||
import { expect } from 'chai';
|
||||
|
||||
describe('Dockerfile', function () {
|
||||
async function problemsExist(view: ProblemsView) {
|
||||
const markers = await view.getAllVisibleMarkers(MarkerType.Any);
|
||||
return markers.length > 0;
|
||||
}
|
||||
|
||||
describe('Problems', function () {
|
||||
let bottomBar: BottomBarPanel;
|
||||
let view: ProblemsView;
|
||||
|
||||
before(async function () {
|
||||
this.timeout(30000);
|
||||
bottomBar = new BottomBarPanel();
|
||||
await bottomBar.toggle(true);
|
||||
|
||||
view = await bottomBar.openProblemsView();
|
||||
});
|
||||
|
||||
after(async function () {
|
||||
|
@ -24,18 +33,11 @@ describe('Dockerfile', function () {
|
|||
|
||||
describe('Problems', function () {
|
||||
let editorView: EditorView;
|
||||
let view: ProblemsView;
|
||||
|
||||
async function problemsExist(view: ProblemsView) {
|
||||
const markers = await view.getAllVisibleMarkers(MarkerType.Any);
|
||||
return markers.length > 0;
|
||||
}
|
||||
|
||||
before(async function () {
|
||||
this.timeout(30000);
|
||||
|
||||
editorView = new EditorView();
|
||||
view = await bottomBar.openProblemsView();
|
||||
|
||||
const dockerfilePath = path.join('test', 'resources', 'Dockerfile');
|
||||
fs.writeFileSync(dockerfilePath, 'FROM scratch\nENTRYPOINT ""\n');
|
||||
|
@ -92,4 +94,37 @@ describe('Dockerfile', function () {
|
|||
await editor.save();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Docker Bake', function () {
|
||||
before(async function () {
|
||||
this.timeout(30000);
|
||||
|
||||
await VSBrowser.instance.openResources(
|
||||
path.join('test', 'resources', 'docker-bake.hcl'),
|
||||
);
|
||||
|
||||
await view.getDriver().wait(async function () {
|
||||
return await problemsExist(view);
|
||||
}, 15000);
|
||||
});
|
||||
|
||||
after(async function () {
|
||||
await new EditorView().closeAllEditors();
|
||||
});
|
||||
|
||||
it('Bake file has an error about not being able to find an ARG', async function () {
|
||||
const errors = await view.getAllVisibleMarkers(MarkerType.Error);
|
||||
expect(errors.length).equals(1);
|
||||
|
||||
const errorText = await errors[0].getText();
|
||||
expect(errorText).equal(
|
||||
"Error: 'var' not defined as an ARG in your Dockerfile at line 3 and character 9. generated by Docker DX (docker-language-server)",
|
||||
);
|
||||
});
|
||||
|
||||
it('Bake file has no warnings', async function () {
|
||||
const warnings = await view.getAllVisibleMarkers(MarkerType.Warning);
|
||||
expect(warnings).is.empty;
|
||||
});
|
||||
});
|
||||
});
|
|
@ -0,0 +1,82 @@
|
|||
import * as vscode from 'vscode';
|
||||
import { DockerfileParser } from 'dockerfile-ast';
|
||||
|
||||
/**
|
||||
* Decoration that inserts a horizontal line into the editor.
|
||||
*/
|
||||
const decoration = vscode.window.createTextEditorDecorationType({
|
||||
isWholeLine: true,
|
||||
borderWidth: '1px 0 0 0',
|
||||
borderStyle: 'solid',
|
||||
borderColor: new vscode.ThemeColor('panelTitle.activeBorder'),
|
||||
});
|
||||
|
||||
function getDecorationRanges(document: vscode.TextDocument): vscode.Range[] {
|
||||
if (
|
||||
vscode.workspace
|
||||
.getConfiguration('docker.extension.editor', document)
|
||||
.get<boolean>('dockerfileBuildStageDecorationLines') &&
|
||||
document.languageId === 'dockerfile' &&
|
||||
document.uri.scheme === 'file'
|
||||
) {
|
||||
const dockerfile = DockerfileParser.parse(document.getText());
|
||||
return dockerfile.getFROMs().map((from) => {
|
||||
const line = from.getRange().start.line;
|
||||
return new vscode.Range(line, 0, line, 0);
|
||||
});
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
export function hookDecorators(ctx: vscode.ExtensionContext): void {
|
||||
vscode.workspace.onDidChangeConfiguration(
|
||||
(event) => {
|
||||
if (
|
||||
event.affectsConfiguration(
|
||||
'docker.extension.editor.dockerfileBuildStageDecorationLines',
|
||||
)
|
||||
) {
|
||||
vscode.window.visibleTextEditors.forEach((editor) =>
|
||||
editor.setDecorations(
|
||||
decoration,
|
||||
getDecorationRanges(editor.document),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
null,
|
||||
ctx.subscriptions,
|
||||
);
|
||||
|
||||
vscode.window.visibleTextEditors.forEach((editor) =>
|
||||
editor.setDecorations(decoration, getDecorationRanges(editor.document)),
|
||||
);
|
||||
|
||||
vscode.window.onDidChangeVisibleTextEditors(
|
||||
(editors) => {
|
||||
for (const editor of editors) {
|
||||
editor.setDecorations(decoration, getDecorationRanges(editor.document));
|
||||
}
|
||||
},
|
||||
null,
|
||||
ctx.subscriptions,
|
||||
);
|
||||
|
||||
vscode.workspace.onDidChangeTextDocument(
|
||||
(event) => {
|
||||
for (const editor of vscode.window.visibleTextEditors) {
|
||||
if (
|
||||
event.document.uri.scheme === editor.document.uri.scheme &&
|
||||
event.document.uri.path === editor.document.uri.path
|
||||
) {
|
||||
editor.setDecorations(
|
||||
decoration,
|
||||
getDecorationRanges(editor.document),
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
null,
|
||||
ctx.subscriptions,
|
||||
);
|
||||
}
|
|
@ -18,6 +18,11 @@ import {
|
|||
export class DockerLanguageClient extends LanguageClient {
|
||||
protected fillInitializeParams(params: InitializeParams): void {
|
||||
super.fillInitializeParams(params);
|
||||
const removeOverlappingIssues =
|
||||
vscode.extensions.getExtension('ms-azuretools.vscode-docker') !==
|
||||
undefined ||
|
||||
vscode.extensions.getExtension('ms-azuretools.vscode-containers') !==
|
||||
undefined;
|
||||
const dockerConfiguration = vscode.workspace.getConfiguration('docker.lsp');
|
||||
const extensionConfiguration =
|
||||
vscode.workspace.getConfiguration('docker.extension');
|
||||
|
@ -27,9 +32,7 @@ export class DockerLanguageClient extends LanguageClient {
|
|||
'enableComposeLanguageServer',
|
||||
),
|
||||
},
|
||||
dockerfileExperimental: {
|
||||
removeOverlappingIssues: true,
|
||||
},
|
||||
dockerfileExperimental: { removeOverlappingIssues },
|
||||
telemetry: getTelemetryValue(dockerConfiguration.get('telemetry')),
|
||||
};
|
||||
params.capabilities.experimental = {
|
||||
|
|
|
@ -207,7 +207,6 @@ async function createNative(ctx: vscode.ExtensionContext): Promise<boolean> {
|
|||
const clientOptions: LanguageClientOptions = {
|
||||
progressOnInitialization: true,
|
||||
outputChannel: vscode.window.createOutputChannel('Docker Language Server'),
|
||||
revealOutputChannelOn: RevealOutputChannelOn.Never,
|
||||
markdown: {
|
||||
isTrusted: false,
|
||||
supportHtml: true,
|
||||
|
@ -253,9 +252,63 @@ async function createNative(ctx: vscode.ExtensionContext): Promise<boolean> {
|
|||
return true;
|
||||
}
|
||||
|
||||
async function startDockerfileLanguageServer(
|
||||
ctx: vscode.ExtensionContext,
|
||||
): Promise<void> {
|
||||
const serverModule = ctx.asAbsolutePath(
|
||||
path.join('dist', 'dockerfile-language-server-nodejs', 'lib', 'server.js'),
|
||||
);
|
||||
const serverOptions: ServerOptions = {
|
||||
run: { module: serverModule, transport: TransportKind.ipc },
|
||||
debug: {
|
||||
module: serverModule,
|
||||
transport: TransportKind.ipc,
|
||||
options: { execArgv: ['--nolazy', '--inspect=6009'] },
|
||||
},
|
||||
};
|
||||
|
||||
const dockerfileLanguageClient = new LanguageClient(
|
||||
'dockerfile-language-server',
|
||||
'Dockerfile Language Server',
|
||||
serverOptions,
|
||||
{
|
||||
documentSelector: [{ language: 'dockerfile', scheme: 'file' }],
|
||||
middleware: {
|
||||
handleDiagnostics() {
|
||||
// leave all error reporting to the Docker Language Server
|
||||
return [];
|
||||
},
|
||||
workspace: {
|
||||
configuration: (params) => {
|
||||
return params.items.map((value) => {
|
||||
if (value.section === 'docker.languageserver.formatter') {
|
||||
return { ignoreMultilineInstructions: true };
|
||||
}
|
||||
return {};
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
);
|
||||
dockerfileLanguageClient.registerProposedFeatures();
|
||||
|
||||
await dockerfileLanguageClient.start();
|
||||
ctx.subscriptions.push(dockerfileLanguageClient);
|
||||
}
|
||||
|
||||
export async function activateDockerNativeLanguageClient(
|
||||
ctx: vscode.ExtensionContext,
|
||||
): Promise<boolean> {
|
||||
if (
|
||||
vscode.extensions.getExtension('ms-azuretools.vscode-docker') ===
|
||||
undefined &&
|
||||
vscode.extensions.getExtension('ms-azuretools.vscode-containers') ===
|
||||
undefined
|
||||
) {
|
||||
// start the Dockerfile Language Server if Microsoft's extensions are not installed
|
||||
await startDockerfileLanguageServer(ctx);
|
||||
}
|
||||
if (await createNative(ctx)) {
|
||||
registerSettingsToggleCodeActions();
|
||||
ctx.subscriptions.push(nativeClient);
|
||||
|
|
|
@ -2,7 +2,8 @@ import * as vscode from 'vscode';
|
|||
|
||||
type DockerExtensionSettings =
|
||||
| 'dockerEngineAvailabilityPrompt'
|
||||
| 'enableComposeLanguageServer';
|
||||
| 'enableComposeLanguageServer'
|
||||
| 'enableBuildDebugging';
|
||||
|
||||
/**
|
||||
* Retrieves the value of a specified setting from the Docker extension's configuration.
|
||||
|
@ -10,9 +11,8 @@ type DockerExtensionSettings =
|
|||
* @param setting - The name of the setting to retrieve.
|
||||
* @returns The value of the specified setting, or `undefined` if the setting is not found.
|
||||
*/
|
||||
|
||||
export function getExtensionSetting(setting: DockerExtensionSettings) {
|
||||
return vscode.workspace.getConfiguration('docker.extension').get(setting);
|
||||
export function getExtensionSetting<T>(setting: DockerExtensionSettings) {
|
||||
return vscode.workspace.getConfiguration('docker.extension').get<T>(setting);
|
||||
}
|
||||
|
||||
export function inspectExtensionSetting(setting: DockerExtensionSettings) {
|
||||
|
|
|
@ -3,5 +3,6 @@
|
|||
"git.autoRepositoryDetection": false,
|
||||
"telemetry.telemetryLevel": "off",
|
||||
"workbench.editor.enablePreview": false,
|
||||
"workbench.secondarySideBar.defaultVisibility": "hidden",
|
||||
"workbench.startupEditor": "none"
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
ARG FOO="init"
|
||||
ARG AAA="init"
|
||||
|
||||
FROM busybox AS build1
|
||||
RUN echo hello > /hello
|
||||
|
||||
FROM busybox AS build2
|
||||
ARG FOO
|
||||
ARG AAA
|
||||
RUN echo hi > /hi && cat /fail
|
||||
|
||||
FROM scratch
|
||||
COPY --from=build1 /hello /
|
||||
RUN cat fail > /
|
||||
COPY --from=build2 /hi /
|
|
@ -12,11 +12,15 @@ const extensionConfig = {
|
|||
target: 'node', // VS Code extensions run in a Node.js-context 📖 -> https://webpack.js.org/configuration/node/
|
||||
mode: 'none', // this leaves the source code as close as possible to the original (when packaging we set this to 'production')
|
||||
|
||||
entry: './src/extension.ts', // the entry point of this extension, 📖 -> https://webpack.js.org/configuration/entry-context/
|
||||
entry: {
|
||||
'./extension': './src/extension.ts',
|
||||
'./dockerfile-language-server-nodejs/lib/server':
|
||||
'./node_modules/dockerfile-language-server-nodejs/lib/server.js',
|
||||
}, // the entry point of this extension, 📖 -> https://webpack.js.org/configuration/entry-context/
|
||||
output: {
|
||||
// the bundle is stored in the 'dist' folder (check package.json), 📖 -> https://webpack.js.org/configuration/output/
|
||||
path: path.resolve(__dirname, 'dist'),
|
||||
filename: 'extension.js',
|
||||
filename: '[name].js',
|
||||
libraryTarget: 'commonjs2',
|
||||
},
|
||||
stats: {
|
||||
|
@ -47,6 +51,11 @@ const extensionConfig = {
|
|||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
// Unpack UMD module headers used in some modules since webpack doesn't handle them.
|
||||
test: /dockerfile-language-service|vscode-languageserver-types/,
|
||||
use: { loader: 'umd-compat-loader' },
|
||||
},
|
||||
],
|
||||
},
|
||||
devtool: 'nosources-source-map',
|
||||
|
|