Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## [1.0.4] - 2023-05-26
### Added
- Alphabetized ZK nodes in explorer
- Default language setting for nodes without extension
- Default ZK host configured on startup

## [1.0.3] - 2022-03-19
### Fixed
- command title in extensiton manage page
Expand Down
31 changes: 28 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,40 @@ Visually manage your ZooKeeper in Visual Studio Code.

## Extension Settings

When using Visual ZooKeeper for the first time, you need to configure the server address of zk, you can click the button or use the command palette to call out the configuration page.
- `visualZooKeeper.zooKeeperServer`, default ``
- `visualZooKeeper.nodeLanguage`, default `yaml`

![config](screenshots/6-config.png)

## Commands

- `visualZooKeeper.editNode`
- `visualZooKeeper.refreshNode`
- `visualZooKeeper.configureServer`
- `visualZooKeeper.addNode`
- `visualZooKeeper.viewNodeStat`
- `visualZooKeeper.copyPath`

## Development

Follow the vscode extension documentation: https://code.visualstudio.com/api/get-started/your-first-extension

- Install node.js and Git
- `npm install -g yo generator-code`
- `npm install -g yarn`
- `yarn` to install the project dependencies
- Use vsce to build the .vsix file for installation https://code.visualstudio.com/api/working-with-extensions/publishing-extension
- `npm install -g @vscode/vsce`
- Build with `vsce package`

## Known Issues

## Release Notes

### 1.0.4

- Alphabetized ZK nodes in explorer
- Default language setting for nodes without extension
- Default ZK host configured on startup

### 1.0.0

Initial release of Visual ZooKeeper
27 changes: 23 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@
"displayName": "Visual ZooKeeper",
"publisher": "gaoliang",
"description": "Visually manage your ZooKeeper in Visual Studio Code.",
"version": "1.0.3",
"version": "1.0.4",
"repository": "https://github.com/gaoliang/visual-zookeeper",
"license": "SEE LICENSE IN LICENSE",
"icon": "media/zk-logo.png",
"categories": ["Visualization", "Other"],
"keywords": ["zookeeper"],
"categories": [
"Visualization",
"Other"
],
"keywords": [
"zookeeper"
],
"engines": {
"vscode": "^1.65.0"
},
Expand All @@ -31,6 +36,20 @@
}
]
},
"configuration": {
"title": "Visual ZooKeeper",
"properties": {
"visualZooKeeper.zooKeeperServer": {
"type": "string",
"description": "Comma separated host:port pairs, each represents a ZooKeeper server."
},
"visualZooKeeper.nodeLanguage": {
"type": "string",
"default": "plaintext",
"description": "Default language mode used to edit ZK nodes without an extension"
}
}
},
"commands": [
{
"command": "visualZooKeeper.editNode",
Expand Down Expand Up @@ -87,7 +106,7 @@
{
"command": "visualZooKeeper.copyPath",
"when": "view == visualZooKeeper && viewItem == zkNode"
}
}
],
"view/title": [
{
Expand Down
1 change: 1 addition & 0 deletions src/ZkClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export const getChildren = (parent?: ZkNode): Promise<ZkNode[]> => {
if (error) {
reject(error);
}
children.sort();
resolve(children.map(child => {
return new ZkNode(
child, '',
Expand Down
29 changes: 22 additions & 7 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export function activate(context: vscode.ExtensionContext) {
zkStatProvider.onDidChangeEmitter.fire(uri);
const doc = await vscode.workspace.openTextDocument(uri); // calls back into the provider
await vscode.window.showTextDocument(doc, { preview: false });

} else {
vscode.window.showInformationMessage('[Visual ZooKeeper] node path is empty');
}
Expand All @@ -55,14 +56,15 @@ export function activate(context: vscode.ExtensionContext) {
zooKeeperProvider.refresh()
));

context.subscriptions.push(vscode.commands.registerCommand('visualZooKeeper.configureServer', async () => {
let server = await vscode.window.showInputBox({
title: 'Configure ZooKeeper Server',
placeHolder: 'Comma separated host:port pairs,each represents a ZooKeeper server.'
});
if (server) {
zkClient.createClient(server);
context.subscriptions.push(vscode.commands.registerCommand('visualZooKeeper.configureServer', async (server: string) => {
if (!server) {
Comment thread
patricklatimer marked this conversation as resolved.
let input = await vscode.window.showInputBox({
title: 'Configure ZooKeeper Server',
placeHolder: 'Comma separated host:port pairs,each represents a ZooKeeper server.'
});
if (input) { server = input; };
}
zkClient.createClient(server);
}));


Expand Down Expand Up @@ -120,6 +122,14 @@ export function activate(context: vscode.ExtensionContext) {
let filePath = '/' + path.split("/").join(BIG_SOLIDUS);
const uri = vscode.Uri.parse(zkfsScheme + ':' + filePath);
vscode.commands.executeCommand("vscode.open", uri, {}, path);
const doc = await vscode.workspace.openTextDocument(uri);
await vscode.window.showTextDocument(doc, { preview: false });

if (vscode.window.activeTextEditor?.document.languageId === "plaintext") {
let lang = vscode.workspace.getConfiguration().get("visualZooKeeper.nodeLanguage", "yaml");
await vscode.languages.setTextDocumentLanguage(doc, lang);
}

} else {
vscode.window.showInformationMessage('[Visual ZooKeeper] node path is empty');
}
Expand All @@ -130,6 +140,11 @@ export function activate(context: vscode.ExtensionContext) {
vscode.window.showInformationMessage('[Visual ZooKeeper] Successfully write path to clipboard');
}));

const server = vscode.workspace.getConfiguration().get("visualZooKeeper.zooKeeperServer", false);
if (server) {
console.log("Server is set to " + server);
vscode.commands.executeCommand("visualZooKeeper.configureServer", server);
}
// Use the console to output diagnostic information (console.log) and errors (console.error)
// This line of code will only be executed once when your extension is activated
console.log('Congratulations, your extension "visual-zookeeper" is now active!');
Expand Down