mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 17:31:43 +00:00
Add TypeScript bindings for LSIF typed (#29603)
Co-authored-by: Eric Fritz <eric@eric-fritz.com>
This commit is contained in:
parent
4c33c9d011
commit
70f8bcb6e5
@ -1,5 +1,6 @@
|
||||
.bin/
|
||||
*.bundle.*
|
||||
lib/codeintel/lsif_typed
|
||||
client/phabricator/scripts/loader.js
|
||||
client/browser/build
|
||||
**/package.json
|
||||
|
||||
@ -5,3 +5,6 @@ plugins:
|
||||
out: .
|
||||
opt:
|
||||
- paths=source_relative
|
||||
- name: ts
|
||||
out: .
|
||||
path: ./node_modules/.bin/protoc-gen-ts
|
||||
|
||||
964
lib/codeintel/lsif_typed/lsif.ts
Normal file
964
lib/codeintel/lsif_typed/lsif.ts
Normal file
@ -0,0 +1,964 @@
|
||||
/**
|
||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||
* compiler version: 3.17.3
|
||||
* source: lib/codeintel/lsif_typed/lsif.proto
|
||||
* git: https://github.com/thesayyn/protoc-gen-ts
|
||||
* */
|
||||
import * as pb_1 from "google-protobuf";
|
||||
export namespace lib.codeintel.lsif_typed {
|
||||
export class Index extends pb_1.Message {
|
||||
constructor(data?: any[] | {
|
||||
metadata?: Metadata;
|
||||
document?: Document[];
|
||||
package?: Package[];
|
||||
external_symbols?: Symbol[];
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 3, 4], []);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("metadata" in data && data.metadata != undefined) {
|
||||
this.metadata = data.metadata;
|
||||
}
|
||||
if ("document" in data && data.document != undefined) {
|
||||
this.document = data.document;
|
||||
}
|
||||
if ("package" in data && data.package != undefined) {
|
||||
this.package = data.package;
|
||||
}
|
||||
if ("external_symbols" in data && data.external_symbols != undefined) {
|
||||
this.external_symbols = data.external_symbols;
|
||||
}
|
||||
}
|
||||
}
|
||||
get metadata() {
|
||||
return pb_1.Message.getWrapperField(this, Metadata, 1) as Metadata;
|
||||
}
|
||||
set metadata(value: Metadata) {
|
||||
pb_1.Message.setWrapperField(this, 1, value);
|
||||
}
|
||||
get document() {
|
||||
return pb_1.Message.getRepeatedWrapperField(this, Document, 2) as Document[];
|
||||
}
|
||||
set document(value: Document[]) {
|
||||
pb_1.Message.setRepeatedWrapperField(this, 2, value);
|
||||
}
|
||||
get package() {
|
||||
return pb_1.Message.getRepeatedWrapperField(this, Package, 3) as Package[];
|
||||
}
|
||||
set package(value: Package[]) {
|
||||
pb_1.Message.setRepeatedWrapperField(this, 3, value);
|
||||
}
|
||||
get external_symbols() {
|
||||
return pb_1.Message.getRepeatedWrapperField(this, Symbol, 4) as Symbol[];
|
||||
}
|
||||
set external_symbols(value: Symbol[]) {
|
||||
pb_1.Message.setRepeatedWrapperField(this, 4, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
metadata?: ReturnType<typeof Metadata.prototype.toObject>;
|
||||
document?: ReturnType<typeof Document.prototype.toObject>[];
|
||||
package?: ReturnType<typeof Package.prototype.toObject>[];
|
||||
external_symbols?: ReturnType<typeof Symbol.prototype.toObject>[];
|
||||
}) {
|
||||
const message = new Index({});
|
||||
if (data.metadata != null) {
|
||||
message.metadata = Metadata.fromObject(data.metadata);
|
||||
}
|
||||
if (data.document != null) {
|
||||
message.document = data.document.map(item => Document.fromObject(item));
|
||||
}
|
||||
if (data.package != null) {
|
||||
message.package = data.package.map(item => Package.fromObject(item));
|
||||
}
|
||||
if (data.external_symbols != null) {
|
||||
message.external_symbols = data.external_symbols.map(item => Symbol.fromObject(item));
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
metadata?: ReturnType<typeof Metadata.prototype.toObject>;
|
||||
document?: ReturnType<typeof Document.prototype.toObject>[];
|
||||
package?: ReturnType<typeof Package.prototype.toObject>[];
|
||||
external_symbols?: ReturnType<typeof Symbol.prototype.toObject>[];
|
||||
} = {};
|
||||
if (this.metadata != null) {
|
||||
data.metadata = this.metadata.toObject();
|
||||
}
|
||||
if (this.document != null) {
|
||||
data.document = this.document.map((item: Document) => item.toObject());
|
||||
}
|
||||
if (this.package != null) {
|
||||
data.package = this.package.map((item: Package) => item.toObject());
|
||||
}
|
||||
if (this.external_symbols != null) {
|
||||
data.external_symbols = this.external_symbols.map((item: Symbol) => item.toObject());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.metadata !== undefined)
|
||||
writer.writeMessage(1, this.metadata, () => this.metadata.serialize(writer));
|
||||
if (this.document !== undefined)
|
||||
writer.writeRepeatedMessage(2, this.document, (item: Document) => item.serialize(writer));
|
||||
if (this.package !== undefined)
|
||||
writer.writeRepeatedMessage(3, this.package, (item: Package) => item.serialize(writer));
|
||||
if (this.external_symbols !== undefined)
|
||||
writer.writeRepeatedMessage(4, this.external_symbols, (item: Symbol) => item.serialize(writer));
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Index {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Index();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
reader.readMessage(message.metadata, () => message.metadata = Metadata.deserialize(reader));
|
||||
break;
|
||||
case 2:
|
||||
reader.readMessage(message.document, () => pb_1.Message.addToRepeatedWrapperField(message, 2, Document.deserialize(reader), Document));
|
||||
break;
|
||||
case 3:
|
||||
reader.readMessage(message.package, () => pb_1.Message.addToRepeatedWrapperField(message, 3, Package.deserialize(reader), Package));
|
||||
break;
|
||||
case 4:
|
||||
reader.readMessage(message.external_symbols, () => pb_1.Message.addToRepeatedWrapperField(message, 4, Symbol.deserialize(reader), Symbol));
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): Index {
|
||||
return Index.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class Metadata extends pb_1.Message {
|
||||
constructor(data?: any[] | {
|
||||
tool_info?: ToolInfo;
|
||||
project_root?: string;
|
||||
position_encoding?: Metadata.PositionEncoding;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], []);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("tool_info" in data && data.tool_info != undefined) {
|
||||
this.tool_info = data.tool_info;
|
||||
}
|
||||
if ("project_root" in data && data.project_root != undefined) {
|
||||
this.project_root = data.project_root;
|
||||
}
|
||||
if ("position_encoding" in data && data.position_encoding != undefined) {
|
||||
this.position_encoding = data.position_encoding;
|
||||
}
|
||||
}
|
||||
}
|
||||
get tool_info() {
|
||||
return pb_1.Message.getWrapperField(this, ToolInfo, 1) as ToolInfo;
|
||||
}
|
||||
set tool_info(value: ToolInfo) {
|
||||
pb_1.Message.setWrapperField(this, 1, value);
|
||||
}
|
||||
get project_root() {
|
||||
return pb_1.Message.getField(this, 2) as string;
|
||||
}
|
||||
set project_root(value: string) {
|
||||
pb_1.Message.setField(this, 2, value);
|
||||
}
|
||||
get position_encoding() {
|
||||
return pb_1.Message.getField(this, 3) as Metadata.PositionEncoding;
|
||||
}
|
||||
set position_encoding(value: Metadata.PositionEncoding) {
|
||||
pb_1.Message.setField(this, 3, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
tool_info?: ReturnType<typeof ToolInfo.prototype.toObject>;
|
||||
project_root?: string;
|
||||
position_encoding?: Metadata.PositionEncoding;
|
||||
}) {
|
||||
const message = new Metadata({});
|
||||
if (data.tool_info != null) {
|
||||
message.tool_info = ToolInfo.fromObject(data.tool_info);
|
||||
}
|
||||
if (data.project_root != null) {
|
||||
message.project_root = data.project_root;
|
||||
}
|
||||
if (data.position_encoding != null) {
|
||||
message.position_encoding = data.position_encoding;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
tool_info?: ReturnType<typeof ToolInfo.prototype.toObject>;
|
||||
project_root?: string;
|
||||
position_encoding?: Metadata.PositionEncoding;
|
||||
} = {};
|
||||
if (this.tool_info != null) {
|
||||
data.tool_info = this.tool_info.toObject();
|
||||
}
|
||||
if (this.project_root != null) {
|
||||
data.project_root = this.project_root;
|
||||
}
|
||||
if (this.position_encoding != null) {
|
||||
data.position_encoding = this.position_encoding;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.tool_info !== undefined)
|
||||
writer.writeMessage(1, this.tool_info, () => this.tool_info.serialize(writer));
|
||||
if (typeof this.project_root === "string" && this.project_root.length)
|
||||
writer.writeString(2, this.project_root);
|
||||
if (this.position_encoding !== undefined)
|
||||
writer.writeEnum(3, this.position_encoding);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Metadata {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Metadata();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
reader.readMessage(message.tool_info, () => message.tool_info = ToolInfo.deserialize(reader));
|
||||
break;
|
||||
case 2:
|
||||
message.project_root = reader.readString();
|
||||
break;
|
||||
case 3:
|
||||
message.position_encoding = reader.readEnum();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): Metadata {
|
||||
return Metadata.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export namespace Metadata {
|
||||
export enum PositionEncoding {
|
||||
POSITION_ENCODING_UNSPECIFIED = 0,
|
||||
POSITION_ENCODING_UTF8 = 1,
|
||||
POSITION_ENCODING_UTF16 = 2
|
||||
}
|
||||
}
|
||||
export class ToolInfo extends pb_1.Message {
|
||||
constructor(data?: any[] | {
|
||||
name?: string;
|
||||
version?: string;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], []);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("name" in data && data.name != undefined) {
|
||||
this.name = data.name;
|
||||
}
|
||||
if ("version" in data && data.version != undefined) {
|
||||
this.version = data.version;
|
||||
}
|
||||
}
|
||||
}
|
||||
get name() {
|
||||
return pb_1.Message.getField(this, 1) as string;
|
||||
}
|
||||
set name(value: string) {
|
||||
pb_1.Message.setField(this, 1, value);
|
||||
}
|
||||
get version() {
|
||||
return pb_1.Message.getField(this, 2) as string;
|
||||
}
|
||||
set version(value: string) {
|
||||
pb_1.Message.setField(this, 2, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
name?: string;
|
||||
version?: string;
|
||||
}) {
|
||||
const message = new ToolInfo({});
|
||||
if (data.name != null) {
|
||||
message.name = data.name;
|
||||
}
|
||||
if (data.version != null) {
|
||||
message.version = data.version;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
name?: string;
|
||||
version?: string;
|
||||
} = {};
|
||||
if (this.name != null) {
|
||||
data.name = this.name;
|
||||
}
|
||||
if (this.version != null) {
|
||||
data.version = this.version;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (typeof this.name === "string" && this.name.length)
|
||||
writer.writeString(1, this.name);
|
||||
if (typeof this.version === "string" && this.version.length)
|
||||
writer.writeString(2, this.version);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ToolInfo {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ToolInfo();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
message.name = reader.readString();
|
||||
break;
|
||||
case 2:
|
||||
message.version = reader.readString();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): ToolInfo {
|
||||
return ToolInfo.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class Document extends pb_1.Message {
|
||||
constructor(data?: any[] | {
|
||||
relative_path?: string;
|
||||
occurrences?: Occurrence[];
|
||||
symbols?: Symbol[];
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 3], []);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("relative_path" in data && data.relative_path != undefined) {
|
||||
this.relative_path = data.relative_path;
|
||||
}
|
||||
if ("occurrences" in data && data.occurrences != undefined) {
|
||||
this.occurrences = data.occurrences;
|
||||
}
|
||||
if ("symbols" in data && data.symbols != undefined) {
|
||||
this.symbols = data.symbols;
|
||||
}
|
||||
}
|
||||
}
|
||||
get relative_path() {
|
||||
return pb_1.Message.getField(this, 1) as string;
|
||||
}
|
||||
set relative_path(value: string) {
|
||||
pb_1.Message.setField(this, 1, value);
|
||||
}
|
||||
get occurrences() {
|
||||
return pb_1.Message.getRepeatedWrapperField(this, Occurrence, 2) as Occurrence[];
|
||||
}
|
||||
set occurrences(value: Occurrence[]) {
|
||||
pb_1.Message.setRepeatedWrapperField(this, 2, value);
|
||||
}
|
||||
get symbols() {
|
||||
return pb_1.Message.getRepeatedWrapperField(this, Symbol, 3) as Symbol[];
|
||||
}
|
||||
set symbols(value: Symbol[]) {
|
||||
pb_1.Message.setRepeatedWrapperField(this, 3, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
relative_path?: string;
|
||||
occurrences?: ReturnType<typeof Occurrence.prototype.toObject>[];
|
||||
symbols?: ReturnType<typeof Symbol.prototype.toObject>[];
|
||||
}) {
|
||||
const message = new Document({});
|
||||
if (data.relative_path != null) {
|
||||
message.relative_path = data.relative_path;
|
||||
}
|
||||
if (data.occurrences != null) {
|
||||
message.occurrences = data.occurrences.map(item => Occurrence.fromObject(item));
|
||||
}
|
||||
if (data.symbols != null) {
|
||||
message.symbols = data.symbols.map(item => Symbol.fromObject(item));
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
relative_path?: string;
|
||||
occurrences?: ReturnType<typeof Occurrence.prototype.toObject>[];
|
||||
symbols?: ReturnType<typeof Symbol.prototype.toObject>[];
|
||||
} = {};
|
||||
if (this.relative_path != null) {
|
||||
data.relative_path = this.relative_path;
|
||||
}
|
||||
if (this.occurrences != null) {
|
||||
data.occurrences = this.occurrences.map((item: Occurrence) => item.toObject());
|
||||
}
|
||||
if (this.symbols != null) {
|
||||
data.symbols = this.symbols.map((item: Symbol) => item.toObject());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (typeof this.relative_path === "string" && this.relative_path.length)
|
||||
writer.writeString(1, this.relative_path);
|
||||
if (this.occurrences !== undefined)
|
||||
writer.writeRepeatedMessage(2, this.occurrences, (item: Occurrence) => item.serialize(writer));
|
||||
if (this.symbols !== undefined)
|
||||
writer.writeRepeatedMessage(3, this.symbols, (item: Symbol) => item.serialize(writer));
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Document {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Document();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
message.relative_path = reader.readString();
|
||||
break;
|
||||
case 2:
|
||||
reader.readMessage(message.occurrences, () => pb_1.Message.addToRepeatedWrapperField(message, 2, Occurrence.deserialize(reader), Occurrence));
|
||||
break;
|
||||
case 3:
|
||||
reader.readMessage(message.symbols, () => pb_1.Message.addToRepeatedWrapperField(message, 3, Symbol.deserialize(reader), Symbol));
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): Document {
|
||||
return Document.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class Package extends pb_1.Message {
|
||||
constructor(data?: any[] | {
|
||||
uri?: string;
|
||||
name?: string;
|
||||
version?: string;
|
||||
manager?: string;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], []);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("uri" in data && data.uri != undefined) {
|
||||
this.uri = data.uri;
|
||||
}
|
||||
if ("name" in data && data.name != undefined) {
|
||||
this.name = data.name;
|
||||
}
|
||||
if ("version" in data && data.version != undefined) {
|
||||
this.version = data.version;
|
||||
}
|
||||
if ("manager" in data && data.manager != undefined) {
|
||||
this.manager = data.manager;
|
||||
}
|
||||
}
|
||||
}
|
||||
get uri() {
|
||||
return pb_1.Message.getField(this, 1) as string;
|
||||
}
|
||||
set uri(value: string) {
|
||||
pb_1.Message.setField(this, 1, value);
|
||||
}
|
||||
get name() {
|
||||
return pb_1.Message.getField(this, 2) as string;
|
||||
}
|
||||
set name(value: string) {
|
||||
pb_1.Message.setField(this, 2, value);
|
||||
}
|
||||
get version() {
|
||||
return pb_1.Message.getField(this, 3) as string;
|
||||
}
|
||||
set version(value: string) {
|
||||
pb_1.Message.setField(this, 3, value);
|
||||
}
|
||||
get manager() {
|
||||
return pb_1.Message.getField(this, 4) as string;
|
||||
}
|
||||
set manager(value: string) {
|
||||
pb_1.Message.setField(this, 4, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
uri?: string;
|
||||
name?: string;
|
||||
version?: string;
|
||||
manager?: string;
|
||||
}) {
|
||||
const message = new Package({});
|
||||
if (data.uri != null) {
|
||||
message.uri = data.uri;
|
||||
}
|
||||
if (data.name != null) {
|
||||
message.name = data.name;
|
||||
}
|
||||
if (data.version != null) {
|
||||
message.version = data.version;
|
||||
}
|
||||
if (data.manager != null) {
|
||||
message.manager = data.manager;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
uri?: string;
|
||||
name?: string;
|
||||
version?: string;
|
||||
manager?: string;
|
||||
} = {};
|
||||
if (this.uri != null) {
|
||||
data.uri = this.uri;
|
||||
}
|
||||
if (this.name != null) {
|
||||
data.name = this.name;
|
||||
}
|
||||
if (this.version != null) {
|
||||
data.version = this.version;
|
||||
}
|
||||
if (this.manager != null) {
|
||||
data.manager = this.manager;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (typeof this.uri === "string" && this.uri.length)
|
||||
writer.writeString(1, this.uri);
|
||||
if (typeof this.name === "string" && this.name.length)
|
||||
writer.writeString(2, this.name);
|
||||
if (typeof this.version === "string" && this.version.length)
|
||||
writer.writeString(3, this.version);
|
||||
if (typeof this.manager === "string" && this.manager.length)
|
||||
writer.writeString(4, this.manager);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Package {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Package();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
message.uri = reader.readString();
|
||||
break;
|
||||
case 2:
|
||||
message.name = reader.readString();
|
||||
break;
|
||||
case 3:
|
||||
message.version = reader.readString();
|
||||
break;
|
||||
case 4:
|
||||
message.manager = reader.readString();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): Package {
|
||||
return Package.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class Symbol extends pb_1.Message {
|
||||
constructor(data?: any[] | {
|
||||
uri?: string;
|
||||
unique?: Symbol.Unique;
|
||||
documentation?: string[];
|
||||
package_uri?: string;
|
||||
reference_symbols?: string[];
|
||||
implementation_symbols?: string[];
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3, 5, 6], []);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("uri" in data && data.uri != undefined) {
|
||||
this.uri = data.uri;
|
||||
}
|
||||
if ("unique" in data && data.unique != undefined) {
|
||||
this.unique = data.unique;
|
||||
}
|
||||
if ("documentation" in data && data.documentation != undefined) {
|
||||
this.documentation = data.documentation;
|
||||
}
|
||||
if ("package_uri" in data && data.package_uri != undefined) {
|
||||
this.package_uri = data.package_uri;
|
||||
}
|
||||
if ("reference_symbols" in data && data.reference_symbols != undefined) {
|
||||
this.reference_symbols = data.reference_symbols;
|
||||
}
|
||||
if ("implementation_symbols" in data && data.implementation_symbols != undefined) {
|
||||
this.implementation_symbols = data.implementation_symbols;
|
||||
}
|
||||
}
|
||||
}
|
||||
get uri() {
|
||||
return pb_1.Message.getField(this, 1) as string;
|
||||
}
|
||||
set uri(value: string) {
|
||||
pb_1.Message.setField(this, 1, value);
|
||||
}
|
||||
get unique() {
|
||||
return pb_1.Message.getField(this, 2) as Symbol.Unique;
|
||||
}
|
||||
set unique(value: Symbol.Unique) {
|
||||
pb_1.Message.setField(this, 2, value);
|
||||
}
|
||||
get documentation() {
|
||||
return pb_1.Message.getField(this, 3) as string[];
|
||||
}
|
||||
set documentation(value: string[]) {
|
||||
pb_1.Message.setField(this, 3, value);
|
||||
}
|
||||
get package_uri() {
|
||||
return pb_1.Message.getField(this, 4) as string;
|
||||
}
|
||||
set package_uri(value: string) {
|
||||
pb_1.Message.setField(this, 4, value);
|
||||
}
|
||||
get reference_symbols() {
|
||||
return pb_1.Message.getField(this, 5) as string[];
|
||||
}
|
||||
set reference_symbols(value: string[]) {
|
||||
pb_1.Message.setField(this, 5, value);
|
||||
}
|
||||
get implementation_symbols() {
|
||||
return pb_1.Message.getField(this, 6) as string[];
|
||||
}
|
||||
set implementation_symbols(value: string[]) {
|
||||
pb_1.Message.setField(this, 6, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
uri?: string;
|
||||
unique?: Symbol.Unique;
|
||||
documentation?: string[];
|
||||
package_uri?: string;
|
||||
reference_symbols?: string[];
|
||||
implementation_symbols?: string[];
|
||||
}) {
|
||||
const message = new Symbol({});
|
||||
if (data.uri != null) {
|
||||
message.uri = data.uri;
|
||||
}
|
||||
if (data.unique != null) {
|
||||
message.unique = data.unique;
|
||||
}
|
||||
if (data.documentation != null) {
|
||||
message.documentation = data.documentation;
|
||||
}
|
||||
if (data.package_uri != null) {
|
||||
message.package_uri = data.package_uri;
|
||||
}
|
||||
if (data.reference_symbols != null) {
|
||||
message.reference_symbols = data.reference_symbols;
|
||||
}
|
||||
if (data.implementation_symbols != null) {
|
||||
message.implementation_symbols = data.implementation_symbols;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
uri?: string;
|
||||
unique?: Symbol.Unique;
|
||||
documentation?: string[];
|
||||
package_uri?: string;
|
||||
reference_symbols?: string[];
|
||||
implementation_symbols?: string[];
|
||||
} = {};
|
||||
if (this.uri != null) {
|
||||
data.uri = this.uri;
|
||||
}
|
||||
if (this.unique != null) {
|
||||
data.unique = this.unique;
|
||||
}
|
||||
if (this.documentation != null) {
|
||||
data.documentation = this.documentation;
|
||||
}
|
||||
if (this.package_uri != null) {
|
||||
data.package_uri = this.package_uri;
|
||||
}
|
||||
if (this.reference_symbols != null) {
|
||||
data.reference_symbols = this.reference_symbols;
|
||||
}
|
||||
if (this.implementation_symbols != null) {
|
||||
data.implementation_symbols = this.implementation_symbols;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (typeof this.uri === "string" && this.uri.length)
|
||||
writer.writeString(1, this.uri);
|
||||
if (this.unique !== undefined)
|
||||
writer.writeEnum(2, this.unique);
|
||||
if (this.documentation !== undefined)
|
||||
writer.writeRepeatedString(3, this.documentation);
|
||||
if (typeof this.package_uri === "string" && this.package_uri.length)
|
||||
writer.writeString(4, this.package_uri);
|
||||
if (this.reference_symbols !== undefined)
|
||||
writer.writeRepeatedString(5, this.reference_symbols);
|
||||
if (this.implementation_symbols !== undefined)
|
||||
writer.writeRepeatedString(6, this.implementation_symbols);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Symbol {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Symbol();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
message.uri = reader.readString();
|
||||
break;
|
||||
case 2:
|
||||
message.unique = reader.readEnum();
|
||||
break;
|
||||
case 3:
|
||||
pb_1.Message.addToRepeatedField(message, 3, reader.readString());
|
||||
break;
|
||||
case 4:
|
||||
message.package_uri = reader.readString();
|
||||
break;
|
||||
case 5:
|
||||
pb_1.Message.addToRepeatedField(message, 5, reader.readString());
|
||||
break;
|
||||
case 6:
|
||||
pb_1.Message.addToRepeatedField(message, 6, reader.readString());
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): Symbol {
|
||||
return Symbol.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export namespace Symbol {
|
||||
export enum Unique {
|
||||
UNIQUE_UNSPECIFIED = 0,
|
||||
UNIQUE_DOCUMENT = 1,
|
||||
UNIQUE_GLOBAL = 2
|
||||
}
|
||||
}
|
||||
export class Occurrence extends pb_1.Message {
|
||||
constructor(data?: any[] | {
|
||||
range?: number[];
|
||||
symbol_uri?: string;
|
||||
symbol_role?: Occurrence.Role;
|
||||
symbol_documentation?: string[];
|
||||
highlight?: Occurrence.Highlight;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 4], []);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("range" in data && data.range != undefined) {
|
||||
this.range = data.range;
|
||||
}
|
||||
if ("symbol_uri" in data && data.symbol_uri != undefined) {
|
||||
this.symbol_uri = data.symbol_uri;
|
||||
}
|
||||
if ("symbol_role" in data && data.symbol_role != undefined) {
|
||||
this.symbol_role = data.symbol_role;
|
||||
}
|
||||
if ("symbol_documentation" in data && data.symbol_documentation != undefined) {
|
||||
this.symbol_documentation = data.symbol_documentation;
|
||||
}
|
||||
if ("highlight" in data && data.highlight != undefined) {
|
||||
this.highlight = data.highlight;
|
||||
}
|
||||
}
|
||||
}
|
||||
get range() {
|
||||
return pb_1.Message.getField(this, 1) as number[];
|
||||
}
|
||||
set range(value: number[]) {
|
||||
pb_1.Message.setField(this, 1, value);
|
||||
}
|
||||
get symbol_uri() {
|
||||
return pb_1.Message.getField(this, 2) as string;
|
||||
}
|
||||
set symbol_uri(value: string) {
|
||||
pb_1.Message.setField(this, 2, value);
|
||||
}
|
||||
get symbol_role() {
|
||||
return pb_1.Message.getField(this, 3) as Occurrence.Role;
|
||||
}
|
||||
set symbol_role(value: Occurrence.Role) {
|
||||
pb_1.Message.setField(this, 3, value);
|
||||
}
|
||||
get symbol_documentation() {
|
||||
return pb_1.Message.getField(this, 4) as string[];
|
||||
}
|
||||
set symbol_documentation(value: string[]) {
|
||||
pb_1.Message.setField(this, 4, value);
|
||||
}
|
||||
get highlight() {
|
||||
return pb_1.Message.getField(this, 5) as Occurrence.Highlight;
|
||||
}
|
||||
set highlight(value: Occurrence.Highlight) {
|
||||
pb_1.Message.setField(this, 5, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
range?: number[];
|
||||
symbol_uri?: string;
|
||||
symbol_role?: Occurrence.Role;
|
||||
symbol_documentation?: string[];
|
||||
highlight?: Occurrence.Highlight;
|
||||
}) {
|
||||
const message = new Occurrence({});
|
||||
if (data.range != null) {
|
||||
message.range = data.range;
|
||||
}
|
||||
if (data.symbol_uri != null) {
|
||||
message.symbol_uri = data.symbol_uri;
|
||||
}
|
||||
if (data.symbol_role != null) {
|
||||
message.symbol_role = data.symbol_role;
|
||||
}
|
||||
if (data.symbol_documentation != null) {
|
||||
message.symbol_documentation = data.symbol_documentation;
|
||||
}
|
||||
if (data.highlight != null) {
|
||||
message.highlight = data.highlight;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
range?: number[];
|
||||
symbol_uri?: string;
|
||||
symbol_role?: Occurrence.Role;
|
||||
symbol_documentation?: string[];
|
||||
highlight?: Occurrence.Highlight;
|
||||
} = {};
|
||||
if (this.range != null) {
|
||||
data.range = this.range;
|
||||
}
|
||||
if (this.symbol_uri != null) {
|
||||
data.symbol_uri = this.symbol_uri;
|
||||
}
|
||||
if (this.symbol_role != null) {
|
||||
data.symbol_role = this.symbol_role;
|
||||
}
|
||||
if (this.symbol_documentation != null) {
|
||||
data.symbol_documentation = this.symbol_documentation;
|
||||
}
|
||||
if (this.highlight != null) {
|
||||
data.highlight = this.highlight;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.range !== undefined)
|
||||
writer.writePackedInt32(1, this.range);
|
||||
if (typeof this.symbol_uri === "string" && this.symbol_uri.length)
|
||||
writer.writeString(2, this.symbol_uri);
|
||||
if (this.symbol_role !== undefined)
|
||||
writer.writeEnum(3, this.symbol_role);
|
||||
if (this.symbol_documentation !== undefined)
|
||||
writer.writeRepeatedString(4, this.symbol_documentation);
|
||||
if (this.highlight !== undefined)
|
||||
writer.writeEnum(5, this.highlight);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Occurrence {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Occurrence();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
message.range = reader.readPackedInt32();
|
||||
break;
|
||||
case 2:
|
||||
message.symbol_uri = reader.readString();
|
||||
break;
|
||||
case 3:
|
||||
message.symbol_role = reader.readEnum();
|
||||
break;
|
||||
case 4:
|
||||
pb_1.Message.addToRepeatedField(message, 4, reader.readString());
|
||||
break;
|
||||
case 5:
|
||||
message.highlight = reader.readEnum();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): Occurrence {
|
||||
return Occurrence.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export namespace Occurrence {
|
||||
export enum Role {
|
||||
ROLE_UNSPECIFIED = 0,
|
||||
ROLE_DEFINITION = 1,
|
||||
ROLE_REFERENCE = 2
|
||||
}
|
||||
export enum Highlight {
|
||||
HIGHLIGHT_UNSPECIFIED = 0,
|
||||
HIGHLIGHT_STRING_LITERAL = 1,
|
||||
HIGHLIGHT_NUMERIC_LITERAL = 2,
|
||||
HIGHLIGHT_IDENTIFIER = 3,
|
||||
HIGHLIGHT_METHOD_IDENTIFIER = 4,
|
||||
HIGHLIGHT_TYPE_IDENTIFIER = 5,
|
||||
HIGHLIGHT_TERM_IDENTIFIER = 6,
|
||||
HIGHLIGHT_LOCAL_IDENTIFIER = 7,
|
||||
HIGHLIGHT_SHADED_IDENTIFIER = 8,
|
||||
HIGHLIGHT_PACKAGE_IDENTIFIER = 9
|
||||
}
|
||||
}
|
||||
}
|
||||
8
lib/codeintel/lsif_typed/package.json
Normal file
8
lib/codeintel/lsif_typed/package.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"private": true,
|
||||
"name": "@sourcegraph/lsif-typed",
|
||||
"version": "0.0.1",
|
||||
"description": "Schema for LSIF typed",
|
||||
"sideEffects": false,
|
||||
"license": "Apache-2.0"
|
||||
}
|
||||
@ -88,6 +88,7 @@
|
||||
},
|
||||
"workspaces": {
|
||||
"packages": [
|
||||
"lib/codeintel/lsif_typed",
|
||||
"client/*",
|
||||
"client/sandboxes/*"
|
||||
]
|
||||
@ -248,6 +249,7 @@
|
||||
"fancy-log": "^1.3.3",
|
||||
"get-port": "^5.1.1",
|
||||
"glob": "^7.1.6",
|
||||
"google-protobuf": "3.17.3",
|
||||
"googleapis": "^47.0.0",
|
||||
"gql2ts": "^1.10.1",
|
||||
"graphql": "^15.4.0",
|
||||
@ -285,6 +287,7 @@
|
||||
"postcss-modules": "^4.2.2",
|
||||
"prettier": "^2.2.1",
|
||||
"process": "^0.11.10",
|
||||
"protoc-gen-ts": "0.8.1",
|
||||
"puppeteer": "12.0.1",
|
||||
"puppeteer-firefox": "^0.5.1",
|
||||
"react-refresh": "^0.10.0",
|
||||
|
||||
10
yarn.lock
10
yarn.lock
@ -12863,6 +12863,11 @@ google-p12-pem@^2.0.0:
|
||||
dependencies:
|
||||
node-forge "^0.9.0"
|
||||
|
||||
google-protobuf@3.17.3:
|
||||
version "3.17.3"
|
||||
resolved "https://registry.npmjs.org/google-protobuf/-/google-protobuf-3.17.3.tgz#f87595073545a77946c8f0b67c302c5f7646d700"
|
||||
integrity sha512-OVPzcSWIAJ+d5yiHyeaLrdufQtrvaBrF4JQg+z8ynTkbO3uFcujqXszTumqg1cGsAsjkWnI+M5B1xZ19yR4Wyg==
|
||||
|
||||
googleapis-common@^3.2.0:
|
||||
version "3.2.0"
|
||||
resolved "https://registry.npmjs.org/googleapis-common/-/googleapis-common-3.2.0.tgz#80e706405065a0fe897b6d15bb2824f8a18e1776"
|
||||
@ -19147,6 +19152,11 @@ property-information@^5.0.0, property-information@^5.3.0:
|
||||
dependencies:
|
||||
xtend "^4.0.0"
|
||||
|
||||
protoc-gen-ts@0.8.1:
|
||||
version "0.8.1"
|
||||
resolved "https://registry.npmjs.org/protoc-gen-ts/-/protoc-gen-ts-0.8.1.tgz#9d4d5ac9ad884151bf28be66b906a08d4f50645d"
|
||||
integrity sha512-T1Gqw8ekPeSmB6vAhpBKT77Fu0gRThwz3QqQ+dhohz/I554a6YhsoF/nKy4Qo1C8Ukoag3RVcYeXz4IBC4643Q==
|
||||
|
||||
proxy-addr@~2.0.5:
|
||||
version "2.0.6"
|
||||
resolved "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.6.tgz#fdc2336505447d3f2f2c638ed272caf614bbb2bf"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user