New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

sprotty-vscode

Package Overview
Dependencies
Maintainers
4
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sprotty-vscode - npm Package Compare versions

Comparing version 0.3.1 to 0.4.0

4

lib/lsp/editing/lsp-label-edit-action-handler.d.ts

@@ -18,3 +18,3 @@ /********************************************************************************

import { LspLabelEditAction } from 'sprotty-vscode-protocol/lib/lsp/editing';
import { CompletionItem, CommonLanguageClient } from 'vscode-languageclient';
import { CompletionItem, LanguageClient } from 'vscode-languageclient/node';
import { ActionHandler } from '../../action-handler';

@@ -27,3 +27,3 @@ import { SprottyWebview } from '../../sprotty-webview';

handleAction(action: Action): Promise<boolean>;
protected get languageClient(): CommonLanguageClient;
protected get languageClient(): LanguageClient;
chooseCrossReference(action: LspLabelEditAction): Promise<boolean>;

@@ -30,0 +30,0 @@ protected filterCompletionItems(items: CompletionItem[]): CompletionItem[];

@@ -57,3 +57,3 @@ "use strict";

var vscode_1 = require("vscode");
var vscode_languageclient_1 = require("vscode-languageclient");
var node_1 = require("vscode-languageclient/node");
var sprotty_lsp_vscode_extension_1 = require("../sprotty-lsp-vscode-extension");

@@ -93,3 +93,3 @@ var lsp_to_vscode_1 = require("./lsp-to-vscode");

switch (_a.label) {
case 0: return [4 /*yield*/, this.languageClient.sendRequest(vscode_languageclient_1.CompletionRequest.type, {
case 0: return [4 /*yield*/, this.languageClient.sendRequest(node_1.CompletionRequest.type, {
textDocument: { uri: action.location.uri },

@@ -130,3 +130,3 @@ position: (0, lsp_to_vscode_1.convertPosition)(action.location.range.start)

LspLabelEditActionHandler.prototype.filterCompletionItems = function (items) {
return items.filter(function (item) { return item.kind === vscode_languageclient_1.CompletionItemKind.Reference; });
return items.filter(function (item) { return item.kind === node_1.CompletionItemKind.Reference; });
};

@@ -138,3 +138,3 @@ LspLabelEditActionHandler.prototype.renameElement = function (action) {

switch (_a.label) {
case 0: return [4 /*yield*/, this.languageClient.sendRequest(vscode_languageclient_1.PrepareRenameRequest.type, {
case 0: return [4 /*yield*/, this.languageClient.sendRequest(node_1.PrepareRenameRequest.type, {
textDocument: {

@@ -156,3 +156,3 @@ uri: action.location.uri

if (!newName) return [3 /*break*/, 4];
return [4 /*yield*/, this.languageClient.sendRequest(vscode_languageclient_1.RenameRequest.type, {
return [4 /*yield*/, this.languageClient.sendRequest(node_1.RenameRequest.type, {
textDocument: {

@@ -159,0 +159,0 @@ uri: action.location.uri

@@ -17,3 +17,3 @@ /********************************************************************************

import * as vscode from 'vscode';
import { Emitter, CommonLanguageClient } from 'vscode-languageclient';
import { Emitter, LanguageClient } from 'vscode-languageclient/node';
import { OpenInTextEditorMessage } from './protocol';

@@ -24,3 +24,3 @@ import { ActionMessage } from 'sprotty-protocol';

export declare abstract class SprottyLspVscodeExtension extends SprottyVscodeExtension {
readonly languageClient: CommonLanguageClient;
readonly languageClient: LanguageClient;
protected acceptFromLanguageServerEmitter: Emitter<ActionMessage>;

@@ -30,3 +30,3 @@ constructor(extensionPrefix: string, context: vscode.ExtensionContext);

didCloseWebview(identifier: SprottyDiagramIdentifier): void;
protected abstract activateLanguageClient(context: vscode.ExtensionContext): CommonLanguageClient;
protected abstract activateLanguageClient(context: vscode.ExtensionContext): LanguageClient;
deactivateLanguageClient(): Thenable<void>;

@@ -33,0 +33,0 @@ protected openInTextEditor(message: OpenInTextEditorMessage): void;

@@ -35,3 +35,3 @@ "use strict";

var vscode = require("vscode");
var vscode_languageclient_1 = require("vscode-languageclient");
var node_1 = require("vscode-languageclient/node");
var protocol_1 = require("./protocol");

@@ -43,8 +43,6 @@ var sprotty_vscode_extension_1 = require("../sprotty-vscode-extension");

var _this = _super.call(this, extensionPrefix, context) || this;
_this.acceptFromLanguageServerEmitter = new vscode_languageclient_1.Emitter();
_this.acceptFromLanguageServerEmitter = new node_1.Emitter();
_this.languageClient = _this.activateLanguageClient(context);
_this.languageClient.onReady().then(function () {
_this.languageClient.onNotification(protocol_1.acceptMessageType, function (message) { return _this.acceptFromLanguageServerEmitter.fire(message); });
_this.languageClient.onNotification(protocol_1.openInTextEditorMessageType, function (message) { return _this.openInTextEditor(message); });
});
_this.languageClient.onNotification(protocol_1.acceptMessageType, function (message) { return _this.acceptFromLanguageServerEmitter.fire(message); });
_this.languageClient.onNotification(protocol_1.openInTextEditorMessageType, function (message) { return _this.openInTextEditor(message); });
return _this;

@@ -65,4 +63,5 @@ }

SprottyLspVscodeExtension.prototype.deactivateLanguageClient = function () {
if (!this.languageClient)
if (!this.languageClient) {
return Promise.resolve(undefined);
}
return this.languageClient.stop();

@@ -69,0 +68,0 @@ };

@@ -16,3 +16,3 @@ /********************************************************************************

********************************************************************************/
import { CommonLanguageClient } from 'vscode-languageclient';
import { LanguageClient } from 'vscode-languageclient/node';
import { SprottyLspVscodeExtension } from './sprotty-lsp-vscode-extension';

@@ -25,4 +25,3 @@ import { SprottyWebview, SprottyWebviewOptions } from '../sprotty-webview';

constructor(options: SprottyWebviewOptions);
protected ready(): Promise<void>;
protected get languageClient(): CommonLanguageClient;
protected get languageClient(): LanguageClient;
protected connect(): Promise<void>;

@@ -29,0 +28,0 @@ protected receiveFromWebview(message: any): Promise<boolean>;

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

}
SprottyLspWebview.prototype.ready = function () {
return Promise.all([_super.prototype.ready.call(this), this.languageClient.onReady()]);
};
Object.defineProperty(SprottyLspWebview.prototype, "languageClient", {

@@ -100,5 +97,3 @@ get: function () {

_super.prototype.connect.call(this);
this.languageClient.onReady().then(function () {
_this.disposables.push(_this.extension.onAcceptFromLanguageServer(function (message) { return _this.sendToWebview(message); }));
});
this.disposables.push(this.extension.onAcceptFromLanguageServer(function (message) { return _this.sendToWebview(message); }));
return [2 /*return*/];

@@ -121,3 +116,3 @@ });

case 2:
if (!(0, messages_1.isRequestMessage)(message)) return [3 /*break*/, 7];
if (!messages_1.Message.isRequest(message)) return [3 /*break*/, 7];
if (!(message.params)) return [3 /*break*/, 4];

@@ -141,3 +136,3 @@ return [4 /*yield*/, this.languageClient.sendRequest(message.method, message.params)];

case 7:
if ((0, messages_1.isNotificationMessage)(message)) {
if (messages_1.Message.isNotification(message)) {
this.languageClient.sendNotification(message.method, message.params);

@@ -144,0 +139,0 @@ }

@@ -199,3 +199,3 @@ "use strict";

SprottyWebview.prototype.sendToWebview = function (message) {
if ((0, sprotty_protocol_1.isActionMessage)(message) || (0, sprotty_vscode_protocol_1.isDiagramIdentifier)(message) || (0, messages_1.isResponseMessage)(message)) {
if ((0, sprotty_protocol_1.isActionMessage)(message) || (0, sprotty_vscode_protocol_1.isDiagramIdentifier)(message) || messages_1.Message.isResponse(message)) {
if (this.diagramPanel.visible) {

@@ -202,0 +202,0 @@ if ((0, sprotty_protocol_1.isActionMessage)(message)) {

{
"name": "sprotty-vscode",
"version": "0.3.1",
"version": "0.4.0",
"displayName": "Sprotty VSCode Integration",

@@ -33,3 +33,4 @@ "description": "Glue code to integrate Sprotty diagrams in VSCode extensions (extension part)",

"type": "git",
"url": "https://github.com/eclipse/sprotty-vscode.git"
"url": "https://github.com/eclipse/sprotty-vscode.git",
"directory": "sprotty-vscode-extension"
},

@@ -47,4 +48,4 @@ "engines": {

"path": "^0.12.7",
"sprotty-vscode-protocol": "~0.3.0",
"vscode-languageclient": "^7.0.0"
"sprotty-vscode-protocol": "~0.4.0",
"vscode-languageclient": "^8.0.2"
},

@@ -51,0 +52,0 @@ "devDependencies": {

@@ -21,5 +21,5 @@ /********************************************************************************

import {
CompletionItem, CompletionItemKind, CompletionList, CompletionRequest, CommonLanguageClient,
CompletionItem, CompletionItemKind, CompletionList, CompletionRequest, LanguageClient,
PrepareRenameRequest, RenameParams, RenameRequest, TextDocumentPositionParams
} from 'vscode-languageclient';
} from 'vscode-languageclient/node';
import { ActionHandler } from '../../action-handler';

@@ -49,3 +49,3 @@ import { SprottyLspVscodeExtension } from '../sprotty-lsp-vscode-extension';

protected get languageClient(): CommonLanguageClient {
protected get languageClient(): LanguageClient {
return (this.webview.extension as SprottyLspVscodeExtension).languageClient;

@@ -52,0 +52,0 @@ }

@@ -22,3 +22,3 @@ /********************************************************************************

export abstract class SprottyLspEditVscodeExtension extends SprottyLspVscodeExtension {
protected registerCommands() {
protected override registerCommands() {
super.registerCommands();

@@ -25,0 +25,0 @@ this.context.subscriptions.push(

@@ -18,3 +18,3 @@ /********************************************************************************

import * as vscode from 'vscode';
import { Emitter, CommonLanguageClient } from 'vscode-languageclient';
import { Emitter, LanguageClient } from 'vscode-languageclient/node';
import { acceptMessageType, didCloseMessageType, OpenInTextEditorMessage, openInTextEditorMessageType } from './protocol';

@@ -26,3 +26,3 @@ import { ActionMessage } from 'sprotty-protocol';

export abstract class SprottyLspVscodeExtension extends SprottyVscodeExtension {
readonly languageClient: CommonLanguageClient;
readonly languageClient: LanguageClient;

@@ -34,6 +34,4 @@ protected acceptFromLanguageServerEmitter = new Emitter<ActionMessage>();

this.languageClient = this.activateLanguageClient(context);
this.languageClient.onReady().then(() => {
this.languageClient.onNotification(acceptMessageType, (message: ActionMessage) => this.acceptFromLanguageServerEmitter.fire(message));
this.languageClient.onNotification(openInTextEditorMessageType, (message: OpenInTextEditorMessage) => this.openInTextEditor(message));
});
this.languageClient.onNotification(acceptMessageType, (message: ActionMessage) => this.acceptFromLanguageServerEmitter.fire(message));
this.languageClient.onNotification(openInTextEditorMessageType, (message: OpenInTextEditorMessage) => this.openInTextEditor(message));
}

@@ -45,3 +43,3 @@

didCloseWebview(identifier: SprottyDiagramIdentifier): void {
override didCloseWebview(identifier: SprottyDiagramIdentifier): void {
super.didCloseWebview(identifier);

@@ -55,7 +53,8 @@ try {

protected abstract activateLanguageClient(context: vscode.ExtensionContext): CommonLanguageClient;
protected abstract activateLanguageClient(context: vscode.ExtensionContext): LanguageClient;
deactivateLanguageClient(): Thenable<void> {
if (!this.languageClient)
if (!this.languageClient) {
return Promise.resolve(undefined);
}
return this.languageClient.stop();

@@ -62,0 +61,0 @@ }

@@ -18,4 +18,4 @@ /********************************************************************************

import { isActionMessage } from 'sprotty-protocol';
import { isNotificationMessage, isRequestMessage, ResponseMessage } from 'vscode-jsonrpc/lib/common/messages';
import { CommonLanguageClient } from 'vscode-languageclient';
import { Message, ResponseMessage } from 'vscode-jsonrpc/lib/common/messages';
import { LanguageClient } from 'vscode-languageclient/node';

@@ -29,7 +29,7 @@ import { acceptMessageType } from './protocol';

static viewCount = 0;
static override viewCount = 0;
readonly extension: SprottyLspVscodeExtension;
override readonly extension: SprottyLspVscodeExtension;
constructor(protected options: SprottyWebviewOptions) {
constructor(protected override options: SprottyWebviewOptions) {
super(options);

@@ -40,18 +40,12 @@ if (!(options.extension instanceof SprottyLspVscodeExtension))

protected ready(): Promise<void> {
return Promise.all([super.ready(), this.languageClient.onReady()]) as any;
}
protected get languageClient(): CommonLanguageClient {
protected get languageClient(): LanguageClient {
return this.extension.languageClient;
}
protected async connect() {
protected override async connect() {
super.connect();
this.languageClient.onReady().then(() => {
this.disposables.push(this.extension.onAcceptFromLanguageServer(message => this.sendToWebview(message)));
});
this.disposables.push(this.extension.onAcceptFromLanguageServer(message => this.sendToWebview(message)));
}
protected async receiveFromWebview(message: any): Promise<boolean> {
protected override async receiveFromWebview(message: any): Promise<boolean> {
const shouldPropagate = await super.receiveFromWebview(message);

@@ -61,3 +55,3 @@ if (shouldPropagate) {

this.languageClient.sendNotification(acceptMessageType, message);
} else if (isRequestMessage(message)) {
} else if (Message.isRequest(message)) {
const result = (message.params)

@@ -71,3 +65,3 @@ ? await this.languageClient.sendRequest(message.method, message.params)

});
} else if (isNotificationMessage(message)) {
} else if (Message.isNotification(message)) {
this.languageClient.sendNotification(message.method, message.params);

@@ -74,0 +68,0 @@ }

@@ -23,3 +23,3 @@ /********************************************************************************

import { SprottyVscodeExtension, serializeUri } from './sprotty-vscode-extension';
import { isResponseMessage, ResponseMessage } from 'vscode-jsonrpc/lib/common/messages';
import { Message, ResponseMessage } from 'vscode-jsonrpc/lib/common/messages';

@@ -176,3 +176,3 @@ export interface SprottyWebviewOptions {

protected sendToWebview(message: any) {
if (isActionMessage(message) || isDiagramIdentifier(message) || isResponseMessage(message)) {
if (isActionMessage(message) || isDiagramIdentifier(message) || Message.isResponse(message)) {
if (this.diagramPanel.visible) {

@@ -179,0 +179,0 @@ if (isActionMessage(message)) {

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

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

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

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