diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index e5ae9a3eb..1b44a874f 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -7,7 +7,7 @@ on: workflow_dispatch: inputs: langserver: - description: "The terraform-ls version to use. If not specified will use version in package.json" + description: 'The terraform-ls version to use. If not specified will use version in package.json' required: false type: string @@ -44,32 +44,32 @@ jobs: - vsce_target: darwin-arm64 ls_target: darwin_arm64 npm_config_arch: arm64 - runs-on: "ubuntu-latest" + runs-on: 'ubuntu-latest' steps: - name: Check out repository uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # https://github.com/actions/checkout/releases/tag/v3.5.2 - name: Set preview in package.json id: set-preview run: | - ./build/preview + ./build/preview.sh env: LANGUAGE_SERVER_VERSION: ${{ github.event.inputs.langserver }} - name: Setup Node uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # https://github.com/actions/setup-node/releases/tag/v3.6.0 with: - node-version-file: ".nvmrc" + node-version-file: '.nvmrc' - name: Install dependencies run: npm ci env: npm_config_arch: ${{ matrix.npm_config_arch }} ls_target: ${{ matrix.ls_target }} - name: Package VSIX - run: npm run package -- --target=${{ matrix.vsce_target }} + run: npm run package -- --pre-release --target=${{ matrix.vsce_target }} - name: Upload vsix as artifact uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # https://github.com/actions/upload-artifact/releases/tag/v3.1.2 with: name: ${{ matrix.vsce_target }} - path: "*.vsix" + path: '*.vsix' - name: Check latest published version shell: bash run: | @@ -84,6 +84,6 @@ jobs: steps: - uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # https://github.com/actions/download-artifact/releases/tag/v3.0.2 - name: Publish Preview Extension - run: npx vsce publish --no-git-tag-version --packagePath $(find . -iname *.vsix) + run: npx vsce publish --pre-release --no-git-tag-version --packagePath $(find . -iname *.vsix) env: VSCE_PAT: ${{ secrets.VSCE_PAT }} diff --git a/assets/icons/terraform_logo_mark_dark_universal.png b/assets/icons/terraform_logo_mark_dark_universal.png deleted file mode 100644 index 812d70ca5..000000000 Binary files a/assets/icons/terraform_logo_mark_dark_universal.png and /dev/null differ diff --git a/build/nightly.md b/build/nightly.md deleted file mode 100644 index 3e5b1ad1b..000000000 --- a/build/nightly.md +++ /dev/null @@ -1,13 +0,0 @@ -# Terraform Preview Visual Studio Code Extension - -> ### **ATTENTION: This is the *preview* version of the [VS Code Terraform extension](https://github.com/golang/vscode-terraform), used for early feedback and testing.** -> It is contains previews of new features and bug fixes that are still under review or test. Therefore, this extension can be broken or unstable at times. If you are looking for the stable version, -please install [the default VS Code Terraform extension](https://marketplace.visualstudio.com/items?itemName=hashicorp.terraform) instead. -> -> **NOTE: The stable Terraform extension (`hashicorp.terraform`) cannot be used at the same time as the Terraform Preview extension (`hashicorp.terraform-preview`)**. If you have installed both extensions, you **must disable or uninstall** one of them. For further guidance, read the [documentation on how to disable an extension](https://code.visualstudio.com/docs/editor/extension-gallery#_disable-an-extension). - -> ### **Differences between Terraform and Terraform Preview** -> -> * Terraform Preview is released more frequently than the stable version. -> * Terraform Preview includes features and bug fixes that are not yet finalized. -> * Terraform Preview may use pre-release versions of tools (such as `terraform-ls`) instead of released versions. diff --git a/build/preview b/build/preview deleted file mode 100755 index 8e88e9e3a..000000000 --- a/build/preview +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - -set -eEuo pipefail - -SCRIPT_RELATIVE_DIR=$(dirname "${BASH_SOURCE[0]}") -ROOT_RELATIVE_DIR=$(dirname "${SCRIPT_RELATIVE_DIR}") - -cd $ROOT_RELATIVE_DIR - -# get current version info -VERSION=`git log -1 --format=%cd --date="format:%Y.%-m.%-d%H"` -if [ -z "${LANGUAGE_SERVER_VERSION:-}" ]; then - LANGUAGE_SERVER_VERSION="$(jq -r .langServer.version package.json)" -fi - -# Get existing name & description -DISPLAY_NAME="$(jq -r .displayName package.json) (Preview)" -DESCRIPTION="$(jq -r .description package.json) (Preview)" - -# set preview info in package.json -(cat package.json | jq --arg VER $VERSION --arg LANGVER $LANGUAGE_SERVER_VERSION --arg NAME "$DISPLAY_NAME" --arg DESC "$DESCRIPTION" ' -.version=$VER | -.langServer.version=$LANGVER | -.preview=true | -.name="terraform-preview" | -.icon="assets/icons/terraform_logo_mark_dark_universal.png" | -.displayName=$NAME | -.description=$DESC -') > /tmp/package.json && mv /tmp/package.json package.json - -# prepend preview info to README.md -sed '/^# Terraform Extension for Visual Studio Code$/d' README.md | cat build/nightly.md - > /tmp/rdme && mv /tmp/rdme README.md diff --git a/build/preview.sh b/build/preview.sh new file mode 100755 index 000000000..8f9ef55c0 --- /dev/null +++ b/build/preview.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: MPL-2.0 + +set -eEuo pipefail + +SCRIPT_RELATIVE_DIR=$(dirname "${BASH_SOURCE[0]}") +ROOT_RELATIVE_DIR=$(dirname "${SCRIPT_RELATIVE_DIR}") + +cd $ROOT_RELATIVE_DIR + +# Get current version info +VERSION=$(cat package.json | jq -r '.version') # e.g. 2.26.0 +MAJOR=$(echo $VERSION | cut -d. -f1) +MINOR=$(echo $VERSION | cut -d. -f2) +# Build new version +# +# For the pre-release build, we keep the major and minor versions +# and add the timestamp of the last commit as a patch. +NEW_PATCH=`git log -1 --format=%cd --date="format:%Y%m%d%H"` # e.g. 2023050312 +VER="$MAJOR.$MINOR.$NEW_PATCH" + +# Update the language server version if passed via the workflow +if [ -z "${LANGUAGE_SERVER_VERSION:-}" ]; then + LANGUAGE_SERVER_VERSION="$(jq -r .langServer.version package.json)" +fi + +# Update versions in package.json +(cat package.json | jq --arg VER $VER --arg LANGVER $LANGUAGE_SERVER_VERSION ' +.version=$VER | +.langServer.version=$LANGVER +') > /tmp/package.json && mv /tmp/package.json package.json diff --git a/package.json b/package.json index 3b1ee1b55..747ecf365 100644 --- a/package.json +++ b/package.json @@ -669,8 +669,7 @@ "lint": "eslint src --ext ts", "prettier": "prettier \"**/*.+(js|json|ts)\"", "format": "npm run prettier -- --write", - "check-format": "npm run prettier -- --check", - "preview": "ts-node ./build/preview.ts" + "check-format": "npm run prettier -- --check" }, "dependencies": { "@vscode/extension-telemetry": "^0.4.9", diff --git a/src/extension.ts b/src/extension.ts index f1cbf8049..6f1adfa53 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -28,7 +28,7 @@ import { ShowReferencesFeature } from './features/showReferences'; import { CustomSemanticTokens } from './features/semanticTokens'; import { ModuleProvidersFeature } from './features/moduleProviders'; import { ModuleCallsFeature } from './features/moduleCalls'; -import { getInitializationOptions, migrateLegacySettings, previewExtensionPresent } from './settings'; +import { getInitializationOptions, migrateLegacySettings } from './settings'; import { TerraformLSCommands } from './commands/terraformls'; import { TerraformCommands } from './commands/terraform'; import { TerraformVersionFeature } from './features/terraformVersion'; @@ -51,11 +51,6 @@ export async function activate(context: vscode.ExtensionContext): Promise reporter = new TelemetryReporter(context.extension.id, manifest.version, manifest.appInsightsKey); context.subscriptions.push(reporter); - if (previewExtensionPresent(context.extension.id)) { - reporter.sendTelemetryEvent('previewExtensionPresentWithStable'); - return undefined; - } - await migrateLegacySettings(context); // always register commands needed to control terraform-ls diff --git a/src/settings.ts b/src/settings.ts index 42d90f842..853e95a02 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -157,24 +157,3 @@ export async function migrateLegacySettings(ctx: vscode.ExtensionContext) { await deleteSetting('terraform-ls', 'experimentalFeatures'); await vscode.commands.executeCommand('workbench.action.reloadWindow'); } - -export function previewExtensionPresent(currentExtensionID: string) { - const stable = vscode.extensions.getExtension('hashicorp.terraform'); - const preview = vscode.extensions.getExtension('hashicorp.terraform-preview'); - - const msg = 'Please ensure only one is enabled or installed and reload this window'; - - if (currentExtensionID === 'hashicorp.terraform-preview') { - if (stable !== undefined) { - vscode.window.showErrorMessage('Terraform Preview cannot be used while Terraform Stable is also enabled.' + msg); - return true; - } - } else if (currentExtensionID === 'hashicorp.terraform') { - if (preview !== undefined) { - vscode.window.showErrorMessage('Terraform Stable cannot be used while Terraform Preview is also enabled.' + msg); - return true; - } - } - - return false; -}