vscode-languageserver-types
Advanced tools
Comparing version 3.0.3 to 3.2.0-alpha.1
@@ -252,3 +252,3 @@ /** | ||
* The TextDocumentEdit namespace provides helper function to create | ||
* create a edit that manipulates a text document. | ||
* an edit that manipulates a text document. | ||
*/ | ||
@@ -263,7 +263,19 @@ export declare namespace TextDocumentEdit { | ||
/** | ||
* A workspace edit represents changes to many resources managed | ||
* in the workspace. | ||
* A workspace edit represents changes to many resources managed in the workspace. The edit | ||
* should either provide `changes` or `documentChanges`. If documentChanges are present | ||
* they are preferred over `changes` if the client can handle versioned document edits. | ||
*/ | ||
export interface WorkspaceEdit { | ||
changes: TextDocumentEdit[]; | ||
/** | ||
* Holds changes to existing resources. | ||
*/ | ||
changes?: { | ||
[uri: string]: TextEdit[]; | ||
}; | ||
/** | ||
* An array of `TextDocumentEdit`s to express changes to specific a specific | ||
* version of a text document. Whether a client supports versioned document | ||
* edits is expressed via `WorkspaceClientCapabilites.versionedWorkspaceEdit`. | ||
*/ | ||
documentChanges?: TextDocumentEdit[]; | ||
} | ||
@@ -270,0 +282,0 @@ /** |
@@ -214,3 +214,3 @@ (function (factory) { | ||
* The TextDocumentEdit namespace provides helper function to create | ||
* create a edit that manipulates a text document. | ||
* an edit that manipulates a text document. | ||
*/ | ||
@@ -267,12 +267,15 @@ var TextDocumentEdit; | ||
this._workspaceEdit = workspaceEdit; | ||
workspaceEdit.changes.forEach(function (textDocumentEdit) { | ||
var textEditChange = new TextEditChangeImpl(textDocumentEdit.edits); | ||
_this._textEditChanges[textDocumentEdit.textDocument.uri] = textEditChange; | ||
}); | ||
if (workspaceEdit.documentChanges) { | ||
workspaceEdit.documentChanges.forEach(function (textDocumentEdit) { | ||
var textEditChange = new TextEditChangeImpl(textDocumentEdit.edits); | ||
_this._textEditChanges[textDocumentEdit.textDocument.uri] = textEditChange; | ||
}); | ||
} | ||
else if (workspaceEdit.changes) { | ||
Object.keys(workspaceEdit.changes).forEach(function (key) { | ||
var textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]); | ||
_this._textEditChanges[key] = textEditChange; | ||
}); | ||
} | ||
} | ||
else { | ||
this._workspaceEdit = { | ||
changes: [] | ||
}; | ||
} | ||
} | ||
@@ -292,2 +295,10 @@ Object.defineProperty(WorkspaceChange.prototype, "edit", { | ||
if (VersionedTextDocumentIdentifier.is(key)) { | ||
if (!this._workspaceEdit) { | ||
this._workspaceEdit = { | ||
documentChanges: [] | ||
}; | ||
} | ||
if (!this._workspaceEdit.documentChanges) { | ||
throw new Error('Workspace edit is not configured for versioned document changes.'); | ||
} | ||
var textDocument = key; | ||
@@ -301,3 +312,3 @@ var result = this._textEditChanges[textDocument.uri]; | ||
}; | ||
this._workspaceEdit.changes.push(textDocumentEdit); | ||
this._workspaceEdit.documentChanges.push(textDocumentEdit); | ||
result = new TextEditChangeImpl(edits); | ||
@@ -309,3 +320,18 @@ this._textEditChanges[textDocument.uri] = result; | ||
else { | ||
return this._textEditChanges[key]; | ||
if (!this._workspaceEdit) { | ||
this._workspaceEdit = { | ||
changes: Object.create(null) | ||
}; | ||
} | ||
if (!this._workspaceEdit.changes) { | ||
throw new Error('Workspace edit is not configured for normal text edit changes.'); | ||
} | ||
var result = this._textEditChanges[key]; | ||
if (!result) { | ||
var edits = []; | ||
this._workspaceEdit.changes[key] = edits; | ||
result = new TextEditChangeImpl(edits); | ||
this._textEditChanges[key] = result; | ||
} | ||
return result; | ||
} | ||
@@ -312,0 +338,0 @@ }; |
{ | ||
"name": "vscode-languageserver-types", | ||
"description": "Types used by the Language server for node", | ||
"version": "3.0.3", | ||
"version": "3.2.0-alpha.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
71780
1984
2