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

vscode-languageserver

Package Overview
Dependencies
Maintainers
11
Versions
268
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vscode-languageserver - npm Package Compare versions

Comparing version 7.1.0-next.4 to 7.1.0-next.5

12

lib/common/proposed.diagnostic.d.ts

@@ -1,2 +0,2 @@

import { Proposed, Diagnostic } from 'vscode-languageserver-protocol';
import { Proposed } from 'vscode-languageserver-protocol';
import type { Feature, _Languages, ServerRequestHandler } from './server';

@@ -16,9 +16,15 @@ /**

/**
* Installs a handler for the diagnostic request.
* Installs a handler for the document diagnostic request.
*
* @param handler The corresponding handler.
*/
on(handler: ServerRequestHandler<Proposed.DiagnosticParams, Proposed.DiagnosticList, Diagnostic[], Proposed.DiagnosticServerCancellationData>): void;
on(handler: ServerRequestHandler<Proposed.DocumentDiagnosticParams, Proposed.DocumentDiagnosticReport, Proposed.DocumentDiagnosticReportPartialResult, Proposed.DiagnosticServerCancellationData>): void;
/**
* Installs a handler for the workspace diagnostic request.
*
* @param handler The corresponding handler.
*/
onWorkspace(handler: ServerRequestHandler<Proposed.WorkspaceDiagnosticParams, Proposed.WorkspaceDiagnosticReport, Proposed.WorkspaceDiagnosticReportPartialResult, Proposed.DiagnosticServerCancellationData>): void;
};
}
export declare const DiagnosticFeature: Feature<_Languages, DiagnosticsFeatureShape>;

@@ -17,5 +17,10 @@ "use strict";

on: (handler) => {
this.connection.onRequest(vscode_languageserver_protocol_1.Proposed.DiagnosticRequest.type, (params, cancel) => {
return handler(params, cancel, this.attachWorkDoneProgress(params), undefined);
this.connection.onRequest(vscode_languageserver_protocol_1.Proposed.DocumentDiagnosticRequest.type, (params, cancel) => {
return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(vscode_languageserver_protocol_1.Proposed.DocumentDiagnosticRequest.partialResult, params));
});
},
onWorkspace: (handler) => {
this.connection.onRequest(vscode_languageserver_protocol_1.Proposed.WorkspaceDiagnosticRequest.type, (params, cancel) => {
return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(vscode_languageserver_protocol_1.Proposed.WorkspaceDiagnosticRequest.partialResult, params));
});
}

@@ -22,0 +27,0 @@ };

@@ -1,2 +0,2 @@

import { SemanticTokens, SemanticTokensPartialResult, SemanticTokensDelta, SemanticTokensDeltaPartialResult, SemanticTokensParams, SemanticTokensDeltaParams, SemanticTokensRangeParams } from 'vscode-languageserver-protocol';
import { SemanticTokens, SemanticTokensPartialResult, SemanticTokensDelta, SemanticTokensDeltaPartialResult, SemanticTokensParams, SemanticTokensDeltaParams, SemanticTokensRangeParams, SemanticTokensEdit } from 'vscode-languageserver-protocol';
import type { Feature, _Languages, ServerRequestHandler } from './server';

