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

vscode-languageserver-types

Package Overview
Dependencies
Maintainers
8
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vscode-languageserver-types - npm Package Compare versions

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

259

lib/esm/main.js

@@ -22,7 +22,7 @@ /* --------------------------------------------------------------------------------------------

/**
* Checks whether the given liternal conforms to the [Position](#Position) interface.
* Checks whether the given literal conforms to the [Position](#Position) interface.
*/
function is(value) {
var candidate = value;
return Is.objectLiteral(candidate) && Is.number(candidate.line) && Is.number(candidate.character);
return Is.objectLiteral(candidate) && Is.uinteger(candidate.line) && Is.uinteger(candidate.character);
}

@@ -38,3 +38,3 @@ Position.is = is;

function create(one, two, three, four) {
if (Is.number(one) && Is.number(two) && Is.number(three) && Is.number(four)) {
if (Is.uinteger(one) && Is.uinteger(two) && Is.uinteger(three) && Is.uinteger(four)) {
return { start: Position.create(one, two), end: Position.create(three, four) };

@@ -134,6 +134,6 @@ }

var candidate = value;
return Is.number(candidate.red)
&& Is.number(candidate.green)
&& Is.number(candidate.blue)
&& Is.number(candidate.alpha);
return Is.numberRange(candidate.red, 0, 1)
&& Is.numberRange(candidate.green, 0, 1)
&& Is.numberRange(candidate.blue, 0, 1)
&& Is.numberRange(candidate.alpha, 0, 1);
}

@@ -244,5 +244,5 @@ Color.is = is;

var candidate = value;
return Is.number(candidate.startLine) && Is.number(candidate.startLine)
&& (Is.undefined(candidate.startCharacter) || Is.number(candidate.startCharacter))
&& (Is.undefined(candidate.endCharacter) || Is.number(candidate.endCharacter))
return Is.uinteger(candidate.startLine) && Is.uinteger(candidate.startLine)
&& (Is.undefined(candidate.startCharacter) || Is.uinteger(candidate.startCharacter))
&& (Is.undefined(candidate.endCharacter) || Is.uinteger(candidate.endCharacter))
&& (Is.undefined(candidate.kind) || Is.string(candidate.kind));

@@ -363,2 +363,3 @@ }

