vscode-languageserver-types
Advanced tools
Comparing version 3.12.0 to 3.13.0-next.1
@@ -465,2 +465,42 @@ /** | ||
} | ||
export interface CreateFileOptions { | ||
overwrite?: boolean; | ||
ignoreIfExists?: boolean; | ||
} | ||
export interface CreateFile { | ||
kind: 'create'; | ||
uri: string; | ||
options?: CreateFileOptions; | ||
} | ||
export declare namespace CreateFile { | ||
function create(uri: string, options?: CreateFileOptions): CreateFile; | ||
function is(value: any): value is CreateFile; | ||
} | ||
export interface RenameFileOptions { | ||
overwrite?: boolean; | ||
ignoreIfExists?: boolean; | ||
} | ||
export interface RenameFile { | ||
kind: 'rename'; | ||
oldUri: string; | ||
newUri: string; | ||
options?: RenameFileOptions; | ||
} | ||
export declare namespace RenameFile { | ||
function create(oldUri: string, newUri: string, options?: RenameFileOptions): RenameFile; | ||
function is(value: any): value is RenameFile; | ||
} | ||
export interface DeleteFileOptions { | ||
recursive?: boolean; | ||
ignoreIfNotExists?: boolean; | ||
} | ||
export interface DeleteFile { | ||
kind: 'delete'; | ||
uri: string; | ||
options?: DeleteFileOptions; | ||
} | ||
export declare namespace DeleteFile { | ||
function create(uri: string, options?: DeleteFileOptions): DeleteFile; | ||
function is(value: any): value is DeleteFile; | ||
} | ||
/** | ||
@@ -484,3 +524,3 @@ * A workspace edit represents changes to many resources managed in the workspace. The edit | ||
*/ | ||
documentChanges?: TextDocumentEdit[]; | ||
documentChanges?: (TextDocumentEdit | CreateFile | RenameFile | DeleteFile)[]; | ||
} | ||
@@ -548,2 +588,6 @@ export declare namespace WorkspaceEdit { | ||
getTextEditChange(uri: string): TextEditChange; | ||
createFile(uri: string, options?: CreateFileOptions): void; | ||
renameFile(oldUri: string, newUri: string, options?: RenameFileOptions): void; | ||
deleteFile(uri: string, options?: DeleteFileOptions): void; | ||
private checkDocumentChanges; | ||
} | ||
@@ -597,3 +641,3 @@ /** | ||
*/ | ||
function create(uri: string, version: number): VersionedTextDocumentIdentifier; | ||
function create(uri: string, version: number | null): VersionedTextDocumentIdentifier; | ||
/** | ||
@@ -600,0 +644,0 @@ * Checks whether the given literal conforms to the [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) interface. |
@@ -399,2 +399,66 @@ /* -------------------------------------------------------------------------------------------- | ||
})(TextDocumentEdit || (TextDocumentEdit = {})); | ||
export var CreateFile; | ||
(function (CreateFile) { | ||
function create(uri, options) { | ||
var result = { | ||
kind: 'create', | ||
uri: uri | ||
}; | ||
if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) { | ||
result.options = options; | ||
} | ||
return result; | ||
} | ||
CreateFile.create = create; | ||
function is(value) { | ||
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)))); | ||
} | ||
CreateFile.is = is; | ||
})(CreateFile || (CreateFile = {})); | ||
export var RenameFile; | ||
(function (RenameFile) { | ||
function create(oldUri, newUri, options) { | ||
var result = { | ||
kind: 'rename', | ||
oldUri: oldUri, | ||
newUri: newUri | ||
}; | ||
if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) { | ||
result.options = options; | ||
} | ||
return result; | ||
} | ||
RenameFile.create = create; | ||
function is(value) { | ||
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)))); | ||
} | ||
RenameFile.is = is; | ||
})(RenameFile || (RenameFile = {})); | ||
export var DeleteFile; | ||
(function (DeleteFile) { | ||
function create(uri, options) { | ||
var result = { | ||
kind: 'delete', | ||
uri: uri | ||
}; | ||
if (options !== void 0 && (options.recursive !== void 0 || options.ignoreIfNotExists !== void 0)) { | ||
result.options = options; | ||
} | ||
return result; | ||
} | ||
DeleteFile.create = create; | ||
function is(value) { | ||
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)))); | ||
} | ||
DeleteFile.is = is; | ||
})(DeleteFile || (DeleteFile = {})); | ||
export var WorkspaceEdit; | ||
@@ -406,3 +470,10 @@ (function (WorkspaceEdit) { | ||
(candidate.changes !== void 0 || candidate.documentChanges !== void 0) && | ||
(candidate.documentChanges === void 0 || Is.typedArray(candidate.documentChanges, TextDocumentEdit.is)); | ||
(candidate.documentChanges === void 0 || candidate.documentChanges.every(function (change) { | ||
if (Is.string(change.kind)) { | ||
return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change); | ||
} | ||
else { | ||
return TextDocumentEdit.is(change); | ||
} | ||
})); | ||
} | ||
@@ -445,5 +516,7 @@ WorkspaceEdit.is = is; | ||
if (workspaceEdit.documentChanges) { | ||
workspaceEdit.documentChanges.forEach(function (textDocumentEdit) { | ||
var textEditChange = new TextEditChangeImpl(textDocumentEdit.edits); | ||
_this._textEditChanges[textDocumentEdit.textDocument.uri] = textEditChange; | ||
workspaceEdit.documentChanges.forEach(function (change) { | ||
if (TextDocumentEdit.is(change)) { | ||
var textEditChange = new TextEditChangeImpl(change.edits); | ||
_this._textEditChanges[change.textDocument.uri] = textEditChange; | ||
} | ||
}); | ||
@@ -478,3 +551,3 @@ } | ||
if (!this._workspaceEdit.documentChanges) { | ||
throw new Error('Workspace edit is not configured for versioned document changes.'); | ||
throw new Error('Workspace edit is not configured for document changes.'); | ||
} | ||
@@ -514,2 +587,19 @@ var textDocument = key; | ||
}; | ||
WorkspaceChange.prototype.createFile = function (uri, options) { | ||
this.checkDocumentChanges(); | ||
this._workspaceEdit.documentChanges.push(CreateFile.create(uri, options)); | ||
}; | ||
WorkspaceChange.prototype.renameFile = function (oldUri, newUri, options) { | ||
this.checkDocumentChanges(); | ||
this._workspaceEdit.documentChanges.push(RenameFile.create(oldUri, newUri, options)); | ||
}; | ||
WorkspaceChange.prototype.deleteFile = function (uri, options) { | ||
this.checkDocumentChanges(); | ||
this._workspaceEdit.documentChanges.push(DeleteFile.create(uri, options)); | ||
}; | ||
WorkspaceChange.prototype.checkDocumentChanges = function () { | ||
if (!this._workspaceEdit || !this._workspaceEdit.documentChanges) { | ||
throw new Error('Workspace edit is not configured for document changes.'); | ||
} | ||
}; | ||
return WorkspaceChange; | ||
@@ -561,3 +651,3 @@ }()); | ||
var candidate = value; | ||
return Is.defined(candidate) && Is.string(candidate.uri) && Is.number(candidate.version); | ||
return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.number(candidate.version)); | ||
} | ||
@@ -564,0 +654,0 @@ VersionedTextDocumentIdentifier.is = is; |
@@ -465,2 +465,42 @@ /** | ||
} | ||
export interface CreateFileOptions { | ||
overwrite?: boolean; | ||
ignoreIfExists?: boolean; | ||
} | ||
export interface CreateFile { | ||
kind: 'create'; | ||
uri: string; | ||
options?: CreateFileOptions; | ||
} | ||
export declare namespace CreateFile { | ||
function create(uri: string, options?: CreateFileOptions): CreateFile; | ||
function is(value: any): value is CreateFile; | ||
} | ||
export interface RenameFileOptions { | ||
overwrite?: boolean; | ||
ignoreIfExists?: boolean; | ||
} | ||
export interface RenameFile { | ||
kind: 'rename'; | ||
oldUri: string; | ||
newUri: string; | ||
options?: RenameFileOptions; | ||
} | ||
export declare namespace RenameFile { | ||
function create(oldUri: string, newUri: string, options?: RenameFileOptions): RenameFile; | ||
function is(value: any): value is RenameFile; | ||
} | ||
export interface DeleteFileOptions { | ||
recursive?: boolean; | ||
ignoreIfNotExists?: boolean; | ||
} | ||
export interface DeleteFile { | ||
kind: 'delete'; | ||
uri: string; | ||
options?: DeleteFileOptions; | ||
} | ||
export declare namespace DeleteFile { | ||
function create(uri: string, options?: DeleteFileOptions): DeleteFile; | ||
function is(value: any): value is DeleteFile; | ||
} | ||
/** | ||
@@ -484,3 +524,3 @@ * A workspace edit represents changes to many resources managed in the workspace. The edit | ||
*/ | ||
documentChanges?: TextDocumentEdit[]; | ||
documentChanges?: (TextDocumentEdit | CreateFile | RenameFile | DeleteFile)[]; | ||
} | ||
@@ -548,2 +588,6 @@ export declare namespace WorkspaceEdit { | ||
getTextEditChange(uri: string): TextEditChange; | ||
createFile(uri: string, options?: CreateFileOptions): void; | ||
renameFile(oldUri: string, newUri: string, options?: RenameFileOptions): void; | ||
deleteFile(uri: string, options?: DeleteFileOptions): void; | ||
private checkDocumentChanges; | ||
} | ||
@@ -597,3 +641,3 @@ /** | ||
*/ | ||
function create(uri: string, version: number): VersionedTextDocumentIdentifier; | ||
function create(uri: string, version: number | null): VersionedTextDocumentIdentifier; | ||
/** | ||
@@ -600,0 +644,0 @@ * Checks whether the given literal conforms to the [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) interface. |
@@ -409,2 +409,66 @@ (function (factory) { | ||
})(TextDocumentEdit = exports.TextDocumentEdit || (exports.TextDocumentEdit = {})); | ||
var CreateFile; | ||
(function (CreateFile) { | ||
function create(uri, options) { | ||
var result = { | ||
kind: 'create', | ||
uri: uri | ||
}; | ||
if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) { | ||
result.options = options; | ||
} | ||
return result; | ||
} | ||
CreateFile.create = create; | ||
function is(value) { | ||
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)))); | ||
} | ||
CreateFile.is = is; | ||
})(CreateFile = exports.CreateFile || (exports.CreateFile = {})); | ||
var RenameFile; | ||
(function (RenameFile) { | ||
function create(oldUri, newUri, options) { | ||
var result = { | ||
kind: 'rename', | ||
oldUri: oldUri, | ||
newUri: newUri | ||
}; | ||
if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) { | ||
result.options = options; | ||
} | ||
return result; | ||
} | ||
RenameFile.create = create; | ||
function is(value) { | ||
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)))); | ||
} | ||
RenameFile.is = is; | ||
})(RenameFile = exports.RenameFile || (exports.RenameFile = {})); | ||
var DeleteFile; | ||
(function (DeleteFile) { | ||
function create(uri, options) { | ||
var result = { | ||
kind: 'delete', | ||
uri: uri | ||
}; | ||
if (options !== void 0 && (options.recursive !== void 0 || options.ignoreIfNotExists !== void 0)) { | ||
result.options = options; | ||
} | ||
return result; | ||
} | ||
DeleteFile.create = create; | ||
function is(value) { | ||
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)))); | ||
} | ||
DeleteFile.is = is; | ||
})(DeleteFile = exports.DeleteFile || (exports.DeleteFile = {})); | ||
var WorkspaceEdit; | ||
@@ -416,3 +480,10 @@ (function (WorkspaceEdit) { | ||
(candidate.changes !== void 0 || candidate.documentChanges !== void 0) && | ||
(candidate.documentChanges === void 0 || Is.typedArray(candidate.documentChanges, TextDocumentEdit.is)); | ||
(candidate.documentChanges === void 0 || candidate.documentChanges.every(function (change) { | ||
if (Is.string(change.kind)) { | ||
return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change); | ||
} | ||
else { | ||
return TextDocumentEdit.is(change); | ||
} | ||
})); | ||
} | ||
@@ -455,5 +526,7 @@ WorkspaceEdit.is = is; | ||
if (workspaceEdit.documentChanges) { | ||
workspaceEdit.documentChanges.forEach(function (textDocumentEdit) { | ||
var textEditChange = new TextEditChangeImpl(textDocumentEdit.edits); | ||
_this._textEditChanges[textDocumentEdit.textDocument.uri] = textEditChange; | ||
workspaceEdit.documentChanges.forEach(function (change) { | ||
if (TextDocumentEdit.is(change)) { | ||
var textEditChange = new TextEditChangeImpl(change.edits); | ||
_this._textEditChanges[change.textDocument.uri] = textEditChange; | ||
} | ||
}); | ||
@@ -488,3 +561,3 @@ } | ||
if (!this._workspaceEdit.documentChanges) { | ||
throw new Error('Workspace edit is not configured for versioned document changes.'); | ||
throw new Error('Workspace edit is not configured for document changes.'); | ||
} | ||
@@ -524,2 +597,19 @@ var textDocument = key; | ||
}; | ||
WorkspaceChange.prototype.createFile = function (uri, options) { | ||
this.checkDocumentChanges(); | ||
this._workspaceEdit.documentChanges.push(CreateFile.create(uri, options)); | ||
}; | ||
WorkspaceChange.prototype.renameFile = function (oldUri, newUri, options) { | ||
this.checkDocumentChanges(); | ||
this._workspaceEdit.documentChanges.push(RenameFile.create(oldUri, newUri, options)); | ||
}; | ||
WorkspaceChange.prototype.deleteFile = function (uri, options) { | ||
this.checkDocumentChanges(); | ||
this._workspaceEdit.documentChanges.push(DeleteFile.create(uri, options)); | ||
}; | ||
WorkspaceChange.prototype.checkDocumentChanges = function () { | ||
if (!this._workspaceEdit || !this._workspaceEdit.documentChanges) { | ||
throw new Error('Workspace edit is not configured for document changes.'); | ||
} | ||
}; | ||
return WorkspaceChange; | ||
@@ -571,3 +661,3 @@ }()); | ||
var candidate = value; | ||
return Is.defined(candidate) && Is.string(candidate.uri) && Is.number(candidate.version); | ||
return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.number(candidate.version)); | ||
} | ||
@@ -574,0 +664,0 @@ VersionedTextDocumentIdentifier.is = is; |
{ | ||
"name": "vscode-languageserver-types", | ||
"description": "Types used by the Language server for node", | ||
"version": "3.12.0", | ||
"version": "3.13.0-next.1", | ||
"author": "Microsoft Corporation", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
222745
6282
2