diff --git a/.github/workflows/typescript.yml b/.github/workflows/typescript.yml index c91acbf2..bf501b12 100644 --- a/.github/workflows/typescript.yml +++ b/.github/workflows/typescript.yml @@ -18,5 +18,5 @@ jobs: with: js: true - run: yarn install - - name: Check TypeScript - run: ./node_modules/.bin/tsc -b bindings/typescript + - name: Typecheck TypeScript + run: yarn run build diff --git a/bindings/typescript/package.json b/bindings/typescript/package.json index ee65358b..63948187 100644 --- a/bindings/typescript/package.json +++ b/bindings/typescript/package.json @@ -12,8 +12,8 @@ }, "devDependencies": { "@types/google-protobuf": "3.15.6", - "protoc-gen-ts": "0.8.5", - "typescript": "^4.7.4" + "protoc-gen-ts": "0.8.6", + "typescript": "^4.9.0" }, "comment": [ "protoc-gen-ts is pinned to 0.8.1 because there is a breaking change in ", diff --git a/bindings/typescript/scip.js b/bindings/typescript/scip.js index 35cd15b1..743abfb3 100644 --- a/bindings/typescript/scip.js +++ b/bindings/typescript/scip.js @@ -1,15 +1,20 @@ "use strict"; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.scip = void 0; /** * Generated by the protoc-gen-ts. DO NOT EDIT! * compiler version: 0.0.0 * source: scip.proto - * git: https://github.com/thesayyn/protoc-gen-ts - * */ + * git: https://github.com/thesayyn/protoc-gen-ts */ const pb_1 = require("google-protobuf"); var scip; (function (scip) { + var _Index_one_of_decls, _Metadata_one_of_decls, _ToolInfo_one_of_decls, _Document_one_of_decls, _Symbol_one_of_decls, _Package_one_of_decls, _Descriptor_one_of_decls, _SymbolInformation_one_of_decls, _Relationship_one_of_decls, _Occurrence_one_of_decls, _Diagnostic_one_of_decls; let ProtocolVersion; (function (ProtocolVersion) { ProtocolVersion[ProtocolVersion["UnspecifiedProtocolVersion"] = 0] = "UnspecifiedProtocolVersion"; @@ -36,6 +41,8 @@ var scip; SyntaxKind[SyntaxKind["Comment"] = 1] = "Comment"; SyntaxKind[SyntaxKind["PunctuationDelimiter"] = 2] = "PunctuationDelimiter"; SyntaxKind[SyntaxKind["PunctuationBracket"] = 3] = "PunctuationBracket"; + SyntaxKind[SyntaxKind["Keyword"] = 4] = "Keyword"; + /** @deprecated*/ SyntaxKind[SyntaxKind["IdentifierKeyword"] = 4] = "IdentifierKeyword"; SyntaxKind[SyntaxKind["IdentifierOperator"] = 5] = "IdentifierOperator"; SyntaxKind[SyntaxKind["Identifier"] = 6] = "Identifier"; @@ -46,6 +53,8 @@ var scip; SyntaxKind[SyntaxKind["IdentifierParameter"] = 11] = "IdentifierParameter"; SyntaxKind[SyntaxKind["IdentifierLocal"] = 12] = "IdentifierLocal"; SyntaxKind[SyntaxKind["IdentifierShadowed"] = 13] = "IdentifierShadowed"; + SyntaxKind[SyntaxKind["IdentifierNamespace"] = 14] = "IdentifierNamespace"; + /** @deprecated*/ SyntaxKind[SyntaxKind["IdentifierModule"] = 14] = "IdentifierModule"; SyntaxKind[SyntaxKind["IdentifierFunction"] = 15] = "IdentifierFunction"; SyntaxKind[SyntaxKind["IdentifierFunctionDefinition"] = 16] = "IdentifierFunctionDefinition"; @@ -84,10 +93,108 @@ var scip; DiagnosticTag[DiagnosticTag["Unnecessary"] = 1] = "Unnecessary"; DiagnosticTag[DiagnosticTag["Deprecated"] = 2] = "Deprecated"; })(DiagnosticTag = scip.DiagnosticTag || (scip.DiagnosticTag = {})); + let Language; + (function (Language) { + Language[Language["UnspecifiedLanguage"] = 0] = "UnspecifiedLanguage"; + Language[Language["ABAP"] = 60] = "ABAP"; + Language[Language["APL"] = 49] = "APL"; + Language[Language["Ada"] = 39] = "Ada"; + Language[Language["Agda"] = 45] = "Agda"; + Language[Language["AsciiDoc"] = 86] = "AsciiDoc"; + Language[Language["Assembly"] = 58] = "Assembly"; + Language[Language["Awk"] = 66] = "Awk"; + Language[Language["Bat"] = 68] = "Bat"; + Language[Language["BibTeX"] = 81] = "BibTeX"; + Language[Language["C"] = 34] = "C"; + Language[Language["COBOL"] = 59] = "COBOL"; + Language[Language["CPP"] = 35] = "CPP"; + Language[Language["CSS"] = 26] = "CSS"; + Language[Language["CSharp"] = 1] = "CSharp"; + Language[Language["Clojure"] = 8] = "Clojure"; + Language[Language["Coffeescript"] = 21] = "Coffeescript"; + Language[Language["CommonLisp"] = 9] = "CommonLisp"; + Language[Language["Coq"] = 47] = "Coq"; + Language[Language["Dart"] = 3] = "Dart"; + Language[Language["Delphi"] = 57] = "Delphi"; + Language[Language["Diff"] = 88] = "Diff"; + Language[Language["Dockerfile"] = 80] = "Dockerfile"; + Language[Language["Dyalog"] = 50] = "Dyalog"; + Language[Language["Elixir"] = 17] = "Elixir"; + Language[Language["Erlang"] = 18] = "Erlang"; + Language[Language["FSharp"] = 42] = "FSharp"; + Language[Language["Fish"] = 65] = "Fish"; + Language[Language["Flow"] = 24] = "Flow"; + Language[Language["Fortran"] = 56] = "Fortran"; + Language[Language["Git_Commit"] = 91] = "Git_Commit"; + Language[Language["Git_Config"] = 89] = "Git_Config"; + Language[Language["Git_Rebase"] = 92] = "Git_Rebase"; + Language[Language["Go"] = 33] = "Go"; + Language[Language["Groovy"] = 7] = "Groovy"; + Language[Language["HTML"] = 30] = "HTML"; + Language[Language["Hack"] = 20] = "Hack"; + Language[Language["Handlebars"] = 90] = "Handlebars"; + Language[Language["Haskell"] = 44] = "Haskell"; + Language[Language["Idris"] = 46] = "Idris"; + Language[Language["Ini"] = 72] = "Ini"; + Language[Language["J"] = 51] = "J"; + Language[Language["JSON"] = 75] = "JSON"; + Language[Language["Java"] = 6] = "Java"; + Language[Language["JavaScript"] = 22] = "JavaScript"; + Language[Language["JavaScriptReact"] = 93] = "JavaScriptReact"; + Language[Language["Jsonnet"] = 76] = "Jsonnet"; + Language[Language["Julia"] = 55] = "Julia"; + Language[Language["Kotlin"] = 4] = "Kotlin"; + Language[Language["LaTeX"] = 83] = "LaTeX"; + Language[Language["Lean"] = 48] = "Lean"; + Language[Language["Less"] = 27] = "Less"; + Language[Language["Lua"] = 12] = "Lua"; + Language[Language["Makefile"] = 79] = "Makefile"; + Language[Language["Markdown"] = 84] = "Markdown"; + Language[Language["Matlab"] = 52] = "Matlab"; + Language[Language["Nix"] = 77] = "Nix"; + Language[Language["OCaml"] = 41] = "OCaml"; + Language[Language["Objective_C"] = 36] = "Objective_C"; + Language[Language["Objective_CPP"] = 37] = "Objective_CPP"; + Language[Language["PHP"] = 19] = "PHP"; + Language[Language["PLSQL"] = 70] = "PLSQL"; + Language[Language["Perl"] = 13] = "Perl"; + Language[Language["PowerShell"] = 67] = "PowerShell"; + Language[Language["Prolog"] = 71] = "Prolog"; + Language[Language["Python"] = 15] = "Python"; + Language[Language["R"] = 54] = "R"; + Language[Language["Racket"] = 11] = "Racket"; + Language[Language["Raku"] = 14] = "Raku"; + Language[Language["Razor"] = 62] = "Razor"; + Language[Language["ReST"] = 85] = "ReST"; + Language[Language["Ruby"] = 16] = "Ruby"; + Language[Language["Rust"] = 40] = "Rust"; + Language[Language["SAS"] = 61] = "SAS"; + Language[Language["SCSS"] = 29] = "SCSS"; + Language[Language["SML"] = 43] = "SML"; + Language[Language["SQL"] = 69] = "SQL"; + Language[Language["Sass"] = 28] = "Sass"; + Language[Language["Scala"] = 5] = "Scala"; + Language[Language["Scheme"] = 10] = "Scheme"; + Language[Language["ShellScript"] = 64] = "ShellScript"; + Language[Language["Skylark"] = 78] = "Skylark"; + Language[Language["Swift"] = 2] = "Swift"; + Language[Language["TOML"] = 73] = "TOML"; + Language[Language["TeX"] = 82] = "TeX"; + Language[Language["TypeScript"] = 23] = "TypeScript"; + Language[Language["TypeScriptReact"] = 94] = "TypeScriptReact"; + Language[Language["VisualBasic"] = 63] = "VisualBasic"; + Language[Language["Vue"] = 25] = "Vue"; + Language[Language["Wolfram"] = 53] = "Wolfram"; + Language[Language["XML"] = 31] = "XML"; + Language[Language["XSL"] = 32] = "XSL"; + Language[Language["YAML"] = 74] = "YAML"; + Language[Language["Zig"] = 38] = "Zig"; + })(Language = scip.Language || (scip.Language = {})); class Index extends pb_1.Message { constructor(data) { super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 3], []); + _Index_one_of_decls.set(this, []); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 3], __classPrivateFieldGet(this, _Index_one_of_decls, "f")); if (!Array.isArray(data) && typeof data == "object") { if ("metadata" in data && data.metadata != undefined) { this.metadata = data.metadata; @@ -106,6 +213,9 @@ var scip; set metadata(value) { pb_1.Message.setWrapperField(this, 1, value); } + get has_metadata() { + return pb_1.Message.getField(this, 1) != null; + } get documents() { return pb_1.Message.getRepeatedWrapperField(this, Document, 2); } @@ -146,11 +256,11 @@ var scip; } serialize(w) { const writer = w || new pb_1.BinaryWriter(); - if (this.metadata !== undefined) + if (this.has_metadata) writer.writeMessage(1, this.metadata, () => this.metadata.serialize(writer)); - if (this.documents !== undefined) + if (this.documents.length) writer.writeRepeatedMessage(2, this.documents, (item) => item.serialize(writer)); - if (this.external_symbols !== undefined) + if (this.external_symbols.length) writer.writeRepeatedMessage(3, this.external_symbols, (item) => item.serialize(writer)); if (!w) return writer.getResultBuffer(); @@ -182,11 +292,13 @@ var scip; return Index.deserialize(bytes); } } + _Index_one_of_decls = new WeakMap(); scip.Index = Index; class Metadata extends pb_1.Message { constructor(data) { super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], []); + _Metadata_one_of_decls.set(this, []); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], __classPrivateFieldGet(this, _Metadata_one_of_decls, "f")); if (!Array.isArray(data) && typeof data == "object") { if ("version" in data && data.version != undefined) { this.version = data.version; @@ -203,7 +315,7 @@ var scip; } } get version() { - return pb_1.Message.getField(this, 1); + return pb_1.Message.getFieldWithDefault(this, 1, ProtocolVersion.UnspecifiedProtocolVersion); } set version(value) { pb_1.Message.setField(this, 1, value); @@ -214,14 +326,17 @@ var scip; set tool_info(value) { pb_1.Message.setWrapperField(this, 2, value); } + get has_tool_info() { + return pb_1.Message.getField(this, 2) != null; + } get project_root() { - return pb_1.Message.getField(this, 3); + return pb_1.Message.getFieldWithDefault(this, 3, ""); } set project_root(value) { pb_1.Message.setField(this, 3, value); } get text_document_encoding() { - return pb_1.Message.getField(this, 4); + return pb_1.Message.getFieldWithDefault(this, 4, TextEncoding.UnspecifiedTextEncoding); } set text_document_encoding(value) { pb_1.Message.setField(this, 4, value); @@ -260,13 +375,13 @@ var scip; } serialize(w) { const writer = w || new pb_1.BinaryWriter(); - if (this.version !== undefined) + if (this.version != ProtocolVersion.UnspecifiedProtocolVersion) writer.writeEnum(1, this.version); - if (this.tool_info !== undefined) + if (this.has_tool_info) writer.writeMessage(2, this.tool_info, () => this.tool_info.serialize(writer)); - if (typeof this.project_root === "string" && this.project_root.length) + if (this.project_root.length) writer.writeString(3, this.project_root); - if (this.text_document_encoding !== undefined) + if (this.text_document_encoding != TextEncoding.UnspecifiedTextEncoding) writer.writeEnum(4, this.text_document_encoding); if (!w) return writer.getResultBuffer(); @@ -301,11 +416,13 @@ var scip; return Metadata.deserialize(bytes); } } + _Metadata_one_of_decls = new WeakMap(); scip.Metadata = Metadata; class ToolInfo extends pb_1.Message { constructor(data) { super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3], []); + _ToolInfo_one_of_decls.set(this, []); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3], __classPrivateFieldGet(this, _ToolInfo_one_of_decls, "f")); if (!Array.isArray(data) && typeof data == "object") { if ("name" in data && data.name != undefined) { this.name = data.name; @@ -319,19 +436,19 @@ var scip; } } get name() { - return pb_1.Message.getField(this, 1); + return pb_1.Message.getFieldWithDefault(this, 1, ""); } set name(value) { pb_1.Message.setField(this, 1, value); } get version() { - return pb_1.Message.getField(this, 2); + return pb_1.Message.getFieldWithDefault(this, 2, ""); } set version(value) { pb_1.Message.setField(this, 2, value); } get arguments() { - return pb_1.Message.getField(this, 3); + return pb_1.Message.getFieldWithDefault(this, 3, []); } set arguments(value) { pb_1.Message.setField(this, 3, value); @@ -364,11 +481,11 @@ var scip; } serialize(w) { const writer = w || new pb_1.BinaryWriter(); - if (typeof this.name === "string" && this.name.length) + if (this.name.length) writer.writeString(1, this.name); - if (typeof this.version === "string" && this.version.length) + if (this.version.length) writer.writeString(2, this.version); - if (this.arguments !== undefined) + if (this.arguments.length) writer.writeRepeatedString(3, this.arguments); if (!w) return writer.getResultBuffer(); @@ -400,12 +517,17 @@ var scip; return ToolInfo.deserialize(bytes); } } + _ToolInfo_one_of_decls = new WeakMap(); scip.ToolInfo = ToolInfo; class Document extends pb_1.Message { constructor(data) { super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 3], []); + _Document_one_of_decls.set(this, []); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 3], __classPrivateFieldGet(this, _Document_one_of_decls, "f")); if (!Array.isArray(data) && typeof data == "object") { + if ("language" in data && data.language != undefined) { + this.language = data.language; + } if ("relative_path" in data && data.relative_path != undefined) { this.relative_path = data.relative_path; } @@ -415,10 +537,19 @@ var scip; if ("symbols" in data && data.symbols != undefined) { this.symbols = data.symbols; } + if ("text" in data && data.text != undefined) { + this.text = data.text; + } } } + get language() { + return pb_1.Message.getFieldWithDefault(this, 4, ""); + } + set language(value) { + pb_1.Message.setField(this, 4, value); + } get relative_path() { - return pb_1.Message.getField(this, 1); + return pb_1.Message.getFieldWithDefault(this, 1, ""); } set relative_path(value) { pb_1.Message.setField(this, 1, value); @@ -435,8 +566,17 @@ var scip; set symbols(value) { pb_1.Message.setRepeatedWrapperField(this, 3, value); } + get text() { + return pb_1.Message.getFieldWithDefault(this, 5, ""); + } + set text(value) { + pb_1.Message.setField(this, 5, value); + } static fromObject(data) { const message = new Document({}); + if (data.language != null) { + message.language = data.language; + } if (data.relative_path != null) { message.relative_path = data.relative_path; } @@ -446,10 +586,16 @@ var scip; if (data.symbols != null) { message.symbols = data.symbols.map(item => SymbolInformation.fromObject(item)); } + if (data.text != null) { + message.text = data.text; + } return message; } toObject() { const data = {}; + if (this.language != null) { + data.language = this.language; + } if (this.relative_path != null) { data.relative_path = this.relative_path; } @@ -459,16 +605,23 @@ var scip; if (this.symbols != null) { data.symbols = this.symbols.map((item) => item.toObject()); } + if (this.text != null) { + data.text = this.text; + } return data; } serialize(w) { const writer = w || new pb_1.BinaryWriter(); - if (typeof this.relative_path === "string" && this.relative_path.length) + if (this.language.length) + writer.writeString(4, this.language); + if (this.relative_path.length) writer.writeString(1, this.relative_path); - if (this.occurrences !== undefined) + if (this.occurrences.length) writer.writeRepeatedMessage(2, this.occurrences, (item) => item.serialize(writer)); - if (this.symbols !== undefined) + if (this.symbols.length) writer.writeRepeatedMessage(3, this.symbols, (item) => item.serialize(writer)); + if (this.text.length) + writer.writeString(5, this.text); if (!w) return writer.getResultBuffer(); } @@ -478,6 +631,9 @@ var scip; if (reader.isEndGroup()) break; switch (reader.getFieldNumber()) { + case 4: + message.language = reader.readString(); + break; case 1: message.relative_path = reader.readString(); break; @@ -487,6 +643,9 @@ var scip; case 3: reader.readMessage(message.symbols, () => pb_1.Message.addToRepeatedWrapperField(message, 3, SymbolInformation.deserialize(reader), SymbolInformation)); break; + case 5: + message.text = reader.readString(); + break; default: reader.skipField(); } } @@ -499,11 +658,13 @@ var scip; return Document.deserialize(bytes); } } + _Document_one_of_decls = new WeakMap(); scip.Document = Document; class Symbol extends pb_1.Message { constructor(data) { super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3], []); + _Symbol_one_of_decls.set(this, []); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3], __classPrivateFieldGet(this, _Symbol_one_of_decls, "f")); if (!Array.isArray(data) && typeof data == "object") { if ("scheme" in data && data.scheme != undefined) { this.scheme = data.scheme; @@ -517,7 +678,7 @@ var scip; } } get scheme() { - return pb_1.Message.getField(this, 1); + return pb_1.Message.getFieldWithDefault(this, 1, ""); } set scheme(value) { pb_1.Message.setField(this, 1, value); @@ -528,6 +689,9 @@ var scip; set package(value) { pb_1.Message.setWrapperField(this, 2, value); } + get has_package() { + return pb_1.Message.getField(this, 2) != null; + } get descriptors() { return pb_1.Message.getRepeatedWrapperField(this, Descriptor, 3); } @@ -562,11 +726,11 @@ var scip; } serialize(w) { const writer = w || new pb_1.BinaryWriter(); - if (typeof this.scheme === "string" && this.scheme.length) + if (this.scheme.length) writer.writeString(1, this.scheme); - if (this.package !== undefined) + if (this.has_package) writer.writeMessage(2, this.package, () => this.package.serialize(writer)); - if (this.descriptors !== undefined) + if (this.descriptors.length) writer.writeRepeatedMessage(3, this.descriptors, (item) => item.serialize(writer)); if (!w) return writer.getResultBuffer(); @@ -598,11 +762,13 @@ var scip; return Symbol.deserialize(bytes); } } + _Symbol_one_of_decls = new WeakMap(); scip.Symbol = Symbol; class Package extends pb_1.Message { constructor(data) { super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], []); + _Package_one_of_decls.set(this, []); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], __classPrivateFieldGet(this, _Package_one_of_decls, "f")); if (!Array.isArray(data) && typeof data == "object") { if ("manager" in data && data.manager != undefined) { this.manager = data.manager; @@ -616,19 +782,19 @@ var scip; } } get manager() { - return pb_1.Message.getField(this, 1); + return pb_1.Message.getFieldWithDefault(this, 1, ""); } set manager(value) { pb_1.Message.setField(this, 1, value); } get name() { - return pb_1.Message.getField(this, 2); + return pb_1.Message.getFieldWithDefault(this, 2, ""); } set name(value) { pb_1.Message.setField(this, 2, value); } get version() { - return pb_1.Message.getField(this, 3); + return pb_1.Message.getFieldWithDefault(this, 3, ""); } set version(value) { pb_1.Message.setField(this, 3, value); @@ -661,11 +827,11 @@ var scip; } serialize(w) { const writer = w || new pb_1.BinaryWriter(); - if (typeof this.manager === "string" && this.manager.length) + if (this.manager.length) writer.writeString(1, this.manager); - if (typeof this.name === "string" && this.name.length) + if (this.name.length) writer.writeString(2, this.name); - if (typeof this.version === "string" && this.version.length) + if (this.version.length) writer.writeString(3, this.version); if (!w) return writer.getResultBuffer(); @@ -697,11 +863,13 @@ var scip; return Package.deserialize(bytes); } } + _Package_one_of_decls = new WeakMap(); scip.Package = Package; class Descriptor extends pb_1.Message { constructor(data) { super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], []); + _Descriptor_one_of_decls.set(this, []); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], __classPrivateFieldGet(this, _Descriptor_one_of_decls, "f")); if (!Array.isArray(data) && typeof data == "object") { if ("name" in data && data.name != undefined) { this.name = data.name; @@ -715,19 +883,19 @@ var scip; } } get name() { - return pb_1.Message.getField(this, 1); + return pb_1.Message.getFieldWithDefault(this, 1, ""); } set name(value) { pb_1.Message.setField(this, 1, value); } get disambiguator() { - return pb_1.Message.getField(this, 2); + return pb_1.Message.getFieldWithDefault(this, 2, ""); } set disambiguator(value) { pb_1.Message.setField(this, 2, value); } get suffix() { - return pb_1.Message.getField(this, 3); + return pb_1.Message.getFieldWithDefault(this, 3, Descriptor.Suffix.UnspecifiedSuffix); } set suffix(value) { pb_1.Message.setField(this, 3, value); @@ -760,11 +928,11 @@ var scip; } serialize(w) { const writer = w || new pb_1.BinaryWriter(); - if (typeof this.name === "string" && this.name.length) + if (this.name.length) writer.writeString(1, this.name); - if (typeof this.disambiguator === "string" && this.disambiguator.length) + if (this.disambiguator.length) writer.writeString(2, this.disambiguator); - if (this.suffix !== undefined) + if (this.suffix != Descriptor.Suffix.UnspecifiedSuffix) writer.writeEnum(3, this.suffix); if (!w) return writer.getResultBuffer(); @@ -796,11 +964,14 @@ var scip; return Descriptor.deserialize(bytes); } } + _Descriptor_one_of_decls = new WeakMap(); scip.Descriptor = Descriptor; (function (Descriptor) { let Suffix; (function (Suffix) { Suffix[Suffix["UnspecifiedSuffix"] = 0] = "UnspecifiedSuffix"; + Suffix[Suffix["Namespace"] = 1] = "Namespace"; + /** @deprecated*/ Suffix[Suffix["Package"] = 1] = "Package"; Suffix[Suffix["Type"] = 2] = "Type"; Suffix[Suffix["Term"] = 3] = "Term"; @@ -809,12 +980,14 @@ var scip; Suffix[Suffix["Parameter"] = 6] = "Parameter"; Suffix[Suffix["Meta"] = 7] = "Meta"; Suffix[Suffix["Local"] = 8] = "Local"; + Suffix[Suffix["Macro"] = 9] = "Macro"; })(Suffix = Descriptor.Suffix || (Descriptor.Suffix = {})); })(Descriptor = scip.Descriptor || (scip.Descriptor = {})); class SymbolInformation extends pb_1.Message { constructor(data) { super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3, 4], []); + _SymbolInformation_one_of_decls.set(this, []); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3, 4], __classPrivateFieldGet(this, _SymbolInformation_one_of_decls, "f")); if (!Array.isArray(data) && typeof data == "object") { if ("symbol" in data && data.symbol != undefined) { this.symbol = data.symbol; @@ -825,16 +998,28 @@ var scip; if ("relationships" in data && data.relationships != undefined) { this.relationships = data.relationships; } + if ("kind" in data && data.kind != undefined) { + this.kind = data.kind; + } + if ("display_name" in data && data.display_name != undefined) { + this.display_name = data.display_name; + } + if ("signature_documentation" in data && data.signature_documentation != undefined) { + this.signature_documentation = data.signature_documentation; + } + if ("enclosing_symbol" in data && data.enclosing_symbol != undefined) { + this.enclosing_symbol = data.enclosing_symbol; + } } } get symbol() { - return pb_1.Message.getField(this, 1); + return pb_1.Message.getFieldWithDefault(this, 1, ""); } set symbol(value) { pb_1.Message.setField(this, 1, value); } get documentation() { - return pb_1.Message.getField(this, 3); + return pb_1.Message.getFieldWithDefault(this, 3, []); } set documentation(value) { pb_1.Message.setField(this, 3, value); @@ -845,6 +1030,33 @@ var scip; set relationships(value) { pb_1.Message.setRepeatedWrapperField(this, 4, value); } + get kind() { + return pb_1.Message.getFieldWithDefault(this, 5, SymbolInformation.Kind.UnspecifiedKind); + } + set kind(value) { + pb_1.Message.setField(this, 5, value); + } + get display_name() { + return pb_1.Message.getFieldWithDefault(this, 6, ""); + } + set display_name(value) { + pb_1.Message.setField(this, 6, value); + } + get signature_documentation() { + return pb_1.Message.getWrapperField(this, Document, 7); + } + set signature_documentation(value) { + pb_1.Message.setWrapperField(this, 7, value); + } + get has_signature_documentation() { + return pb_1.Message.getField(this, 7) != null; + } + get enclosing_symbol() { + return pb_1.Message.getFieldWithDefault(this, 8, ""); + } + set enclosing_symbol(value) { + pb_1.Message.setField(this, 8, value); + } static fromObject(data) { const message = new SymbolInformation({}); if (data.symbol != null) { @@ -856,6 +1068,18 @@ var scip; if (data.relationships != null) { message.relationships = data.relationships.map(item => Relationship.fromObject(item)); } + if (data.kind != null) { + message.kind = data.kind; + } + if (data.display_name != null) { + message.display_name = data.display_name; + } + if (data.signature_documentation != null) { + message.signature_documentation = Document.fromObject(data.signature_documentation); + } + if (data.enclosing_symbol != null) { + message.enclosing_symbol = data.enclosing_symbol; + } return message; } toObject() { @@ -869,16 +1093,36 @@ var scip; if (this.relationships != null) { data.relationships = this.relationships.map((item) => item.toObject()); } + if (this.kind != null) { + data.kind = this.kind; + } + if (this.display_name != null) { + data.display_name = this.display_name; + } + if (this.signature_documentation != null) { + data.signature_documentation = this.signature_documentation.toObject(); + } + if (this.enclosing_symbol != null) { + data.enclosing_symbol = this.enclosing_symbol; + } return data; } serialize(w) { const writer = w || new pb_1.BinaryWriter(); - if (typeof this.symbol === "string" && this.symbol.length) + if (this.symbol.length) writer.writeString(1, this.symbol); - if (this.documentation !== undefined) + if (this.documentation.length) writer.writeRepeatedString(3, this.documentation); - if (this.relationships !== undefined) + if (this.relationships.length) writer.writeRepeatedMessage(4, this.relationships, (item) => item.serialize(writer)); + if (this.kind != SymbolInformation.Kind.UnspecifiedKind) + writer.writeEnum(5, this.kind); + if (this.display_name.length) + writer.writeString(6, this.display_name); + if (this.has_signature_documentation) + writer.writeMessage(7, this.signature_documentation, () => this.signature_documentation.serialize(writer)); + if (this.enclosing_symbol.length) + writer.writeString(8, this.enclosing_symbol); if (!w) return writer.getResultBuffer(); } @@ -897,6 +1141,18 @@ var scip; case 4: reader.readMessage(message.relationships, () => pb_1.Message.addToRepeatedWrapperField(message, 4, Relationship.deserialize(reader), Relationship)); break; + case 5: + message.kind = reader.readEnum(); + break; + case 6: + message.display_name = reader.readString(); + break; + case 7: + reader.readMessage(message.signature_documentation, () => message.signature_documentation = Document.deserialize(reader)); + break; + case 8: + message.enclosing_symbol = reader.readString(); + break; default: reader.skipField(); } } @@ -909,11 +1165,80 @@ var scip; return SymbolInformation.deserialize(bytes); } } + _SymbolInformation_one_of_decls = new WeakMap(); scip.SymbolInformation = SymbolInformation; + (function (SymbolInformation) { + let Kind; + (function (Kind) { + Kind[Kind["UnspecifiedKind"] = 0] = "UnspecifiedKind"; + Kind[Kind["Array"] = 1] = "Array"; + Kind[Kind["Assertion"] = 2] = "Assertion"; + Kind[Kind["AssociatedType"] = 3] = "AssociatedType"; + Kind[Kind["Attribute"] = 4] = "Attribute"; + Kind[Kind["Axiom"] = 5] = "Axiom"; + Kind[Kind["Boolean"] = 6] = "Boolean"; + Kind[Kind["Class"] = 7] = "Class"; + Kind[Kind["Constant"] = 8] = "Constant"; + Kind[Kind["Constructor"] = 9] = "Constructor"; + Kind[Kind["DataFamily"] = 10] = "DataFamily"; + Kind[Kind["Enum"] = 11] = "Enum"; + Kind[Kind["EnumMember"] = 12] = "EnumMember"; + Kind[Kind["Event"] = 13] = "Event"; + Kind[Kind["Fact"] = 14] = "Fact"; + Kind[Kind["Field"] = 15] = "Field"; + Kind[Kind["File"] = 16] = "File"; + Kind[Kind["Function"] = 17] = "Function"; + Kind[Kind["Getter"] = 18] = "Getter"; + Kind[Kind["Grammar"] = 19] = "Grammar"; + Kind[Kind["Instance"] = 20] = "Instance"; + Kind[Kind["Interface"] = 21] = "Interface"; + Kind[Kind["Key"] = 22] = "Key"; + Kind[Kind["Lang"] = 23] = "Lang"; + Kind[Kind["Lemma"] = 24] = "Lemma"; + Kind[Kind["Macro"] = 25] = "Macro"; + Kind[Kind["Method"] = 26] = "Method"; + Kind[Kind["MethodReceiver"] = 27] = "MethodReceiver"; + Kind[Kind["Message"] = 28] = "Message"; + Kind[Kind["Module"] = 29] = "Module"; + Kind[Kind["Namespace"] = 30] = "Namespace"; + Kind[Kind["Null"] = 31] = "Null"; + Kind[Kind["Number"] = 32] = "Number"; + Kind[Kind["Object"] = 33] = "Object"; + Kind[Kind["Operator"] = 34] = "Operator"; + Kind[Kind["Package"] = 35] = "Package"; + Kind[Kind["PackageObject"] = 36] = "PackageObject"; + Kind[Kind["Parameter"] = 37] = "Parameter"; + Kind[Kind["ParameterLabel"] = 38] = "ParameterLabel"; + Kind[Kind["Pattern"] = 39] = "Pattern"; + Kind[Kind["Predicate"] = 40] = "Predicate"; + Kind[Kind["Property"] = 41] = "Property"; + Kind[Kind["Protocol"] = 42] = "Protocol"; + Kind[Kind["Quasiquoter"] = 43] = "Quasiquoter"; + Kind[Kind["SelfParameter"] = 44] = "SelfParameter"; + Kind[Kind["Setter"] = 45] = "Setter"; + Kind[Kind["Signature"] = 46] = "Signature"; + Kind[Kind["Subscript"] = 47] = "Subscript"; + Kind[Kind["String"] = 48] = "String"; + Kind[Kind["Struct"] = 49] = "Struct"; + Kind[Kind["Tactic"] = 50] = "Tactic"; + Kind[Kind["Theorem"] = 51] = "Theorem"; + Kind[Kind["ThisParameter"] = 52] = "ThisParameter"; + Kind[Kind["Trait"] = 53] = "Trait"; + Kind[Kind["Type"] = 54] = "Type"; + Kind[Kind["TypeAlias"] = 55] = "TypeAlias"; + Kind[Kind["TypeClass"] = 56] = "TypeClass"; + Kind[Kind["TypeFamily"] = 57] = "TypeFamily"; + Kind[Kind["TypeParameter"] = 58] = "TypeParameter"; + Kind[Kind["Union"] = 59] = "Union"; + Kind[Kind["Value"] = 60] = "Value"; + Kind[Kind["Variable"] = 61] = "Variable"; + })(Kind = SymbolInformation.Kind || (SymbolInformation.Kind = {})); + })(SymbolInformation = scip.SymbolInformation || (scip.SymbolInformation = {})); class Relationship extends pb_1.Message { constructor(data) { super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], []); + _Relationship_one_of_decls.set(this, []); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], __classPrivateFieldGet(this, _Relationship_one_of_decls, "f")); if (!Array.isArray(data) && typeof data == "object") { if ("symbol" in data && data.symbol != undefined) { this.symbol = data.symbol; @@ -927,32 +1252,41 @@ var scip; if ("is_type_definition" in data && data.is_type_definition != undefined) { this.is_type_definition = data.is_type_definition; } + if ("is_definition" in data && data.is_definition != undefined) { + this.is_definition = data.is_definition; + } } } get symbol() { - return pb_1.Message.getField(this, 1); + return pb_1.Message.getFieldWithDefault(this, 1, ""); } set symbol(value) { pb_1.Message.setField(this, 1, value); } get is_reference() { - return pb_1.Message.getField(this, 2); + return pb_1.Message.getFieldWithDefault(this, 2, false); } set is_reference(value) { pb_1.Message.setField(this, 2, value); } get is_implementation() { - return pb_1.Message.getField(this, 3); + return pb_1.Message.getFieldWithDefault(this, 3, false); } set is_implementation(value) { pb_1.Message.setField(this, 3, value); } get is_type_definition() { - return pb_1.Message.getField(this, 4); + return pb_1.Message.getFieldWithDefault(this, 4, false); } set is_type_definition(value) { pb_1.Message.setField(this, 4, value); } + get is_definition() { + return pb_1.Message.getFieldWithDefault(this, 5, false); + } + set is_definition(value) { + pb_1.Message.setField(this, 5, value); + } static fromObject(data) { const message = new Relationship({}); if (data.symbol != null) { @@ -967,6 +1301,9 @@ var scip; if (data.is_type_definition != null) { message.is_type_definition = data.is_type_definition; } + if (data.is_definition != null) { + message.is_definition = data.is_definition; + } return message; } toObject() { @@ -983,18 +1320,23 @@ var scip; if (this.is_type_definition != null) { data.is_type_definition = this.is_type_definition; } + if (this.is_definition != null) { + data.is_definition = this.is_definition; + } return data; } serialize(w) { const writer = w || new pb_1.BinaryWriter(); - if (typeof this.symbol === "string" && this.symbol.length) + if (this.symbol.length) writer.writeString(1, this.symbol); - if (this.is_reference !== undefined) + if (this.is_reference != false) writer.writeBool(2, this.is_reference); - if (this.is_implementation !== undefined) + if (this.is_implementation != false) writer.writeBool(3, this.is_implementation); - if (this.is_type_definition !== undefined) + if (this.is_type_definition != false) writer.writeBool(4, this.is_type_definition); + if (this.is_definition != false) + writer.writeBool(5, this.is_definition); if (!w) return writer.getResultBuffer(); } @@ -1016,6 +1358,9 @@ var scip; case 4: message.is_type_definition = reader.readBool(); break; + case 5: + message.is_definition = reader.readBool(); + break; default: reader.skipField(); } } @@ -1028,11 +1373,13 @@ var scip; return Relationship.deserialize(bytes); } } + _Relationship_one_of_decls = new WeakMap(); scip.Relationship = Relationship; class Occurrence extends pb_1.Message { constructor(data) { super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 4, 6], []); + _Occurrence_one_of_decls.set(this, []); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 4, 6, 7], __classPrivateFieldGet(this, _Occurrence_one_of_decls, "f")); if (!Array.isArray(data) && typeof data == "object") { if ("range" in data && data.range != undefined) { this.range = data.range; @@ -1052,34 +1399,37 @@ var scip; if ("diagnostics" in data && data.diagnostics != undefined) { this.diagnostics = data.diagnostics; } + if ("enclosing_range" in data && data.enclosing_range != undefined) { + this.enclosing_range = data.enclosing_range; + } } } get range() { - return pb_1.Message.getField(this, 1); + return pb_1.Message.getFieldWithDefault(this, 1, []); } set range(value) { pb_1.Message.setField(this, 1, value); } get symbol() { - return pb_1.Message.getField(this, 2); + return pb_1.Message.getFieldWithDefault(this, 2, ""); } set symbol(value) { pb_1.Message.setField(this, 2, value); } get symbol_roles() { - return pb_1.Message.getField(this, 3); + return pb_1.Message.getFieldWithDefault(this, 3, 0); } set symbol_roles(value) { pb_1.Message.setField(this, 3, value); } get override_documentation() { - return pb_1.Message.getField(this, 4); + return pb_1.Message.getFieldWithDefault(this, 4, []); } set override_documentation(value) { pb_1.Message.setField(this, 4, value); } get syntax_kind() { - return pb_1.Message.getField(this, 5); + return pb_1.Message.getFieldWithDefault(this, 5, SyntaxKind.UnspecifiedSyntaxKind); } set syntax_kind(value) { pb_1.Message.setField(this, 5, value); @@ -1090,6 +1440,12 @@ var scip; set diagnostics(value) { pb_1.Message.setRepeatedWrapperField(this, 6, value); } + get enclosing_range() { + return pb_1.Message.getFieldWithDefault(this, 7, []); + } + set enclosing_range(value) { + pb_1.Message.setField(this, 7, value); + } static fromObject(data) { const message = new Occurrence({}); if (data.range != null) { @@ -1110,6 +1466,9 @@ var scip; if (data.diagnostics != null) { message.diagnostics = data.diagnostics.map(item => Diagnostic.fromObject(item)); } + if (data.enclosing_range != null) { + message.enclosing_range = data.enclosing_range; + } return message; } toObject() { @@ -1132,22 +1491,27 @@ var scip; if (this.diagnostics != null) { data.diagnostics = this.diagnostics.map((item) => item.toObject()); } + if (this.enclosing_range != null) { + data.enclosing_range = this.enclosing_range; + } return data; } serialize(w) { const writer = w || new pb_1.BinaryWriter(); - if (this.range !== undefined) + if (this.range.length) writer.writePackedInt32(1, this.range); - if (typeof this.symbol === "string" && this.symbol.length) + if (this.symbol.length) writer.writeString(2, this.symbol); - if (this.symbol_roles !== undefined) + if (this.symbol_roles != 0) writer.writeInt32(3, this.symbol_roles); - if (this.override_documentation !== undefined) + if (this.override_documentation.length) writer.writeRepeatedString(4, this.override_documentation); - if (this.syntax_kind !== undefined) + if (this.syntax_kind != SyntaxKind.UnspecifiedSyntaxKind) writer.writeEnum(5, this.syntax_kind); - if (this.diagnostics !== undefined) + if (this.diagnostics.length) writer.writeRepeatedMessage(6, this.diagnostics, (item) => item.serialize(writer)); + if (this.enclosing_range.length) + writer.writePackedInt32(7, this.enclosing_range); if (!w) return writer.getResultBuffer(); } @@ -1175,6 +1539,9 @@ var scip; case 6: reader.readMessage(message.diagnostics, () => pb_1.Message.addToRepeatedWrapperField(message, 6, Diagnostic.deserialize(reader), Diagnostic)); break; + case 7: + message.enclosing_range = reader.readPackedInt32(); + break; default: reader.skipField(); } } @@ -1187,11 +1554,13 @@ var scip; return Occurrence.deserialize(bytes); } } + _Occurrence_one_of_decls = new WeakMap(); scip.Occurrence = Occurrence; class Diagnostic extends pb_1.Message { constructor(data) { super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [5], []); + _Diagnostic_one_of_decls.set(this, []); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [5], __classPrivateFieldGet(this, _Diagnostic_one_of_decls, "f")); if (!Array.isArray(data) && typeof data == "object") { if ("severity" in data && data.severity != undefined) { this.severity = data.severity; @@ -1211,31 +1580,31 @@ var scip; } } get severity() { - return pb_1.Message.getField(this, 1); + return pb_1.Message.getFieldWithDefault(this, 1, Severity.UnspecifiedSeverity); } set severity(value) { pb_1.Message.setField(this, 1, value); } get code() { - return pb_1.Message.getField(this, 2); + return pb_1.Message.getFieldWithDefault(this, 2, ""); } set code(value) { pb_1.Message.setField(this, 2, value); } get message() { - return pb_1.Message.getField(this, 3); + return pb_1.Message.getFieldWithDefault(this, 3, ""); } set message(value) { pb_1.Message.setField(this, 3, value); } get source() { - return pb_1.Message.getField(this, 4); + return pb_1.Message.getFieldWithDefault(this, 4, ""); } set source(value) { pb_1.Message.setField(this, 4, value); } get tags() { - return pb_1.Message.getField(this, 5); + return pb_1.Message.getFieldWithDefault(this, 5, []); } set tags(value) { pb_1.Message.setField(this, 5, value); @@ -1280,15 +1649,15 @@ var scip; } serialize(w) { const writer = w || new pb_1.BinaryWriter(); - if (this.severity !== undefined) + if (this.severity != Severity.UnspecifiedSeverity) writer.writeEnum(1, this.severity); - if (typeof this.code === "string" && this.code.length) + if (this.code.length) writer.writeString(2, this.code); - if (typeof this.message === "string" && this.message.length) + if (this.message.length) writer.writeString(3, this.message); - if (typeof this.source === "string" && this.source.length) + if (this.source.length) writer.writeString(4, this.source); - if (this.tags !== undefined) + if (this.tags.length) writer.writePackedEnum(5, this.tags); if (!w) return writer.getResultBuffer(); @@ -1326,5 +1695,6 @@ var scip; return Diagnostic.deserialize(bytes); } } + _Diagnostic_one_of_decls = new WeakMap(); scip.Diagnostic = Diagnostic; })(scip = exports.scip || (exports.scip = {})); diff --git a/bindings/typescript/scip.ts b/bindings/typescript/scip.ts index 4c77f122..e3a52b8c 100644 --- a/bindings/typescript/scip.ts +++ b/bindings/typescript/scip.ts @@ -1750,7 +1750,7 @@ export namespace scip { pb_1.Message.setField(this, 4, value); } get tags() { - return pb_1.Message.getFieldWithDefault(this, 5, DiagnosticTag.UnspecifiedDiagnosticTag) as DiagnosticTag[]; + return pb_1.Message.getFieldWithDefault(this, 5, []) as DiagnosticTag[]; } set tags(value: DiagnosticTag[]) { pb_1.Message.setField(this, 5, value); diff --git a/package.json b/package.json index e268b382..d6ccc38c 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "author": "SCIP authors", "license": "MIT", "scripts": { + "build": "./node_modules/.bin/tsc --build --force bindings/typescript", "prettier": "./node_modules/prettier/bin-prettier.js --write --list-different '**/*.{ts,js(on)?,md,yml}'", "prettier-check": "./node_modules/prettier/bin-prettier.js --check '**/*.{ts,js(on)?,md,yml}'" }, diff --git a/yarn.lock b/yarn.lock index 4220ee1c..ffbe805e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -22,17 +22,17 @@ prettier@^2.8.8: resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== -protoc-gen-ts@0.8.5: - version "0.8.5" - resolved "https://registry.yarnpkg.com/protoc-gen-ts/-/protoc-gen-ts-0.8.5.tgz#5c277ff90b6b38f52313b1b0ad69e6c825305b29" - integrity sha512-LHZ+w/+DqmdgnhPtShgqtPtdv+hJ9bAXEIqNU0kkY2bPcCVIEWz5seOv20FCw6gbKorriTGP8xgz2RsIcrRvVw== +protoc-gen-ts@0.8.6: + version "0.8.6" + resolved "https://registry.yarnpkg.com/protoc-gen-ts/-/protoc-gen-ts-0.8.6.tgz#e789a6fc3fbe09bdc119acecc349b9554ec5940e" + integrity sha512-66oeorGy4QBvYjQGd/gaeOYyFqKyRmRgTpofmnw8buMG0P7A0jQjoKSvKJz5h5tNUaVkIzvGBUTRVGakrhhwpA== tree-sitter-cli@^0.20.4: version "0.20.6" resolved "https://registry.yarnpkg.com/tree-sitter-cli/-/tree-sitter-cli-0.20.6.tgz#2a7202190d7bd64e112b451f94573dbe40a04f04" integrity sha512-tjbAeuGSMhco/EnsThjWkQbDIYMDmdkWsTPsa/NJAW7bjaki9P7oM9TkLxfdlnm4LXd1wR5wVSM2/RTLtZbm6A== -typescript@^4.7.4: - version "4.7.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.4.tgz#1a88596d1cf47d59507a1bcdfb5b9dfe4d488235" - integrity sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ== +typescript@^4.9.0: + version "4.9.5" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" + integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==