@@ -17,2 +17,8 @@ /**

export declare const SemanticTokensFeature: Feature<_Languages, SemanticTokensFeatureShape>;
export declare class SemanticTokensDiff {
private readonly originalSequence;
private readonly modifiedSequence;
constructor(originalSequence: number[], modifiedSequence: number[]);
computeDiff(): SemanticTokensEdit[];
}
export declare class SemanticTokensBuilder {

@@ -19,0 +25,0 @@ private _id;

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.SemanticTokensBuilder = exports.SemanticTokensFeature = void 0;
exports.SemanticTokensBuilder = exports.SemanticTokensDiff = exports.SemanticTokensFeature = void 0;
const vscode_languageserver_protocol_1 = require("vscode-languageserver-protocol");

@@ -40,2 +40,57 @@ const SemanticTokensFeature = (Base) => {

exports.SemanticTokensFeature = SemanticTokensFeature;
class SemanticTokensDiff {
constructor(originalSequence, modifiedSequence) {
this.originalSequence = originalSequence;
this.modifiedSequence = modifiedSequence;
}
computeDiff() {
const originalLength = this.originalSequence.length;
const modifiedLength = this.modifiedSequence.length;
let startIndex = 0;
while (startIndex < modifiedLength && startIndex < originalLength && this.originalSequence[startIndex] === this.modifiedSequence[startIndex]) {
startIndex++;
}
if (startIndex < modifiedLength && startIndex < originalLength) {
let originalEndIndex = originalLength - 1;
let modifiedEndIndex = modifiedLength - 1;
while (originalEndIndex >= startIndex && modifiedEndIndex >= startIndex && this.originalSequence[originalEndIndex] === this.modifiedSequence[modifiedEndIndex]) {
originalEndIndex--;
modifiedEndIndex--;
}
// if one moved behind the start index move them forward again
if (originalEndIndex < startIndex || modifiedEndIndex < startIndex) {
originalEndIndex++;
modifiedEndIndex++;
}
const deleteCount = originalEndIndex - startIndex + 1;
const newData = this.modifiedSequence.slice(startIndex, modifiedEndIndex + 1);
// If we moved behind the start index we could have missed a simple delete.
if (newData.length === 1 && newData[0] === this.originalSequence[originalEndIndex]) {
return [
{ start: startIndex, deleteCount: deleteCount - 1 }
];
}
else {
return [
{ start: startIndex, deleteCount, data: newData }
];
}
}
else if (startIndex < modifiedLength) {
return [
{ start: startIndex, deleteCount: 0, data: this.modifiedSequence.slice(startIndex) }
];
}
else if (startIndex < originalLength) {
return [
{ start: startIndex, deleteCount: originalLength - startIndex }
];
}
else {
// The two arrays are the same.
return [];
}
}
}
exports.SemanticTokensDiff = SemanticTokensDiff;
class SemanticTokensBuilder {

@@ -91,36 +146,6 @@ constructor() {

if (this._prevData !== undefined) {
const prevDataLength = this._prevData.length;
const dataLength = this._data.length;
let startIndex = 0;
while (startIndex < dataLength && startIndex < prevDataLength && this._prevData[startIndex] === this._data[startIndex]) {
startIndex++;
}
if (startIndex < dataLength && startIndex < prevDataLength) {
// Find end index
let endIndex = 0;
while (endIndex < dataLength && endIndex < prevDataLength && this._prevData[prevDataLength - 1 - endIndex] === this._data[dataLength - 1 - endIndex]) {
endIndex++;
}
const newData = this._data.slice(startIndex, dataLength - endIndex);
const result = {
resultId: this.id,
edits: [
{ start: startIndex, deleteCount: prevDataLength - endIndex - startIndex, data: newData }
]
};
return result;
}
else if (startIndex < dataLength) {
return { resultId: this.id, edits: [
{ start: startIndex, deleteCount: 0, data: this._data.slice(startIndex) }
] };
}
else if (startIndex < prevDataLength) {
return { resultId: this.id, edits: [
{ start: startIndex, deleteCount: prevDataLength - startIndex }
] };
}
else {
return { resultId: this.id, edits: [] };
}
return {
resultId: this.id,
edits: (new SemanticTokensDiff(this._prevData, this._data)).computeDiff()
};
}

@@ -127,0 +152,0 @@ else {

{
"name": "vscode-languageserver",
"description": "Language server implementation for node",
"version": "7.1.0-next.4",
"version": "7.1.0-next.5",
"author": "Microsoft Corporation",

@@ -24,3 +24,3 @@ "license": "MIT",

"dependencies": {
"vscode-languageserver-protocol": "3.17.0-next.5"
"vscode-languageserver-protocol": "3.17.0-next.6"
},

@@ -27,0 +27,0 @@ "scripts": {

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