Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vscode-zap

Package Overview
Dependencies
Maintainers
8
Versions
107
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vscode-zap - npm Package Compare versions

Comparing version 0.0.81 to 0.0.83

out/src/fileService.d.ts

3

out/src/controller.d.ts

@@ -12,5 +12,6 @@ import { Client, ClientOptions, ServerOptions } from "libzap/lib/remote/client";

private workspace;
private scmProvider;
private toDispose;
private workspaceRevState?;
constructor(serverOptions: ServerOptions, clientOptions: ClientOptions, environment: IEnvironment, initRevState?: any);
constructor(serverOptions: ServerOptions, clientOptions: ClientOptions, environment: IEnvironment, initRevState?: any, webContext?: boolean);
private attach();

@@ -17,0 +18,0 @@ private reset(mergeStrategy);

@@ -22,5 +22,6 @@ "use strict";

const protocol_1 = require("libzap/lib/remote/protocol");
const scm_1 = require("./scm");
const workspace_1 = require("./workspace");
class Controller {
constructor(serverOptions, clientOptions, environment, initRevState) {
constructor(serverOptions, clientOptions, environment, initRevState, webContext) {
this.serverOptions = serverOptions;

@@ -37,2 +38,9 @@ this.clientOptions = clientOptions;

this.workspace = new workspace_1.Workspace(this.environment);
// Only enable the SCM provider on sourcegraph.com.
if (webContext) {
this.scmProvider = new scm_1.ZapSCMProvider();
this.workspace.onGenerateOp(op => this.scmProvider.updateFromOp(op));
this.workspace.onApplyOp(op => this.scmProvider.updateFromOp(op));
this.workspace.onReset(op => this.scmProvider.updateFromOp(op));
}
let initedHooks = false;

@@ -39,0 +47,0 @@ this.client.onDidChangeState((event) => {

import * as vscode from "vscode";
import { Controller } from "./controller";
import { IEnvironment } from "./environment";
export declare function activate(env: IEnvironment, ctx: vscode.ExtensionContext, initRevState?: any): Controller | null;
export declare function activate(env: IEnvironment, ctx: vscode.ExtensionContext, initRevState?: any, webContext?: boolean): Controller | null;
export declare function isEnabled(): boolean;
export declare function startController(controller: Controller): Thenable<void>;
export declare function stopController(controller: Controller): Thenable<void>;

@@ -16,3 +16,3 @@ // This is the extension's shared entrypoint. All platforms call this

const status_1 = require("./status");
function activate(env, ctx, initRevState) {
function activate(env, ctx, initRevState, webContext) {
if (!vscode.workspace.rootPath) {

@@ -22,3 +22,3 @@ return null;

ctx.subscriptions.push(status_1.outputChannel);
const controller = new controller_1.Controller({ connect: () => env.openChannel("zap") }, {}, env, initRevState);
const controller = new controller_1.Controller({ connect: () => env.openChannel("zap") }, {}, env, initRevState, webContext);
ctx.subscriptions.push(controller);

@@ -25,0 +25,0 @@ const statusHandler = new status_1.StatusHandler(controller.client, env);

@@ -9,4 +9,8 @@ import * as vscode from "vscode";

private onOpListener?;
private onOpExtListener?;
private onResetListener?;
private onWillSaveFileListener?;
private _onGenerateOp;
private _onApplyOp;
private _onReset;
private toDispose;

@@ -21,3 +25,5 @@ private ignoreSelectionChange;

onOp(listener?: (op: WorkspaceOp) => void): void;
onReset(listener?: (newOp?: WorkspaceOp) => void): void;
readonly onGenerateOp: vscode.Event<WorkspaceOp>;
readonly onApplyOp: vscode.Event<WorkspaceOp>;
readonly onReset: vscode.Event<WorkspaceOp>;
onWillSaveFile(listener?: (params: WorkspaceWillSaveFileParams) => Thenable<void>): void;

@@ -24,0 +30,0 @@ dispose(): void;

@@ -18,2 +18,5 @@ "use strict";

this.environment = environment;
this._onGenerateOp = new vscode.EventEmitter();
this._onApplyOp = new vscode.EventEmitter();
this._onReset = new vscode.EventEmitter();
this.toDispose = [];

@@ -33,6 +36,12 @@ this.ignoreSelectionChange = new Map();

this.documentIsDirty = new Map();
// Give onOpListener default noop value;
this.onOpListener = op => {
console.log(`WARNING: Op ignored because Workspace.onOpListener is not set: ${workspace_1.toString(op)}`);
if (this.onOpExtListener) {
this.onOpExtListener(op);
}
;
this._onGenerateOp.fire(op);
};
this.onResetListener = op => {
this._onReset.fire(op);
};
this.outputChannel = vscode.window.createOutputChannel("zap controller");

@@ -42,7 +51,13 @@ this.toDispose.push(this.outputChannel);

onOp(listener) {
this.onOpListener = listener;
this.onOpExtListener = listener;
}
onReset(listener) {
this.onResetListener = listener;
get onGenerateOp() {
return this._onGenerateOp.event;
}
get onApplyOp() {
return this._onApplyOp.event;
}
get onReset() {
return this._onReset.event;
}
onWillSaveFile(listener) {

@@ -313,2 +328,3 @@ this.onWillSaveFileListener = listener;

this.applyingOp = undefined;
this._onApplyOp.fire(op);
});

@@ -315,0 +331,0 @@ }

@@ -5,3 +5,3 @@ {

"description": "Real-time code synchronization",
"version": "0.0.81",
"version": "0.0.83",
"publisher": "sqs",

@@ -39,9 +39,10 @@ "preview": true,

"typescript": "^2.1.6",
"vscode": "^1.0.3"
"vscode": "^1.1.0"
},
"dependencies": {
"libzap": "^0.0.81",
"libzap": "^0.0.83",
"open": "^0.0.5",
"vscode-jsonrpc": "3.0.1-alpha.7"
},
"enableProposedApi": true,
"contributes": {

@@ -48,0 +49,0 @@ "configuration": {

@@ -6,2 +6,3 @@ import * as vscode from "vscode";

import { IEnvironment } from "./environment";
import { ZapSCMProvider } from "./scm";
import { Workspace } from "./workspace";

@@ -13,2 +14,3 @@

private workspace: Workspace;
private scmProvider: ZapSCMProvider;
private toDispose: vscode.Disposable[] = [];

@@ -26,2 +28,3 @@ private workspaceRevState?: {

initRevState?: any,
webContext?: boolean,
) {

@@ -36,2 +39,11 @@ this.workspaceRevState = initRevState;

this.workspace = new Workspace(this.environment);
// Only enable the SCM provider on sourcegraph.com.
if (webContext) {
this.scmProvider = new ZapSCMProvider();
this.workspace.onGenerateOp(op => this.scmProvider.updateFromOp(op));
this.workspace.onApplyOp(op => this.scmProvider.updateFromOp(op));
this.workspace.onReset(op => this.scmProvider.updateFromOp(op));
}
let initedHooks = false;

@@ -38,0 +50,0 @@ this.client.onDidChangeState((event: StateChangeEvent) => {

@@ -11,3 +11,3 @@ // This is the extension's shared entrypoint. All platforms call this

export function activate(env: IEnvironment, ctx: vscode.ExtensionContext, initRevState?: any): Controller | null {
export function activate(env: IEnvironment, ctx: vscode.ExtensionContext, initRevState?: any, webContext?: boolean): Controller | null {
if (!vscode.workspace.rootPath) {

@@ -19,3 +19,3 @@ return null;

const controller = new Controller({ connect: () => env.openChannel("zap") }, {}, env, initRevState);
const controller = new Controller({ connect: () => env.openChannel("zap") }, {}, env, initRevState, webContext);
ctx.subscriptions.push(controller);

@@ -22,0 +22,0 @@

@@ -13,4 +13,8 @@ import * as vscode from "vscode";

private onOpListener?: (op: WorkspaceOp) => void;
private onOpExtListener?: (op: WorkspaceOp) => void;
private onResetListener?: (newOp?: WorkspaceOp) => void;
private onWillSaveFileListener?: (params: WorkspaceWillSaveFileParams) => Thenable<void>;
private _onGenerateOp = new vscode.EventEmitter<WorkspaceOp>();
private _onApplyOp = new vscode.EventEmitter<WorkspaceOp>();
private _onReset = new vscode.EventEmitter<WorkspaceOp>();

@@ -35,6 +39,9 @@ private toDispose: vscode.Disposable[] = [];

) {
// Give onOpListener default noop value;
this.onOpListener = op => {
console.log(`WARNING: Op ignored because Workspace.onOpListener is not set: ${opToString(op)}`);
if (this.onOpExtListener) { this.onOpExtListener(op); };
this._onGenerateOp.fire(op);
};
this.onResetListener = op => {
this._onReset.fire(op);
};
this.outputChannel = vscode.window.createOutputChannel("zap controller");

@@ -45,9 +52,17 @@ this.toDispose.push(this.outputChannel);

public onOp(listener?: (op: WorkspaceOp) => void): void {
this.onOpListener = listener;
this.onOpExtListener = listener;
}
public onReset(listener?: (newOp?: WorkspaceOp) => void): void {
this.onResetListener = listener;
get onGenerateOp(): vscode.Event<WorkspaceOp> {
return this._onGenerateOp.event;
}
get onApplyOp(): vscode.Event<WorkspaceOp> {
return this._onApplyOp.event;
}
get onReset(): vscode.Event<WorkspaceOp> {
return this._onReset.event;
}
public onWillSaveFile(listener?: (params: WorkspaceWillSaveFileParams) => Thenable<void>): void {

@@ -210,3 +225,3 @@ this.onWillSaveFileListener = listener;

const rootURI = this.environment.rootURI!;
const uri = rootURI.with({fragment: stripFileOrBufferPathPrefix(path)});
const uri = rootURI.with({ fragment: stripFileOrBufferPathPrefix(path) });
const doc = await vscode.workspace.openTextDocument(uri);

@@ -227,3 +242,3 @@ await this.environment.deleteTextDocument(doc);

for (const [uri] of edit.entries()) {
const file: string = this.environment.asRelativePathInsideWorkspace(uri) !;
const file: string = this.environment.asRelativePathInsideWorkspace(uri)!;
this.documentIsDirty.set(uri.toString(), this.documentIsDirty.get(uri.toString()) || Boolean(op.edit![`#${file}`]));

@@ -317,3 +332,3 @@ }

for (const doc of vscode.workspace.textDocuments) {
const fileName: string = this.environment.asRelativePathInsideWorkspace(doc.uri) !;
const fileName: string = this.environment.asRelativePathInsideWorkspace(doc.uri)!;
if (fileName !== null && edit.has(doc.uri) && !op.edit![`#${fileName}`]) {

@@ -348,2 +363,3 @@ if (!await doc.save()) {

this.applyingOp = undefined;
this._onApplyOp.fire(op);
}

@@ -350,0 +366,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc