0.10.4: a real Sync button on every Archify page
A labelled Sync button sits top right on every Archify page, also in Source, and opens the Sync menu. On a shared model it turns green and reads Shared. The title-bar icon and the pre-share status bar entry are gone, with their settings.
This commit is contained in:
1 parent
7d2d55543e
commit
90c7be06de
10 files changed
+88
-58
No files matched your search
@@ -27,26 +27,8 @@ const COMMANDS = [
|
||||
*/
|
||||
export function registerSync(context: vscode.ExtensionContext, models: ModelService): vscode.Disposable[] {
|
||||
let feature: Promise<SyncFeature> | undefined;
|
||||
// Until the sync bundle loads, this entry is the way in; then the bundle's own one takes over.
|
||||
const entry = vscode.window.createStatusBarItem('archify.sync', vscode.StatusBarAlignment.Left, 50);
|
||||
entry.name = 'Archify Sync';
|
||||
entry.text = '$(cloud) Archify Sync';
|
||||
entry.tooltip = 'Archify Sync (optional): sign in, share a model with others or join one. Set the server under Settings › Archify › Sync.';
|
||||
entry.command = 'archify.sync.menu';
|
||||
// Only where there are Archify files: the extension also starts for JSON and HTML.
|
||||
let archifyHere = false;
|
||||
const showEntry = () => {
|
||||
const wanted = archifyHere && !feature && vscode.workspace.getConfiguration('archify.sync').get<boolean>('statusBar', true);
|
||||
if (wanted) entry.show();
|
||||
else entry.hide();
|
||||
};
|
||||
void Promise.resolve(vscode.workspace.findFiles('**/*.{archify,archify-registry,archify-decision}', '{**/node_modules/**,**/.git/**}', 1)).then((found) => {
|
||||
archifyHere = found.length > 0;
|
||||
showEntry();
|
||||
});
|
||||
const load = (): Promise<SyncFeature> =>
|
||||
(feature ??= (async () => {
|
||||
showEntry();
|
||||
// A runtime path, so esbuild leaves the sync bundle out of this one.
|
||||
const bundle = path.join(__dirname, 'sync.js');
|
||||
const mod = require(bundle) as typeof import('./index');
|
||||
@@ -63,8 +45,6 @@ export function registerSync(context: vscode.ExtensionContext, models: ModelServ
|
||||
})();
|
||||
|
||||
return [
|
||||
entry,
|
||||
vscode.workspace.onDidChangeConfiguration((e) => e.affectsConfiguration('archify.sync.statusBar') && showEntry()),
|
||||
liveBridge,
|
||||
...COMMANDS.map((id) =>
|
||||
vscode.commands.registerCommand(id, async (...args: unknown[]) => (await load()).run(id, ...args)),
|
||||
|
||||
Reference in new issue
Block a user