function is(value) {
var _a;
var candidate = value;

@@ -369,3 +370,4 @@ return Is.defined(candidate)

&& (Is.number(candidate.severity) || Is.undefined(candidate.severity))
&& (Is.number(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code))
&& (Is.integer(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code))
&& (Is.undefined(candidate.codeDescription) || (Is.string((_a = candidate.codeDescription) === null || _a === void 0 ? void 0 : _a.href)))
&& (Is.string(candidate.source) || Is.undefined(candidate.source))

@@ -446,2 +448,63 @@ && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is));

})(TextEdit || (TextEdit = {}));
export var ChangeAnnotation;
(function (ChangeAnnotation) {
function create(label, needsConfirmation, description) {
var result = { label: label };
if (needsConfirmation !== undefined) {
result.needsConfirmation = needsConfirmation;
}
if (description !== undefined) {
result.description = description;
}
return result;
}
ChangeAnnotation.create = create;
function is(value) {
var candidate = value;
return candidate !== undefined && Is.objectLiteral(candidate) && Is.string(candidate.label) &&
(Is.boolean(candidate.needsConfirmation) || candidate.needsConfirmation === undefined) &&
(Is.string(candidate.description) || candidate.description === undefined);
}
ChangeAnnotation.is = is;
})(ChangeAnnotation || (ChangeAnnotation = {}));
export var AnnotatedTextEdit;
(function (AnnotatedTextEdit) {
/**
* Creates an annotated replace text edit.
*
* @param range The range of text to be replaced.
* @param newText The new text.
* @param annotation The annotation.
*/
function replace(range, newText, annotation) {
return { range: range, newText: newText, annotation: annotation };
}
AnnotatedTextEdit.replace = replace;
/**
* Creates an annotated insert text edit.
*
* @param position The position to insert the text at.
* @param newText The text to be inserted.
* @param annotation The annotation.
*/
function insert(position, newText, annotation) {
return { range: { start: position, end: position }, newText: newText, annotation: annotation };
}
AnnotatedTextEdit.insert = insert;
/**
* Creates an annotated delete text edit.
*
* @param range The range of text to be deleted.
* @param annotation The annotation.
*/
function del(range, annotation) {
return { range: range, newText: '', annotation: annotation };
}
AnnotatedTextEdit.del = del;
function is(value) {
var candidate = value;
return TextEdit.is(candidate) && ChangeAnnotation.is(candidate.annotation);
}
AnnotatedTextEdit.is = is;
})(AnnotatedTextEdit || (AnnotatedTextEdit = {}));
/**

@@ -463,3 +526,3 @@ * The TextDocumentEdit namespace provides helper function to create

return Is.defined(candidate)
&& VersionedTextDocumentIdentifier.is(candidate.textDocument)
&& OptionalVersionedTextDocumentIdentifier.is(candidate.textDocument)
&& Array.isArray(candidate.edits);

@@ -471,3 +534,3 @@ }

(function (CreateFile) {
function create(uri, options) {
function create(uri, options, annotation) {
var result = {

@@ -477,5 +540,8 @@ kind: 'create',

};
if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {
if (options !== undefined && (options.overwrite !== undefined || options.ignoreIfExists !== undefined)) {
result.options = options;
}
if (annotation !== undefined) {
result.annotation = annotation;
}
return result;

@@ -486,5 +552,4 @@ }

var candidate = value;
return candidate && candidate.kind === 'create' && Is.string(candidate.uri) &&
(candidate.options === void 0 ||
((candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))));
return candidate && candidate.kind === 'create' && Is.string(candidate.uri) && (candidate.options === undefined ||
((candidate.options.overwrite === undefined || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === undefined || Is.boolean(candidate.options.ignoreIfExists)))) && (candidate.annotation === undefined || ChangeAnnotation.is(candidate.annotation));
}

@@ -495,3 +560,3 @@ CreateFile.is = is;

(function (RenameFile) {
function create(oldUri, newUri, options) {
function create(oldUri, newUri, options, annotation) {
var result = {

@@ -502,5 +567,8 @@ kind: 'rename',

};
if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {
if (options !== undefined && (options.overwrite !== undefined || options.ignoreIfExists !== undefined)) {
result.options = options;
}
if (annotation !== undefined) {
result.annotation = annotation;
}
return result;

@@ -511,5 +579,4 @@ }

var candidate = value;
return candidate && candidate.kind === 'rename' && Is.string(candidate.oldUri) && Is.string(candidate.newUri) &&
(candidate.options === void 0 ||
((candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))));
return candidate && candidate.kind === 'rename' && Is.string(candidate.oldUri) && Is.string(candidate.newUri) && (candidate.options === undefined ||
((candidate.options.overwrite === undefined || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === undefined || Is.boolean(candidate.options.ignoreIfExists)))) && (candidate.annotation === undefined || ChangeAnnotation.is(candidate.annotation));
}

@@ -520,3 +587,3 @@ RenameFile.is = is;

(function (DeleteFile) {
function create(uri, options) {
function create(uri, options, annotation) {
var result = {

@@ -526,5 +593,8 @@ kind: 'delete',

};
if (options !== void 0 && (options.recursive !== void 0 || options.ignoreIfNotExists !== void 0)) {
if (options !== undefined && (options.recursive !== undefined || options.ignoreIfNotExists !== undefined)) {
result.options = options;
}
if (annotation !== undefined) {
result.annotation = annotation;
}
return result;

@@ -535,5 +605,4 @@ }

var candidate = value;
return candidate && candidate.kind === 'delete' && Is.string(candidate.uri) &&
(candidate.options === void 0 ||
((candidate.options.recursive === void 0 || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === void 0 || Is.boolean(candidate.options.ignoreIfNotExists))));
return candidate && candidate.kind === 'delete' && Is.string(candidate.uri) && (candidate.options === undefined ||
((candidate.options.recursive === undefined || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === undefined || Is.boolean(candidate.options.ignoreIfNotExists)))) && (candidate.annotation === undefined || ChangeAnnotation.is(candidate.annotation));
}

@@ -547,4 +616,4 @@ DeleteFile.is = is;

return candidate &&
(candidate.changes !== void 0 || candidate.documentChanges !== void 0) &&
(candidate.documentChanges === void 0 || candidate.documentChanges.every(function (change) {
(candidate.changes !== undefined || candidate.documentChanges !== undefined) &&
(candidate.documentChanges === undefined || candidate.documentChanges.every(function (change) {
if (Is.string(change.kind)) {

@@ -564,10 +633,25 @@ return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change);

}
TextEditChangeImpl.prototype.insert = function (position, newText) {
this.edits.push(TextEdit.insert(position, newText));
TextEditChangeImpl.prototype.insert = function (position, newText, annotation) {
if (annotation === undefined) {
this.edits.push(TextEdit.insert(position, newText));
}
else {
this.edits.push(AnnotatedTextEdit.insert(position, newText, annotation));
}
};
TextEditChangeImpl.prototype.replace = function (range, newText) {
this.edits.push(TextEdit.replace(range, newText));
TextEditChangeImpl.prototype.replace = function (range, newText, annotation) {
if (annotation === undefined) {
this.edits.push(TextEdit.replace(range, newText));
}
else {
this.edits.push(AnnotatedTextEdit.replace(range, newText, annotation));
}
};
TextEditChangeImpl.prototype.delete = function (range) {
this.edits.push(TextEdit.del(range));
TextEditChangeImpl.prototype.delete = function (range, annotation) {
if (annotation === undefined) {
this.edits.push(TextEdit.del(range));
}
else {
this.edits.push(AnnotatedTextEdit.del(range, annotation));
}
};

@@ -625,3 +709,3 @@ TextEditChangeImpl.prototype.add = function (edit) {

WorkspaceChange.prototype.getTextEditChange = function (key) {
if (VersionedTextDocumentIdentifier.is(key)) {
if (OptionalVersionedTextDocumentIdentifier.is(key)) {
if (!this._workspaceEdit) {

@@ -731,3 +815,3 @@ this._workspaceEdit = {

var candidate = value;
return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.number(candidate.version));
return Is.defined(candidate) && Is.string(candidate.uri) && Is.integer(candidate.version);
}

@@ -737,2 +821,26 @@ VersionedTextDocumentIdentifier.is = is;

/**
* The OptionalVersionedTextDocumentIdentifier namespace provides helper functions to work with
* [OptionalVersionedTextDocumentIdentifier](#OptionalVersionedTextDocumentIdentifier) literals.
*/
export var OptionalVersionedTextDocumentIdentifier;
(function (OptionalVersionedTextDocumentIdentifier) {
/**
* Creates a new OptionalVersionedTextDocumentIdentifier literal.
* @param uri The document's uri.
* @param uri The document's text.
*/
function create(uri, version) {
return { uri: uri, version: version };
}
OptionalVersionedTextDocumentIdentifier.create = create;
/**
* Checks whether the given literal conforms to the [OptionalVersionedTextDocumentIdentifier](#OptionalVersionedTextDocumentIdentifier) interface.
*/
function is(value) {
var candidate = value;
return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.integer(candidate.version));
}
OptionalVersionedTextDocumentIdentifier.is = is;
})(OptionalVersionedTextDocumentIdentifier || (OptionalVersionedTextDocumentIdentifier = {}));
/**
* The TextDocumentItem namespace provides helper functions to work with

@@ -759,3 +867,3 @@ * [TextDocumentItem](#TextDocumentItem) literals.

var candidate = value;
return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.number(candidate.version) && Is.string(candidate.text);
return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.integer(candidate.version) && Is.string(candidate.text);
}

@@ -884,3 +992,3 @@ TextDocumentItem.is = is;

/**
* Checks whether the given liternal conforms to the [InsertReplaceEdit](#InsertReplaceEdit) interface.
* Checks whether the given literal conforms to the [InsertReplaceEdit](#InsertReplaceEdit) interface.
*/

