From ea6168c304f1be9d3f7a78c23d33930438c50a49 Mon Sep 17 00:00:00 2001 From: Paul Cody Johnston Date: Thu, 2 Dec 2021 00:20:44 +0000 Subject: [PATCH] Onboarding improvements (#88) * Fix findWorkspaceFolder Previously this could yield surprising results depending on where the original vscode windows was opened from. * Disable cache by default (factory setting) This will require users opt-in to the feature. * Bump to 1.8.0 * Bump bzl to 1.3.3 * Update CHANGELOG * Improve view activation Also better onboarding notes --- CHANGELOG.md | 7 +++++++ package.json | 13 ++++++------- src/bezel/configuration.ts | 2 +- src/bezel/feature.ts | 11 ++++++++--- src/bezel/workspaceView.ts | 27 ++++++++++++++++----------- 5 files changed, 38 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 78ce33ed..393d1c80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Change Log +## 1.8.0 (Dev 01 2021) + +- Improve authentication from bzl.io. +- Enable advanced LSP features (via bump bzl 1.3.3). +- Disable remote cache by default (requires opt-in enable flag). +- Fix findWorkspaceFolder. + ## 1.7.0 (Nov 27 2021) - Bump bzl to 1.2.14 (windows path fixes) diff --git a/package.json b/package.json index a58aefba..5c0f8af1 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "bazel-stack-vscode", "displayName": "bazel-stack-vscode", "description": "Bazel Support for Visual Studio Code", - "version": "1.7.0", + "version": "1.8.0", "publisher": "StackBuild", "license": "Apache-2.0", "icon": "stackb-full.png", @@ -234,7 +234,7 @@ }, "bsv.bzl.server.release": { "type": "string", - "default": "v1.2.14", + "default": "v1.3.3", "description": "Bzl release version" }, "bsv.bzl.server.command": { @@ -337,7 +337,7 @@ "bsv.bzl.remoteCache.enabled": { "type": "boolean", "description": "If false, disable the Remote Cache component", - "default": true + "default": false }, "bsv.bzl.remoteCache.autoLaunch": { "type": "boolean", @@ -659,10 +659,9 @@ "bazel-explorer": [ { "id": "bsv.workspace", - "name": "Stack VSCode v1.7.0", + "name": "Stack VSCode v1.8.0", "icon": "media/bazel-wireframe.svg", - "contextualTitle": "Current Bazel Workspace", - "when": "resourceLangId == bazel" + "contextualTitle": "Current Bazel Workspace" } ] }, @@ -821,4 +820,4 @@ "tabWidth": 2, "arrowParens": "avoid" } -} +} \ No newline at end of file diff --git a/src/bezel/configuration.ts b/src/bezel/configuration.ts index 97d69793..8548242f 100644 --- a/src/bezel/configuration.ts +++ b/src/bezel/configuration.ts @@ -253,7 +253,7 @@ export class BzlSettings extends Settings { enabled: config.get('enabled', true), autoLaunch: config.get('autoLaunch', true), downloadBaseURL: config.get('downloadBaseUrl', 'https://get.bzl.io'), - release: config.get('release', 'v1.2.14'), + release: config.get('release', 'v1.3.3'), executable: normalize(config.get('executable', '')), address: address, command: config.get('command', ['serve', '--address=${address}']), diff --git a/src/bezel/feature.ts b/src/bezel/feature.ts index 63848c07..4f5611a1 100644 --- a/src/bezel/feature.ts +++ b/src/bezel/feature.ts @@ -37,8 +37,9 @@ import { Buildozer } from '../buildozer/buildozer'; export const BzlFeatureName = 'bsv.bzl'; -function findWorkspaceFolder(): vscode.Uri | undefined { +function findWorkspaceFolder(cwd: string): vscode.Uri | undefined { const workspace = findUp.sync(['WORKSPACE', 'WORKSPACE.bazel'], { + cwd: cwd, }); if (workspace) { return vscode.Uri.file(path.dirname(workspace)); @@ -65,7 +66,11 @@ export class BzlFeature implements vscode.Disposable { private readonly invocations: Invocations | undefined; constructor(private api: API, ctx: vscode.ExtensionContext, private configCtx: ConfigurationContext) { - const workspaceFolder = findWorkspaceFolder(); + let cwd = "." + if (vscode.workspace.workspaceFolders?.length) { + cwd = vscode.workspace.workspaceFolders[0].uri.fsPath; + } + const workspaceFolder = findWorkspaceFolder(cwd); // ======= Commands ========= @@ -205,7 +210,7 @@ export class BzlFeature implements vscode.Disposable { async handleCommandSignIn(): Promise { vscode.commands.executeCommand( BuiltInCommands.Open, - vscode.Uri.parse('https://bzl.io/bezel/install') + vscode.Uri.parse('https://bzl.io/@') ); } diff --git a/src/bezel/workspaceView.ts b/src/bezel/workspaceView.ts index d4e2de25..ea9d1fff 100644 --- a/src/bezel/workspaceView.ts +++ b/src/bezel/workspaceView.ts @@ -248,11 +248,6 @@ export abstract class RunnableComponentItem return items; } - if (this.component.status === Status.DISABLED) { - items.push(new DisabledItem(this.component.statusErrorMessage || 'Unknown')); - return items; - } - return items.concat(await this.getChildrenInternal()); } @@ -391,10 +386,20 @@ class SubscriptionItem const items: vscode.TreeItem[] = []; if (this.component.status === Status.DISABLED) { - items.push(new DisabledItem('The subscription token is not set. Login to get started.')); + items.push(new DisabledItem('Subscription token not available.')); + items.push( + new MarkdownItem( + "Sign up to enable additional hover documentation, autocompletion, and other features." + ) + ); + items.push( + new MarkdownItem( + "Using this at work? Encourage your employer to support developer productivity." + ) + ); items.push( new MarkdownItem( - "Your support assists in improving the Bazel Ecosystem. If you're using this at work, please encourage your employer to contribute. If unsatisfied for any reason send an email to hello@stack.build and we'll take care of it :)" + "Contact hello@stack.build for organizational onboarding." ) ); items.push( @@ -404,7 +409,7 @@ class SubscriptionItem [ '### Subscription Token', '', - 'The subscription token is a JWT that has your subscription details encoded inside. When the extension loads it tries to find it on one of the following locations:', + 'The subscription token is a JWT that encodes your subscription details. The extension will search the following locations for the token:', '', '1. The setting `bsv.bzl.subscription.token`', '2. The file `~/.bzl/license.key`.', @@ -435,7 +440,7 @@ class SubscriptionItem `${license.subscriptionName}`, 'Name of the subscription you are registered under' ), - new LicenseItem('Expiration', `${exp.toISODate()}`, 'Expiration date of this license') + new LicenseItem('Renews', `${exp.toISODate()}`, 'Expiration date of this license') ); } } @@ -939,10 +944,10 @@ export class LicenseItem extends vscode.TreeItem { export class MarkdownItem extends vscode.TreeItem { constructor(description: string, markdown?: vscode.MarkdownString) { - super('Note'); + super(''); this.description = description; this.tooltip = markdown || description; - this.iconPath = new vscode.ThemeIcon('squirrel'); + this.iconPath = new vscode.ThemeIcon('debug-hint'); } }