UNPKG

coc-tsserver

Version:

javascript and typescript language features extension of coc.nvim

1,180 lines (1,178 loc) 659 kB
var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __esm = (fn, res) => function __init() { return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res; }; var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var __decorateClass = (decorators, target, key, kind) => { var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target; for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result; if (kind && result) __defProp(target, key, result); return result; }; // node_modules/vscode-languageserver-types/lib/esm/main.js var main_exports = {}; __export(main_exports, { AnnotatedTextEdit: () => AnnotatedTextEdit, ChangeAnnotation: () => ChangeAnnotation, ChangeAnnotationIdentifier: () => ChangeAnnotationIdentifier, CodeAction: () => CodeAction, CodeActionContext: () => CodeActionContext, CodeActionKind: () => CodeActionKind, CodeActionTriggerKind: () => CodeActionTriggerKind, CodeDescription: () => CodeDescription, CodeLens: () => CodeLens, Color: () => Color, ColorInformation: () => ColorInformation, ColorPresentation: () => ColorPresentation, Command: () => Command, CompletionItem: () => CompletionItem, CompletionItemKind: () => CompletionItemKind, CompletionItemLabelDetails: () => CompletionItemLabelDetails, CompletionItemTag: () => CompletionItemTag, CompletionList: () => CompletionList, CreateFile: () => CreateFile, DeleteFile: () => DeleteFile, Diagnostic: () => Diagnostic, DiagnosticRelatedInformation: () => DiagnosticRelatedInformation, DiagnosticSeverity: () => DiagnosticSeverity, DiagnosticTag: () => DiagnosticTag, DocumentHighlight: () => DocumentHighlight, DocumentHighlightKind: () => DocumentHighlightKind, DocumentLink: () => DocumentLink, DocumentSymbol: () => DocumentSymbol, DocumentUri: () => DocumentUri, EOL: () => EOL, FoldingRange: () => FoldingRange, FoldingRangeKind: () => FoldingRangeKind, FormattingOptions: () => FormattingOptions, Hover: () => Hover, InlayHint: () => InlayHint, InlayHintKind: () => InlayHintKind, InlayHintLabelPart: () => InlayHintLabelPart, InlineValueContext: () => InlineValueContext, InlineValueEvaluatableExpression: () => InlineValueEvaluatableExpression, InlineValueText: () => InlineValueText, InlineValueVariableLookup: () => InlineValueVariableLookup, InsertReplaceEdit: () => InsertReplaceEdit, InsertTextFormat: () => InsertTextFormat, InsertTextMode: () => InsertTextMode, Location: () => Location, LocationLink: () => LocationLink, MarkedString: () => MarkedString, MarkupContent: () => MarkupContent, MarkupKind: () => MarkupKind, OptionalVersionedTextDocumentIdentifier: () => OptionalVersionedTextDocumentIdentifier, ParameterInformation: () => ParameterInformation, Position: () => Position, Range: () => Range, RenameFile: () => RenameFile, SelectionRange: () => SelectionRange, SemanticTokenModifiers: () => SemanticTokenModifiers, SemanticTokenTypes: () => SemanticTokenTypes, SemanticTokens: () => SemanticTokens, SignatureInformation: () => SignatureInformation, SymbolInformation: () => SymbolInformation, SymbolKind: () => SymbolKind, SymbolTag: () => SymbolTag, TextDocument: () => TextDocument, TextDocumentEdit: () => TextDocumentEdit, TextDocumentIdentifier: () => TextDocumentIdentifier, TextDocumentItem: () => TextDocumentItem, TextEdit: () => TextEdit, URI: () => URI, VersionedTextDocumentIdentifier: () => VersionedTextDocumentIdentifier, WorkspaceChange: () => WorkspaceChange, WorkspaceEdit: () => WorkspaceEdit, WorkspaceFolder: () => WorkspaceFolder, WorkspaceSymbol: () => WorkspaceSymbol, integer: () => integer, uinteger: () => uinteger }); var DocumentUri, URI, integer, uinteger, Position, Range, Location, LocationLink, Color, ColorInformation, ColorPresentation, FoldingRangeKind, FoldingRange, DiagnosticRelatedInformation, DiagnosticSeverity, DiagnosticTag, CodeDescription, Diagnostic, Command, TextEdit, ChangeAnnotation, ChangeAnnotationIdentifier, AnnotatedTextEdit, TextDocumentEdit, CreateFile, RenameFile, DeleteFile, WorkspaceEdit, TextEditChangeImpl, ChangeAnnotations, WorkspaceChange, TextDocumentIdentifier, VersionedTextDocumentIdentifier, OptionalVersionedTextDocumentIdentifier, TextDocumentItem, MarkupKind, MarkupContent, CompletionItemKind, InsertTextFormat, CompletionItemTag, InsertReplaceEdit, InsertTextMode, CompletionItemLabelDetails, CompletionItem, CompletionList, MarkedString, Hover, ParameterInformation, SignatureInformation, DocumentHighlightKind, DocumentHighlight, SymbolKind, SymbolTag, SymbolInformation, WorkspaceSymbol, DocumentSymbol, CodeActionKind, CodeActionTriggerKind, CodeActionContext, CodeAction, CodeLens, FormattingOptions, DocumentLink, SelectionRange, SemanticTokenTypes, SemanticTokenModifiers, SemanticTokens, InlineValueText, InlineValueVariableLookup, InlineValueEvaluatableExpression, InlineValueContext, InlayHintKind, InlayHintLabelPart, InlayHint, WorkspaceFolder, EOL, TextDocument, FullTextDocument, Is; var init_main = __esm({ "node_modules/vscode-languageserver-types/lib/esm/main.js"() { "use strict"; (function(DocumentUri2) { function is(value) { return typeof value === "string"; } DocumentUri2.is = is; })(DocumentUri || (DocumentUri = {})); (function(URI3) { function is(value) { return typeof value === "string"; } URI3.is = is; })(URI || (URI = {})); (function(integer2) { integer2.MIN_VALUE = -2147483648; integer2.MAX_VALUE = 2147483647; function is(value) { return typeof value === "number" && integer2.MIN_VALUE <= value && value <= integer2.MAX_VALUE; } integer2.is = is; })(integer || (integer = {})); (function(uinteger2) { uinteger2.MIN_VALUE = 0; uinteger2.MAX_VALUE = 2147483647; function is(value) { return typeof value === "number" && uinteger2.MIN_VALUE <= value && value <= uinteger2.MAX_VALUE; } uinteger2.is = is; })(uinteger || (uinteger = {})); (function(Position11) { function create(line, character) { if (line === Number.MAX_VALUE) { line = uinteger.MAX_VALUE; } if (character === Number.MAX_VALUE) { character = uinteger.MAX_VALUE; } return { line, character }; } Position11.create = create; function is(value) { var candidate = value; return Is.objectLiteral(candidate) && Is.uinteger(candidate.line) && Is.uinteger(candidate.character); } Position11.is = is; })(Position || (Position = {})); (function(Range21) { function create(one, two, three, 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) }; } else if (Position.is(one) && Position.is(two)) { return { start: one, end: two }; } else { throw new Error("Range#create called with invalid arguments[".concat(one, ", ").concat(two, ", ").concat(three, ", ").concat(four, "]")); } } Range21.create = create; function is(value) { var candidate = value; return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end); } Range21.is = is; })(Range || (Range = {})); (function(Location4) { function create(uri, range) { return { uri, range }; } Location4.create = create; function is(value) { var candidate = value; return Is.objectLiteral(candidate) && Range.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri)); } Location4.is = is; })(Location || (Location = {})); (function(LocationLink3) { function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) { return { targetUri, targetRange, targetSelectionRange, originSelectionRange }; } LocationLink3.create = create; function is(value) { var candidate = value; return Is.objectLiteral(candidate) && Range.is(candidate.targetRange) && Is.string(candidate.targetUri) && Range.is(candidate.targetSelectionRange) && (Range.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange)); } LocationLink3.is = is; })(LocationLink || (LocationLink = {})); (function(Color2) { function create(red, green, blue, alpha) { return { red, green, blue, alpha }; } Color2.create = create; function is(value) { var candidate = value; return Is.objectLiteral(candidate) && Is.numberRange(candidate.red, 0, 1) && Is.numberRange(candidate.green, 0, 1) && Is.numberRange(candidate.blue, 0, 1) && Is.numberRange(candidate.alpha, 0, 1); } Color2.is = is; })(Color || (Color = {})); (function(ColorInformation2) { function create(range, color) { return { range, color }; } ColorInformation2.create = create; function is(value) { var candidate = value; return Is.objectLiteral(candidate) && Range.is(candidate.range) && Color.is(candidate.color); } ColorInformation2.is = is; })(ColorInformation || (ColorInformation = {})); (function(ColorPresentation2) { function create(label, textEdit, additionalTextEdits) { return { label, textEdit, additionalTextEdits }; } ColorPresentation2.create = create; function is(value) { var candidate = value; return Is.objectLiteral(candidate) && Is.string(candidate.label) && (Is.undefined(candidate.textEdit) || TextEdit.is(candidate)) && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is)); } ColorPresentation2.is = is; })(ColorPresentation || (ColorPresentation = {})); (function(FoldingRangeKind2) { FoldingRangeKind2.Comment = "comment"; FoldingRangeKind2.Imports = "imports"; FoldingRangeKind2.Region = "region"; })(FoldingRangeKind || (FoldingRangeKind = {})); (function(FoldingRange2) { function create(startLine, endLine, startCharacter, endCharacter, kind, collapsedText) { var result = { startLine, endLine }; if (Is.defined(startCharacter)) { result.startCharacter = startCharacter; } if (Is.defined(endCharacter)) { result.endCharacter = endCharacter; } if (Is.defined(kind)) { result.kind = kind; } if (Is.defined(collapsedText)) { result.collapsedText = collapsedText; } return result; } FoldingRange2.create = create; function is(value) { var candidate = value; return Is.objectLiteral(candidate) && 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)); } FoldingRange2.is = is; })(FoldingRange || (FoldingRange = {})); (function(DiagnosticRelatedInformation3) { function create(location, message) { return { location, message }; } DiagnosticRelatedInformation3.create = create; function is(value) { var candidate = value; return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message); } DiagnosticRelatedInformation3.is = is; })(DiagnosticRelatedInformation || (DiagnosticRelatedInformation = {})); (function(DiagnosticSeverity4) { DiagnosticSeverity4.Error = 1; DiagnosticSeverity4.Warning = 2; DiagnosticSeverity4.Information = 3; DiagnosticSeverity4.Hint = 4; })(DiagnosticSeverity || (DiagnosticSeverity = {})); (function(DiagnosticTag4) { DiagnosticTag4.Unnecessary = 1; DiagnosticTag4.Deprecated = 2; })(DiagnosticTag || (DiagnosticTag = {})); (function(CodeDescription2) { function is(value) { var candidate = value; return Is.objectLiteral(candidate) && Is.string(candidate.href); } CodeDescription2.is = is; })(CodeDescription || (CodeDescription = {})); (function(Diagnostic8) { function create(range, message, severity, code, source, relatedInformation) { var result = { range, message }; if (Is.defined(severity)) { result.severity = severity; } if (Is.defined(code)) { result.code = code; } if (Is.defined(source)) { result.source = source; } if (Is.defined(relatedInformation)) { result.relatedInformation = relatedInformation; } return result; } Diagnostic8.create = create; function is(value) { var _a; var candidate = value; return Is.defined(candidate) && Range.is(candidate.range) && Is.string(candidate.message) && (Is.number(candidate.severity) || Is.undefined(candidate.severity)) && (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)) && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is)); } Diagnostic8.is = is; })(Diagnostic || (Diagnostic = {})); (function(Command6) { function create(title, command) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } var result = { title, command }; if (Is.defined(args) && args.length > 0) { result.arguments = args; } return result; } Command6.create = create; function is(value) { var candidate = value; return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command); } Command6.is = is; })(Command || (Command = {})); (function(TextEdit7) { function replace(range, newText) { return { range, newText }; } TextEdit7.replace = replace; function insert(position, newText) { return { range: { start: position, end: position }, newText }; } TextEdit7.insert = insert; function del(range) { return { range, newText: "" }; } TextEdit7.del = del; function is(value) { var candidate = value; return Is.objectLiteral(candidate) && Is.string(candidate.newText) && Range.is(candidate.range); } TextEdit7.is = is; })(TextEdit || (TextEdit = {})); (function(ChangeAnnotation2) { function create(label, needsConfirmation, description) { var result = { label }; if (needsConfirmation !== void 0) { result.needsConfirmation = needsConfirmation; } if (description !== void 0) { result.description = description; } return result; } ChangeAnnotation2.create = create; function is(value) { var candidate = value; return Is.objectLiteral(candidate) && Is.string(candidate.label) && (Is.boolean(candidate.needsConfirmation) || candidate.needsConfirmation === void 0) && (Is.string(candidate.description) || candidate.description === void 0); } ChangeAnnotation2.is = is; })(ChangeAnnotation || (ChangeAnnotation = {})); (function(ChangeAnnotationIdentifier2) { function is(value) { var candidate = value; return Is.string(candidate); } ChangeAnnotationIdentifier2.is = is; })(ChangeAnnotationIdentifier || (ChangeAnnotationIdentifier = {})); (function(AnnotatedTextEdit2) { function replace(range, newText, annotation) { return { range, newText, annotationId: annotation }; } AnnotatedTextEdit2.replace = replace; function insert(position, newText, annotation) { return { range: { start: position, end: position }, newText, annotationId: annotation }; } AnnotatedTextEdit2.insert = insert; function del(range, annotation) { return { range, newText: "", annotationId: annotation }; } AnnotatedTextEdit2.del = del; function is(value) { var candidate = value; return TextEdit.is(candidate) && (ChangeAnnotation.is(candidate.annotationId) || ChangeAnnotationIdentifier.is(candidate.annotationId)); } AnnotatedTextEdit2.is = is; })(AnnotatedTextEdit || (AnnotatedTextEdit = {})); (function(TextDocumentEdit2) { function create(textDocument, edits) { return { textDocument, edits }; } TextDocumentEdit2.create = create; function is(value) { var candidate = value; return Is.defined(candidate) && OptionalVersionedTextDocumentIdentifier.is(candidate.textDocument) && Array.isArray(candidate.edits); } TextDocumentEdit2.is = is; })(TextDocumentEdit || (TextDocumentEdit = {})); (function(CreateFile2) { function create(uri, options, annotation) { var result = { kind: "create", uri }; if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) { result.options = options; } if (annotation !== void 0) { result.annotationId = annotation; } return result; } CreateFile2.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))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId)); } CreateFile2.is = is; })(CreateFile || (CreateFile = {})); (function(RenameFile2) { function create(oldUri, newUri, options, annotation) { var result = { kind: "rename", oldUri, newUri }; if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) { result.options = options; } if (annotation !== void 0) { result.annotationId = annotation; } return result; } RenameFile2.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))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId)); } RenameFile2.is = is; })(RenameFile || (RenameFile = {})); (function(DeleteFile2) { function create(uri, options, annotation) { var result = { kind: "delete", uri }; if (options !== void 0 && (options.recursive !== void 0 || options.ignoreIfNotExists !== void 0)) { result.options = options; } if (annotation !== void 0) { result.annotationId = annotation; } return result; } DeleteFile2.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))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId)); } DeleteFile2.is = is; })(DeleteFile || (DeleteFile = {})); (function(WorkspaceEdit8) { function is(value) { var candidate = value; return candidate && (candidate.changes !== void 0 || candidate.documentChanges !== void 0) && (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); } })); } WorkspaceEdit8.is = is; })(WorkspaceEdit || (WorkspaceEdit = {})); TextEditChangeImpl = /** @class */ function() { function TextEditChangeImpl2(edits, changeAnnotations) { this.edits = edits; this.changeAnnotations = changeAnnotations; } TextEditChangeImpl2.prototype.insert = function(position, newText, annotation) { var edit; var id; if (annotation === void 0) { edit = TextEdit.insert(position, newText); } else if (ChangeAnnotationIdentifier.is(annotation)) { id = annotation; edit = AnnotatedTextEdit.insert(position, newText, annotation); } else { this.assertChangeAnnotations(this.changeAnnotations); id = this.changeAnnotations.manage(annotation); edit = AnnotatedTextEdit.insert(position, newText, id); } this.edits.push(edit); if (id !== void 0) { return id; } }; TextEditChangeImpl2.prototype.replace = function(range, newText, annotation) { var edit; var id; if (annotation === void 0) { edit = TextEdit.replace(range, newText); } else if (ChangeAnnotationIdentifier.is(annotation)) { id = annotation; edit = AnnotatedTextEdit.replace(range, newText, annotation); } else { this.assertChangeAnnotations(this.changeAnnotations); id = this.changeAnnotations.manage(annotation); edit = AnnotatedTextEdit.replace(range, newText, id); } this.edits.push(edit); if (id !== void 0) { return id; } }; TextEditChangeImpl2.prototype.delete = function(range, annotation) { var edit; var id; if (annotation === void 0) { edit = TextEdit.del(range); } else if (ChangeAnnotationIdentifier.is(annotation)) { id = annotation; edit = AnnotatedTextEdit.del(range, annotation); } else { this.assertChangeAnnotations(this.changeAnnotations); id = this.changeAnnotations.manage(annotation); edit = AnnotatedTextEdit.del(range, id); } this.edits.push(edit); if (id !== void 0) { return id; } }; TextEditChangeImpl2.prototype.add = function(edit) { this.edits.push(edit); }; TextEditChangeImpl2.prototype.all = function() { return this.edits; }; TextEditChangeImpl2.prototype.clear = function() { this.edits.splice(0, this.edits.length); }; TextEditChangeImpl2.prototype.assertChangeAnnotations = function(value) { if (value === void 0) { throw new Error("Text edit change is not configured to manage change annotations."); } }; return TextEditChangeImpl2; }(); ChangeAnnotations = /** @class */ function() { function ChangeAnnotations2(annotations) { this._annotations = annotations === void 0 ? /* @__PURE__ */ Object.create(null) : annotations; this._counter = 0; this._size = 0; } ChangeAnnotations2.prototype.all = function() { return this._annotations; }; Object.defineProperty(ChangeAnnotations2.prototype, "size", { get: function() { return this._size; }, enumerable: false, configurable: true }); ChangeAnnotations2.prototype.manage = function(idOrAnnotation, annotation) { var id; if (ChangeAnnotationIdentifier.is(idOrAnnotation)) { id = idOrAnnotation; } else { id = this.nextId(); annotation = idOrAnnotation; } if (this._annotations[id] !== void 0) { throw new Error("Id ".concat(id, " is already in use.")); } if (annotation === void 0) { throw new Error("No annotation provided for id ".concat(id)); } this._annotations[id] = annotation; this._size++; return id; }; ChangeAnnotations2.prototype.nextId = function() { this._counter++; return this._counter.toString(); }; return ChangeAnnotations2; }(); WorkspaceChange = /** @class */ function() { function WorkspaceChange2(workspaceEdit) { var _this = this; this._textEditChanges = /* @__PURE__ */ Object.create(null); if (workspaceEdit !== void 0) { this._workspaceEdit = workspaceEdit; if (workspaceEdit.documentChanges) { this._changeAnnotations = new ChangeAnnotations(workspaceEdit.changeAnnotations); workspaceEdit.changeAnnotations = this._changeAnnotations.all(); workspaceEdit.documentChanges.forEach(function(change) { if (TextDocumentEdit.is(change)) { var textEditChange = new TextEditChangeImpl(change.edits, _this._changeAnnotations); _this._textEditChanges[change.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 = {}; } } Object.defineProperty(WorkspaceChange2.prototype, "edit", { /** * Returns the underlying [WorkspaceEdit](#WorkspaceEdit) literal * use to be returned from a workspace edit operation like rename. */ get: function() { this.initDocumentChanges(); if (this._changeAnnotations !== void 0) { if (this._changeAnnotations.size === 0) { this._workspaceEdit.changeAnnotations = void 0; } else { this._workspaceEdit.changeAnnotations = this._changeAnnotations.all(); } } return this._workspaceEdit; }, enumerable: false, configurable: true }); WorkspaceChange2.prototype.getTextEditChange = function(key) { if (OptionalVersionedTextDocumentIdentifier.is(key)) { this.initDocumentChanges(); if (this._workspaceEdit.documentChanges === void 0) { throw new Error("Workspace edit is not configured for document changes."); } var textDocument = { uri: key.uri, version: key.version }; var result = this._textEditChanges[textDocument.uri]; if (!result) { var edits = []; var textDocumentEdit = { textDocument, edits }; this._workspaceEdit.documentChanges.push(textDocumentEdit); result = new TextEditChangeImpl(edits, this._changeAnnotations); this._textEditChanges[textDocument.uri] = result; } return result; } else { this.initChanges(); if (this._workspaceEdit.changes === void 0) { 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; } }; WorkspaceChange2.prototype.initDocumentChanges = function() { if (this._workspaceEdit.documentChanges === void 0 && this._workspaceEdit.changes === void 0) { this._changeAnnotations = new ChangeAnnotations(); this._workspaceEdit.documentChanges = []; this._workspaceEdit.changeAnnotations = this._changeAnnotations.all(); } }; WorkspaceChange2.prototype.initChanges = function() { if (this._workspaceEdit.documentChanges === void 0 && this._workspaceEdit.changes === void 0) { this._workspaceEdit.changes = /* @__PURE__ */ Object.create(null); } }; WorkspaceChange2.prototype.createFile = function(uri, optionsOrAnnotation, options) { this.initDocumentChanges(); if (this._workspaceEdit.documentChanges === void 0) { throw new Error("Workspace edit is not configured for document changes."); } var annotation; if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) { annotation = optionsOrAnnotation; } else { options = optionsOrAnnotation; } var operation; var id; if (annotation === void 0) { operation = CreateFile.create(uri, options); } else { id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation); operation = CreateFile.create(uri, options, id); } this._workspaceEdit.documentChanges.push(operation); if (id !== void 0) { return id; } }; WorkspaceChange2.prototype.renameFile = function(oldUri, newUri, optionsOrAnnotation, options) { this.initDocumentChanges(); if (this._workspaceEdit.documentChanges === void 0) { throw new Error("Workspace edit is not configured for document changes."); } var annotation; if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) { annotation = optionsOrAnnotation; } else { options = optionsOrAnnotation; } var operation; var id; if (annotation === void 0) { operation = RenameFile.create(oldUri, newUri, options); } else { id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation); operation = RenameFile.create(oldUri, newUri, options, id); } this._workspaceEdit.documentChanges.push(operation); if (id !== void 0) { return id; } }; WorkspaceChange2.prototype.deleteFile = function(uri, optionsOrAnnotation, options) { this.initDocumentChanges(); if (this._workspaceEdit.documentChanges === void 0) { throw new Error("Workspace edit is not configured for document changes."); } var annotation; if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) { annotation = optionsOrAnnotation; } else { options = optionsOrAnnotation; } var operation; var id; if (annotation === void 0) { operation = DeleteFile.create(uri, options); } else { id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation); operation = DeleteFile.create(uri, options, id); } this._workspaceEdit.documentChanges.push(operation); if (id !== void 0) { return id; } }; return WorkspaceChange2; }(); (function(TextDocumentIdentifier2) { function create(uri) { return { uri }; } TextDocumentIdentifier2.create = create; function is(value) { var candidate = value; return Is.defined(candidate) && Is.string(candidate.uri); } TextDocumentIdentifier2.is = is; })(TextDocumentIdentifier || (TextDocumentIdentifier = {})); (function(VersionedTextDocumentIdentifier2) { function create(uri, version) { return { uri, version }; } VersionedTextDocumentIdentifier2.create = create; function is(value) { var candidate = value; return Is.defined(candidate) && Is.string(candidate.uri) && Is.integer(candidate.version); } VersionedTextDocumentIdentifier2.is = is; })(VersionedTextDocumentIdentifier || (VersionedTextDocumentIdentifier = {})); (function(OptionalVersionedTextDocumentIdentifier2) { function create(uri, version) { return { uri, version }; } OptionalVersionedTextDocumentIdentifier2.create = create; function is(value) { var candidate = value; return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.integer(candidate.version)); } OptionalVersionedTextDocumentIdentifier2.is = is; })(OptionalVersionedTextDocumentIdentifier || (OptionalVersionedTextDocumentIdentifier = {})); (function(TextDocumentItem2) { function create(uri, languageId, version, text) { return { uri, languageId, version, text }; } TextDocumentItem2.create = create; function is(value) { var candidate = value; return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.integer(candidate.version) && Is.string(candidate.text); } TextDocumentItem2.is = is; })(TextDocumentItem || (TextDocumentItem = {})); (function(MarkupKind4) { MarkupKind4.PlainText = "plaintext"; MarkupKind4.Markdown = "markdown"; function is(value) { var candidate = value; return candidate === MarkupKind4.PlainText || candidate === MarkupKind4.Markdown; } MarkupKind4.is = is; })(MarkupKind || (MarkupKind = {})); (function(MarkupContent4) { function is(value) { var candidate = value; return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value); } MarkupContent4.is = is; })(MarkupContent || (MarkupContent = {})); (function(CompletionItemKind5) { CompletionItemKind5.Text = 1; CompletionItemKind5.Method = 2; CompletionItemKind5.Function = 3; CompletionItemKind5.Constructor = 4; CompletionItemKind5.Field = 5; CompletionItemKind5.Variable = 6; CompletionItemKind5.Class = 7; CompletionItemKind5.Interface = 8; CompletionItemKind5.Module = 9; CompletionItemKind5.Property = 10; CompletionItemKind5.Unit = 11; CompletionItemKind5.Value = 12; CompletionItemKind5.Enum = 13; CompletionItemKind5.Keyword = 14; CompletionItemKind5.Snippet = 15; CompletionItemKind5.Color = 16; CompletionItemKind5.File = 17; CompletionItemKind5.Reference = 18; CompletionItemKind5.Folder = 19; CompletionItemKind5.EnumMember = 20; CompletionItemKind5.Constant = 21; CompletionItemKind5.Struct = 22; CompletionItemKind5.Event = 23; CompletionItemKind5.Operator = 24; CompletionItemKind5.TypeParameter = 25; })(CompletionItemKind || (CompletionItemKind = {})); (function(InsertTextFormat5) { InsertTextFormat5.PlainText = 1; InsertTextFormat5.Snippet = 2; })(InsertTextFormat || (InsertTextFormat = {})); (function(CompletionItemTag3) { CompletionItemTag3.Deprecated = 1; })(CompletionItemTag || (CompletionItemTag = {})); (function(InsertReplaceEdit3) { function create(newText, insert, replace) { return { newText, insert, replace }; } InsertReplaceEdit3.create = create; function is(value) { var candidate = value; return candidate && Is.string(candidate.newText) && Range.is(candidate.insert) && Range.is(candidate.replace); } InsertReplaceEdit3.is = is; })(InsertReplaceEdit || (InsertReplaceEdit = {})); (function(InsertTextMode2) { InsertTextMode2.asIs = 1; InsertTextMode2.adjustIndentation = 2; })(InsertTextMode || (InsertTextMode = {})); (function(CompletionItemLabelDetails2) { function is(value) { var candidate = value; return candidate && (Is.string(candidate.detail) || candidate.detail === void 0) && (Is.string(candidate.description) || candidate.description === void 0); } CompletionItemLabelDetails2.is = is; })(CompletionItemLabelDetails || (CompletionItemLabelDetails = {})); (function(CompletionItem6) { function create(label) { return { label }; } CompletionItem6.create = create; })(CompletionItem || (CompletionItem = {})); (function(CompletionList4) { function create(items, isIncomplete) { return { items: items ? items : [], isIncomplete: !!isIncomplete }; } CompletionList4.create = create; })(CompletionList || (CompletionList = {})); (function(MarkedString2) { function fromPlainText(plainText) { return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, "\\$&"); } MarkedString2.fromPlainText = fromPlainText; function is(value) { var candidate = value; return Is.string(candidate) || Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value); } MarkedString2.is = is; })(MarkedString || (MarkedString = {})); (function(Hover2) { function is(value) { var candidate = value; return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) || MarkedString.is(candidate.contents) || Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === void 0 || Range.is(value.range)); } Hover2.is = is; })(Hover || (Hover = {})); (function(ParameterInformation2) { function create(label, documentation) { return documentation ? { label, documentation } : { label }; } ParameterInformation2.create = create; })(ParameterInformation || (ParameterInformation = {})); (function(SignatureInformation2) { function create(label, documentation) { var parameters = []; for (var _i = 2; _i < arguments.length; _i++) { parameters[_i - 2] = arguments[_i]; } var result = { label }; if (Is.defined(documentation)) { result.documentation = documentation; } if (Is.defined(parameters)) { result.parameters = parameters; } else { result.parameters = []; } return result; } SignatureInformation2.create = create; })(SignatureInformation || (SignatureInformation = {})); (function(DocumentHighlightKind3) { DocumentHighlightKind3.Text = 1; DocumentHighlightKind3.Read = 2; DocumentHighlightKind3.Write = 3; })(DocumentHighlightKind || (DocumentHighlightKind = {})); (function(DocumentHighlight3) { function create(range, kind) { var result = { range }; if (Is.number(kind)) { result.kind = kind; } return result; } DocumentHighlight3.create = create; })(DocumentHighlight || (DocumentHighlight = {})); (function(SymbolKind6) { SymbolKind6.File = 1; SymbolKind6.Module = 2; SymbolKind6.Namespace = 3; SymbolKind6.Package = 4; SymbolKind6.Class = 5; SymbolKind6.Method = 6; SymbolKind6.Property = 7; SymbolKind6.Field = 8; SymbolKind6.Constructor = 9; SymbolKind6.Enum = 10; SymbolKind6.Interface = 11; SymbolKind6.Function = 12; SymbolKind6.Variable = 13; SymbolKind6.Constant = 14; SymbolKind6.String = 15; SymbolKind6.Number = 16; SymbolKind6.Boolean = 17; SymbolKind6.Array = 18; SymbolKind6.Object = 19; SymbolKind6.Key = 20; SymbolKind6.Null = 21; SymbolKind6.EnumMember = 22; SymbolKind6.Struct = 23; SymbolKind6.Event = 24; SymbolKind6.Operator = 25; SymbolKind6.TypeParameter = 26; })(SymbolKind || (SymbolKind = {})); (function(SymbolTag5) { SymbolTag5.Deprecated = 1; })(SymbolTag || (SymbolTag = {})); (function(SymbolInformation3) { function create(name, kind, range, uri, containerName) { var result = { name, kind, location: { uri, range } }; if (containerName) { result.containerName = containerName; } return result; } SymbolInformation3.create = create; })(SymbolInformation || (SymbolInformation = {})); (function(WorkspaceSymbol2) { function create(name, kind, uri, range) { return range !== void 0 ? { name, kind, location: { uri, range } } : { name, kind, location: { uri } }; } WorkspaceSymbol2.create = create; })(WorkspaceSymbol || (WorkspaceSymbol = {})); (function(DocumentSymbol3) { function create(name, detail, kind, range, selectionRange, children) { var result = { name, detail, kind, range, selectionRange }; if (children !== void 0) { result.children = children; } return result; } DocumentSymbol3.create = create; function is(value) { var candidate = value; return candidate && Is.string(candidate.name) && Is.number(candidate.kind) && 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)); } DocumentSymbol3.is = is; })(DocumentSymbol || (DocumentSymbol = {})); (function(CodeActionKind8) { CodeActionKind8.Empty = ""; CodeActionKind8.QuickFix = "quickfix"; CodeActionKind8.Refactor = "refactor"; CodeActionKind8.RefactorExtract = "refactor.extract"; CodeActionKind8.RefactorInline = "refactor.inline"; CodeActionKind8.RefactorRewrite = "refactor.rewrite"; CodeActionKind8.Source = "source"; CodeActionKind8.SourceOrganizeImports = "source.organizeImports"; CodeActionKind8.SourceFixAll = "source.fixAll"; })(CodeActionKind || (CodeActionKind = {})); (function(CodeActionTriggerKind3) { CodeActionTriggerKind3.Invoked = 1; CodeActionTriggerKind3.Automatic = 2; })(CodeActionTriggerKind || (CodeActionTriggerKind = {})); (function(CodeActionContext8) { function create(diagnostics, only, triggerKind) { var result = { diagnostics }; if (only !== void 0 && only !== null) { result.only = only; } if (triggerKind !== void 0 && triggerKind !== null) { result.triggerKind = triggerKind; } return result; } CodeActionContext8.create = create; function is(value) { var candidate = value; return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is) && (candidate.only === void 0 || Is.typedArray(candidate.only, Is.string)) && (candidate.triggerKind === void 0 || candidate.triggerKind === CodeActionTriggerKind.Invoked || candidate.triggerKind === CodeActionTriggerKind.Automatic); } CodeActionContext8.is = is; })(CodeActionContext || (CodeActionContext = {})); (function(CodeAction8) { function create(title, kindOrCommandOrEdit, kind) { var result = { title }; var checkKind = true; if (typeof kindOrCommandOrEdit === "string") { checkKind = false; result.kind = kindOrCommandOrEdit; } else if (Command.is(kindOrCommandOrEdit)) { result.command = kindOrCommandOrEdit; } else { result.edit = kindOrCommandOrEdit; } if (checkKind && kind !== void 0) { result.kind = kind; } return result; } CodeAction8.create = create; function is(value) { var candidate = value; 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)); } CodeAction8.is = is; })(CodeAction || (CodeAction = {})); (function(CodeLens3) { function create(range, data) { var result = { range }; if (Is.defined(data)) { result.data = data; } return result; } CodeLens3.create = create; function is(value) { var candidate = value; return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command)); } CodeLens3.is = is; })(CodeLens || (CodeLens = {})); (function(FormattingOptions3) { function create(tabSize, insertSpaces) { return { tabSize, insertSpaces }; } FormattingOptions3.create = create; function is(value) { var candidate = value; return Is.defined(candidate) && Is.uinteger(candidate.tabSize) && Is.boolean(candidate.insertSpaces); } FormattingOptions3.is = is; })(FormattingOptions || (FormattingOptions = {})); (function(DocumentLink2) { function create(range, target, data) { return { range, target, data }; } DocumentLink2.create = create; function is(value) { var candidate = value; return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target)); } DocumentLink2.is = is; })(DocumentLink || (DocumentLink = {})); (function(SelectionRange2) { function create(range, parent) { return { range, parent }; } SelectionRange2.create = create; function is(value) { var candidate = value; return Is.objectLiteral(candidate) && Range.is(candidate.range) && (candidate.parent === void 0 || SelectionRange2.is(candidate.parent)); } SelectionRange2.is = is; })(SelectionRange || (SelectionRange = {})); (function(SemanticTokenTypes2) { SemanticTokenTypes2["namespace"] = "namespace"; SemanticTokenTypes2["type"] = "type"; SemanticTokenTypes2["class"] = "class"; SemanticTokenTypes2["enum"] = "enum"; SemanticTokenTypes2["interface"] = "interface"; SemanticTokenTypes2["struct"] = "struct"; SemanticTokenTypes2["typeParameter"] = "typeParameter"; SemanticTokenTypes2["parameter"] = "parameter"; SemanticTokenTypes2["variable"] = "variable"; SemanticTokenTypes2["property"] = "property"; SemanticTokenTypes2["enumMember"] = "enumMember"; SemanticTokenTypes2["event"] = "event"; SemanticTokenTypes2["function"] = "function"; SemanticTokenTypes2["method"] = "method"; SemanticTokenTypes2["macro"] = "macro"; SemanticTokenTypes2["keyword"] = "keyword"; SemanticTokenTypes2["modifier"] = "modifier"; SemanticTokenTypes2["comment"] = "comment"; SemanticTokenTypes2["string"] = "string"; SemanticTokenTypes2["number"] = "number"; SemanticTokenTypes2["regexp"] = "regexp";