@@ -894,2 +1002,29 @@ function is(value) {

/**
* How whitespace and indentation is handled during completion
* item insertion.
*
* @since 3.16.0 - proposed state
*/
export var InsertTextMode;
(function (InsertTextMode) {
/**
* The insertion or replace strings is taken as it is. If the
* value is multi line the lines below the cursor will be
* inserted using the indentation defined in the string value.
* The client will not apply any kind of adjustments to the
* string.
*/
InsertTextMode.asIs = 1;
/**
* The editor adjusts leading whitespace of new lines so that
* they match the indentation up to the cursor of the line for
* which the item is accepted.
*
* Consider a line like this: <2tabs><cursor><3tabs>foo. Accepting a
* multi line completion item is indented using 2 tabs and all
* following lines inserted will be indented using 2 tabs as well.
*/
InsertTextMode.adjustIndentation = 2;
})(InsertTextMode || (InsertTextMode = {}));
/**
* The CompletionItem namespace provides functions to deal with

@@ -955,3 +1090,3 @@ * completion items.

MarkedString.is(candidate.contents) ||
Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === void 0 || Range.is(value.range));
Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === undefined || Range.is(value.range));
}

@@ -1126,3 +1261,3 @@ Hover.is = is;

};
if (children !== void 0) {
if (children !== undefined) {
result.children = children;

@@ -1141,6 +1276,6 @@ }

Range.is(candidate.range) && Range.is(candidate.selectionRange) &&
(candidate.detail === void 0 || Is.string(candidate.detail)) &&
(candidate.deprecated === void 0 || Is.boolean(candidate.deprecated)) &&
(candidate.children === void 0 || Array.isArray(candidate.children)) &&
(candidate.tags === void 0 || Array.isArray(candidate.tags));
(candidate.detail === undefined || Is.string(candidate.detail)) &&
(candidate.deprecated === undefined || Is.boolean(candidate.deprecated)) &&
(candidate.children === undefined || Array.isArray(candidate.children)) &&
(candidate.tags === undefined || Array.isArray(candidate.tags));
}

@@ -1233,3 +1368,3 @@ DocumentSymbol.is = is;

var result = { diagnostics: diagnostics };
if (only !== void 0 && only !== null) {
if (only !== undefined && only !== null) {
result.only = only;

@@ -1245,3 +1380,3 @@ }

var candidate = value;
return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is) && (candidate.only === void 0 || Is.typedArray(candidate.only, Is.string));
return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is) && (candidate.only === undefined || Is.typedArray(candidate.only, Is.string));
}

@@ -1265,3 +1400,3 @@ CodeActionContext.is = is;

}
if (checkKind && kind !== void 0) {
if (checkKind && kind !== undefined) {
result.kind = kind;

@@ -1275,8 +1410,8 @@ }

return candidate && Is.string(candidate.title) &&
(candidate.diagnostics === void 0 || Is.typedArray(candidate.diagnostics, Diagnostic.is)) &&
(candidate.kind === void 0 || Is.string(candidate.kind)) &&
(candidate.edit !== void 0 || candidate.command !== void 0) &&
(candidate.command === void 0 || Command.is(candidate.command)) &&
(candidate.isPreferred === void 0 || Is.boolean(candidate.isPreferred)) &&
(candidate.edit === void 0 || WorkspaceEdit.is(candidate.edit));
(candidate.diagnostics === undefined || Is.typedArray(candidate.diagnostics, Diagnostic.is)) &&
(candidate.kind === undefined || Is.string(candidate.kind)) &&
(candidate.edit !== undefined || candidate.command !== undefined) &&
(candidate.command === undefined || Command.is(candidate.command)) &&
(candidate.isPreferred === undefined || Is.boolean(candidate.isPreferred)) &&
(candidate.edit === undefined || WorkspaceEdit.is(candidate.edit));
}

@@ -1329,3 +1464,3 @@ CodeAction.is = is;

var candidate = value;
return Is.defined(candidate) && Is.number(candidate.tabSize) && Is.boolean(candidate.insertSpaces);
return Is.defined(candidate) && Is.uinteger(candidate.tabSize) && Is.boolean(candidate.insertSpaces);
}

@@ -1398,3 +1533,3 @@ FormattingOptions.is = is;

var candidate = value;
return Is.defined(candidate) && Is.string(candidate.uri) && (Is.undefined(candidate.languageId) || Is.string(candidate.languageId)) && Is.number(candidate.lineCount)
return Is.defined(candidate) && Is.string(candidate.uri) && (Is.undefined(candidate.languageId) || Is.string(candidate.languageId)) && Is.uinteger(candidate.lineCount)
&& Is.func(candidate.getText) && Is.func(candidate.positionAt) && Is.func(candidate.offsetAt) ? true : false;

@@ -1594,2 +1729,14 @@ }

Is.number = number;
function numberRange(value, min, max) {
return toString.call(value) === '[object Number]' && min <= value && value <= max;
}
Is.numberRange = numberRange;
function integer(value) {
return toString.call(value) === '[object Number]' && -2147483648 <= value && value <= 2147483647;
}
Is.integer = integer;
function uinteger(value) {
return toString.call(value) === '[object Number]' && 0 <= value && value <= 2147483647;
}
Is.uinteger = uinteger;
function func(value) {

@@ -1596,0 +1743,0 @@ return toString.call(value) === '[object Function]';

{
"name": "vscode-languageserver-types",
"description": "Types used by the Language server for node",
"version": "3.16.0-next.4",
"version": "3.16.0-next.5",
"author": "Microsoft Corporation",

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

"scripts": {
"prepublishOnly": "npm run clean && npm run compile:esm && npm run compile && npm run test",
"prepublishOnly": "git clean -xfd . && npm install && npm run clean && npm run compile:esm && npm run compile && npm run test",
"postpublish": "node ../build/npm/post-publish.js",

@@ -22,0 +22,0 @@ "compile": "node ../build/bin/tsc -b ./tsconfig.json",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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