Skip to content

Commit

Permalink
Onboarding improvements (#88)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
pcj authored Dec 2, 2021
1 parent e3af2e8 commit ea6168c
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 22 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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"
}
]
},
Expand Down Expand Up @@ -821,4 +820,4 @@
"tabWidth": 2,
"arrowParens": "avoid"
}
}
}
2 changes: 1 addition & 1 deletion src/bezel/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ export class BzlSettings extends Settings<BzlConfiguration> {
enabled: config.get<boolean>('enabled', true),
autoLaunch: config.get<boolean>('autoLaunch', true),
downloadBaseURL: config.get<string>('downloadBaseUrl', 'https://get.bzl.io'),
release: config.get<string>('release', 'v1.2.14'),
release: config.get<string>('release', 'v1.3.3'),
executable: normalize(config.get<string>('executable', '')),
address: address,
command: config.get<string[]>('command', ['serve', '--address=${address}']),
Expand Down
11 changes: 8 additions & 3 deletions src/bezel/feature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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 =========

Expand Down Expand Up @@ -205,7 +210,7 @@ export class BzlFeature implements vscode.Disposable {
async handleCommandSignIn(): Promise<void> {
vscode.commands.executeCommand(
BuiltInCommands.Open,
vscode.Uri.parse('https://bzl.io/bezel/install')
vscode.Uri.parse('https://bzl.io/@')
);
}

Expand Down
27 changes: 16 additions & 11 deletions src/bezel/workspaceView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,6 @@ export abstract class RunnableComponentItem<T extends ComponentConfiguration>
return items;
}

if (this.component.status === Status.DISABLED) {
items.push(new DisabledItem(this.component.statusErrorMessage || 'Unknown'));
return items;
}

return items.concat(await this.getChildrenInternal());
}

Expand Down Expand Up @@ -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 [email protected] and we'll take care of it :)"
"Contact [email protected] for organizational onboarding."
)
);
items.push(
Expand All @@ -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`.',
Expand Down Expand Up @@ -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')
);
}
}
Expand Down Expand Up @@ -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');
}
}

Expand Down

0 comments on commit ea6168c

Please sign in to comment.