diff --git a/cmd/serve/proto/doc.go b/cmd/serve/proto/doc.go new file mode 100644 index 0000000..ecf00d2 --- /dev/null +++ b/cmd/serve/proto/doc.go @@ -0,0 +1,5 @@ +//go:generate protoc -I/usr/local/include -I. -I$GOPATH/src -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis --go_out=plugins=grpc:. serve.proto +//go:generate protoc -I/usr/local/include -I. -I$GOPATH/src -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis --grpc-gateway_out=logtostderr=true:. serve.proto +//go:generate protoc -I/usr/local/include -I. -I$GOPATH/src -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis --swagger_out=logtostderr=true:. serve.proto + +package serve diff --git a/cmd/serve/proto/protoc.sh b/cmd/serve/proto/protoc.sh deleted file mode 100755 index 5789440..0000000 --- a/cmd/serve/proto/protoc.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -protoc -I/usr/local/include -I. \ - -I$GOPATH/src \ - -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ - --go_out=plugins=grpc:. \ - serve.proto - -protoc -I/usr/local/include -I. \ - -I$GOPATH/src \ - -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ - --grpc-gateway_out=logtostderr=true:. \ - serve.proto - -protoc -I/usr/local/include -I. \ - -I$GOPATH/src \ - -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ - --swagger_out=logtostderr=true:. \ - serve.proto diff --git a/cmd/serve/proto/serve.pb.go b/cmd/serve/proto/serve.pb.go index 5c36ac6..7b5228a 100644 --- a/cmd/serve/proto/serve.pb.go +++ b/cmd/serve/proto/serve.pb.go @@ -12,8 +12,6 @@ It has these top-level messages: GetFileResponse GetAnnotationsRequest GetAnnotationsResponse - Annotation - Location */ package serve @@ -21,6 +19,7 @@ import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" import _ "google.golang.org/genproto/googleapis/api/annotations" +import goref_proto "github.com/korfuri/goref/proto" import ( context "golang.org/x/net/context" @@ -38,39 +37,6 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package -type Type int32 - -const ( - Type_Instantiation Type = 0 - Type_Call Type = 1 - Type_Implementation Type = 2 - Type_Extension Type = 3 - Type_Import Type = 4 - Type_Reference Type = 5 -) - -var Type_name = map[int32]string{ - 0: "Instantiation", - 1: "Call", - 2: "Implementation", - 3: "Extension", - 4: "Import", - 5: "Reference", -} -var Type_value = map[string]int32{ - "Instantiation": 0, - "Call": 1, - "Implementation": 2, - "Extension": 3, - "Import": 4, - "Reference": 5, -} - -func (x Type) String() string { - return proto.EnumName(Type_name, int32(x)) -} -func (Type) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } - type GetFileRequest struct { Path string `protobuf:"bytes,1,opt,name=path" json:"path,omitempty"` } @@ -128,8 +94,8 @@ func (m *GetAnnotationsRequest) GetPath() string { } type GetAnnotationsResponse struct { - Path string `protobuf:"bytes,1,opt,name=path" json:"path,omitempty"` - Annotation []*Annotation `protobuf:"bytes,2,rep,name=annotation" json:"annotation,omitempty"` + Path string `protobuf:"bytes,1,opt,name=path" json:"path,omitempty"` + Annotation []*goref_proto.Ref `protobuf:"bytes,2,rep,name=annotation" json:"annotation,omitempty"` } func (m *GetAnnotationsResponse) Reset() { *m = GetAnnotationsResponse{} } @@ -144,109 +110,18 @@ func (m *GetAnnotationsResponse) GetPath() string { return "" } -func (m *GetAnnotationsResponse) GetAnnotation() []*Annotation { +func (m *GetAnnotationsResponse) GetAnnotation() []*goref_proto.Ref { if m != nil { return m.Annotation } return nil } -type Annotation struct { - From *Location `protobuf:"bytes,1,opt,name=from" json:"from,omitempty"` - To *Location `protobuf:"bytes,2,opt,name=to" json:"to,omitempty"` - Type Type `protobuf:"varint,3,opt,name=type,enum=serve.Type" json:"type,omitempty"` -} - -func (m *Annotation) Reset() { *m = Annotation{} } -func (m *Annotation) String() string { return proto.CompactTextString(m) } -func (*Annotation) ProtoMessage() {} -func (*Annotation) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } - -func (m *Annotation) GetFrom() *Location { - if m != nil { - return m.From - } - return nil -} - -func (m *Annotation) GetTo() *Location { - if m != nil { - return m.To - } - return nil -} - -func (m *Annotation) GetType() Type { - if m != nil { - return m.Type - } - return Type_Instantiation -} - -type Location struct { - Package string `protobuf:"bytes,1,opt,name=package" json:"package,omitempty"` - Filename string `protobuf:"bytes,2,opt,name=filename" json:"filename,omitempty"` - StartLine int64 `protobuf:"varint,3,opt,name=start_line,json=startLine" json:"start_line,omitempty"` - StartColumn int64 `protobuf:"varint,4,opt,name=start_column,json=startColumn" json:"start_column,omitempty"` - EndLine int64 `protobuf:"varint,5,opt,name=end_line,json=endLine" json:"end_line,omitempty"` - EndColumn int64 `protobuf:"varint,6,opt,name=end_column,json=endColumn" json:"end_column,omitempty"` -} - -func (m *Location) Reset() { *m = Location{} } -func (m *Location) String() string { return proto.CompactTextString(m) } -func (*Location) ProtoMessage() {} -func (*Location) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } - -func (m *Location) GetPackage() string { - if m != nil { - return m.Package - } - return "" -} - -func (m *Location) GetFilename() string { - if m != nil { - return m.Filename - } - return "" -} - -func (m *Location) GetStartLine() int64 { - if m != nil { - return m.StartLine - } - return 0 -} - -func (m *Location) GetStartColumn() int64 { - if m != nil { - return m.StartColumn - } - return 0 -} - -func (m *Location) GetEndLine() int64 { - if m != nil { - return m.EndLine - } - return 0 -} - -func (m *Location) GetEndColumn() int64 { - if m != nil { - return m.EndColumn - } - return 0 -} - func init() { proto.RegisterType((*GetFileRequest)(nil), "serve.GetFileRequest") proto.RegisterType((*GetFileResponse)(nil), "serve.GetFileResponse") proto.RegisterType((*GetAnnotationsRequest)(nil), "serve.GetAnnotationsRequest") proto.RegisterType((*GetAnnotationsResponse)(nil), "serve.GetAnnotationsResponse") - proto.RegisterType((*Annotation)(nil), "serve.Annotation") - proto.RegisterType((*Location)(nil), "serve.Location") - proto.RegisterEnum("serve.Type", Type_name, Type_value) } // Reference imports to suppress errors if they are not otherwise used. @@ -357,36 +232,25 @@ var _Goref_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("serve.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 495 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x7c, 0x53, 0x4d, 0x6f, 0xd3, 0x40, - 0x10, 0xc5, 0x8e, 0xf3, 0x35, 0xa6, 0xa9, 0x3b, 0x52, 0x2b, 0x63, 0x35, 0x4a, 0x6a, 0x90, 0x88, - 0x82, 0x54, 0xab, 0xe1, 0xcc, 0xa1, 0xaa, 0x20, 0x8a, 0xd4, 0x93, 0xc5, 0x89, 0x4b, 0xb5, 0x38, - 0x93, 0x60, 0x61, 0xef, 0x1a, 0xef, 0x36, 0xa2, 0x42, 0x5c, 0xf8, 0x0b, 0xfc, 0x1d, 0xfe, 0x05, - 0x47, 0xae, 0xfc, 0x10, 0xe4, 0x5d, 0xa7, 0x0e, 0xa5, 0xf4, 0xe6, 0x99, 0xf7, 0xde, 0x3c, 0xcf, - 0xe8, 0x2d, 0xb8, 0x92, 0xca, 0x0d, 0x9d, 0x16, 0xa5, 0x50, 0x02, 0xdb, 0xba, 0x08, 0x8e, 0xd7, - 0x42, 0xac, 0x33, 0x8a, 0x58, 0x91, 0x46, 0x8c, 0x73, 0xa1, 0x98, 0x4a, 0x05, 0x97, 0x86, 0x14, - 0x3e, 0x83, 0xc1, 0x9c, 0xd4, 0x9b, 0x34, 0xa3, 0x98, 0x3e, 0x5d, 0x93, 0x54, 0x88, 0xe0, 0x14, - 0x4c, 0x7d, 0xf0, 0xad, 0xb1, 0x35, 0xe9, 0xc7, 0xfa, 0x3b, 0x3c, 0x87, 0xfd, 0x5b, 0x96, 0x2c, - 0x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a, 0x6d, 0xc7, 0x0c, 0x27, 0xbe, 0x34, 0xca, 0x29, 0x03, - 0xa7, 0x5a, 0x06, 0x0f, 0x60, 0x6f, 0xc1, 0xa5, 0x62, 0x5c, 0xa5, 0x7a, 0x15, 0xef, 0x11, 0xf6, - 0xc0, 0xb9, 0x60, 0x59, 0xe6, 0x59, 0x88, 0x30, 0x58, 0xe4, 0x45, 0x46, 0x39, 0x71, 0x73, 0x5c, - 0xcf, 0xc6, 0x3d, 0xe8, 0xbf, 0xfe, 0xac, 0x88, 0xcb, 0xaa, 0x6c, 0x21, 0x40, 0x67, 0x91, 0x17, - 0xa2, 0x54, 0x9e, 0x53, 0x41, 0x31, 0xad, 0xa8, 0x24, 0x9e, 0x90, 0xd7, 0x9e, 0xfd, 0xb2, 0xa0, - 0x3d, 0x17, 0x25, 0xad, 0xf0, 0x1d, 0x74, 0xeb, 0xc4, 0xe1, 0x61, 0x7d, 0xc9, 0xbf, 0x73, 0x1a, - 0x1c, 0xdd, 0x6d, 0x9b, 0x84, 0x84, 0xe3, 0x6f, 0x3f, 0x7f, 0x7f, 0xb7, 0x03, 0xf4, 0xa3, 0xcd, - 0x59, 0xb4, 0xae, 0x86, 0x45, 0xd5, 0xf9, 0xa2, 0x2f, 0x55, 0x56, 0x5e, 0x4d, 0xa7, 0x5f, 0x71, - 0xa3, 0x33, 0xbf, 0x93, 0x2e, 0x3c, 0x6e, 0x66, 0xfd, 0x9b, 0xd0, 0x60, 0xf8, 0x1f, 0xb4, 0x36, - 0x7c, 0xae, 0x0d, 0x4f, 0x70, 0xd4, 0x18, 0xee, 0xbc, 0xb3, 0xc6, 0xf7, 0x7d, 0x47, 0x3f, 0xb9, - 0x97, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xa3, 0x19, 0x3e, 0x37, 0xa6, 0x03, 0x00, 0x00, + // 306 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x7c, 0x91, 0xcf, 0x4a, 0xf3, 0x40, + 0x14, 0xc5, 0x69, 0xbe, 0xaf, 0xfe, 0x99, 0x82, 0xca, 0x40, 0x4b, 0x18, 0x2a, 0xc6, 0x20, 0x18, + 0x2a, 0x64, 0xb4, 0xae, 0x5d, 0x74, 0x63, 0xf6, 0x59, 0xba, 0x10, 0xd2, 0x72, 0x93, 0x0e, 0xc6, + 0xb9, 0x71, 0x66, 0x92, 0x8d, 0xb8, 0xf1, 0x15, 0x7c, 0x34, 0x97, 0x6e, 0x7d, 0x10, 0xe9, 0x24, + 0x34, 0xb1, 0x6a, 0x77, 0xb9, 0xf7, 0x1e, 0x72, 0xce, 0xf9, 0x0d, 0x19, 0x68, 0x50, 0x15, 0x84, + 0x85, 0x42, 0x83, 0xb4, 0x6f, 0x07, 0x36, 0xce, 0x10, 0xb3, 0x1c, 0x78, 0x52, 0x08, 0x9e, 0x48, + 0x89, 0x26, 0x31, 0x02, 0xa5, 0xae, 0x45, 0x2c, 0xc8, 0x84, 0x59, 0x96, 0xf3, 0x70, 0x81, 0x8f, + 0xfc, 0x01, 0x55, 0x5a, 0x2a, 0xc1, 0x33, 0x54, 0x90, 0x72, 0x7b, 0xe7, 0x0a, 0xd2, 0x5a, 0xe9, + 0x9f, 0x91, 0x83, 0x08, 0xcc, 0xad, 0xc8, 0x21, 0x86, 0xa7, 0x12, 0xb4, 0xa1, 0x94, 0xfc, 0x2f, + 0x12, 0xb3, 0x74, 0x7b, 0x5e, 0x2f, 0xd8, 0x8f, 0xed, 0xb7, 0x3f, 0x23, 0x87, 0x6b, 0x95, 0x2e, + 0x50, 0x6a, 0xf8, 0x4d, 0x46, 0x19, 0xd9, 0x5b, 0xa0, 0x34, 0x20, 0x8d, 0x76, 0x1d, 0xbb, 0x5f, + 0xcf, 0xfe, 0x05, 0x19, 0x46, 0x60, 0x66, 0x6d, 0xd4, 0x6d, 0x7e, 0xf7, 0x64, 0xb4, 0x29, 0xde, + 0x62, 0x7b, 0x49, 0x48, 0x8b, 0xc0, 0x75, 0xbc, 0x7f, 0xc1, 0x60, 0x7a, 0x14, 0xda, 0xbe, 0x75, + 0xcb, 0x30, 0x86, 0x34, 0xee, 0x68, 0xa6, 0x1f, 0x3d, 0xd2, 0x8f, 0x56, 0x77, 0x7a, 0x47, 0x76, + 0x9b, 0x66, 0x74, 0x18, 0xd6, 0x9c, 0xbf, 0xf3, 0x60, 0xa3, 0xcd, 0x75, 0x9d, 0xc4, 0xf7, 0x5e, + 0xdf, 0x3f, 0xdf, 0x1c, 0x46, 0x5d, 0x5e, 0x5d, 0x35, 0x70, 0x53, 0x91, 0x03, 0x7f, 0x5e, 0x65, + 0xba, 0x99, 0x4c, 0x5e, 0x68, 0x65, 0xd9, 0x76, 0x5a, 0xd0, 0x71, 0xfb, 0xaf, 0x9f, 0x24, 0xd8, + 0xf1, 0x1f, 0xd7, 0xc6, 0xf0, 0xdc, 0x1a, 0x9e, 0xd2, 0x93, 0xd6, 0xb0, 0xf3, 0xf2, 0xad, 0xef, + 0x7c, 0xc7, 0x96, 0xbe, 0xfe, 0x0a, 0x00, 0x00, 0xff, 0xff, 0x02, 0x36, 0x8d, 0x60, 0x38, 0x02, + 0x00, 0x00, } diff --git a/cmd/serve/proto/serve.proto b/cmd/serve/proto/serve.proto index c2c227c..0670776 100644 --- a/cmd/serve/proto/serve.proto +++ b/cmd/serve/proto/serve.proto @@ -1,6 +1,7 @@ syntax = "proto3"; import "google/api/annotations.proto"; +import "github.com/korfuri/goref/proto/ref.proto"; package serve; @@ -19,31 +20,7 @@ message GetAnnotationsRequest { message GetAnnotationsResponse { string path = 1; - repeated Annotation annotation = 2; -} - -message Annotation { - Location from = 1; - Location to = 2; - Type type = 3; -} - -message Location { - string package = 1; - string filename = 2; - int64 start_line = 3; - int64 start_column = 4; - int64 end_line = 5; - int64 end_column = 6; -} - -enum Type { - Instantiation = 0; - Call = 1; - Implementation = 2; - Extension = 3; - Import = 4; - Reference = 5; + repeated goref.proto.Ref annotation = 2; } service Goref { diff --git a/cmd/serve/proto/serve.swagger.json b/cmd/serve/proto/serve.swagger.json index 50bd22d..6c45e00 100644 --- a/cmd/serve/proto/serve.swagger.json +++ b/cmd/serve/proto/serve.swagger.json @@ -65,17 +65,71 @@ } }, "definitions": { - "serveAnnotation": { + "gorefprotoLocation": { "type": "object", "properties": { + "position": { + "$ref": "#/definitions/protoPosition" + }, + "package": { + "type": "string" + }, + "ident": { + "type": "string" + } + } + }, + "gorefprotoType": { + "type": "string", + "enum": [ + "Instantiation", + "Call", + "Implementation", + "Extension", + "Import", + "Reference" + ], + "default": "Instantiation" + }, + "protoPosition": { + "type": "object", + "properties": { + "filename": { + "type": "string" + }, + "start_line": { + "type": "integer", + "format": "int32" + }, + "start_col": { + "type": "integer", + "format": "int32" + }, + "end_line": { + "type": "integer", + "format": "int32" + }, + "end_col": { + "type": "integer", + "format": "int32" + } + } + }, + "protoRef": { + "type": "object", + "properties": { + "version": { + "type": "string", + "format": "int64" + }, "from": { - "$ref": "#/definitions/serveLocation" + "$ref": "#/definitions/gorefprotoLocation" }, "to": { - "$ref": "#/definitions/serveLocation" + "$ref": "#/definitions/gorefprotoLocation" }, "type": { - "$ref": "#/definitions/serveType" + "$ref": "#/definitions/gorefprotoType" } } }, @@ -88,7 +142,7 @@ "annotation": { "type": "array", "items": { - "$ref": "#/definitions/serveAnnotation" + "$ref": "#/definitions/protoRef" } } } @@ -103,45 +157,6 @@ "type": "string" } } - }, - "serveLocation": { - "type": "object", - "properties": { - "package": { - "type": "string" - }, - "filename": { - "type": "string" - }, - "start_line": { - "type": "string", - "format": "int64" - }, - "start_column": { - "type": "string", - "format": "int64" - }, - "end_line": { - "type": "string", - "format": "int64" - }, - "end_column": { - "type": "string", - "format": "int64" - } - } - }, - "serveType": { - "type": "string", - "enum": [ - "Instantiation", - "Call", - "Implementation", - "Extension", - "Import", - "Reference" - ], - "default": "Instantiation" } } } diff --git a/proto/doc.go b/proto/doc.go new file mode 100644 index 0000000..8618fea --- /dev/null +++ b/proto/doc.go @@ -0,0 +1,3 @@ +//go:generate protoc --go_out=. ref.proto + +package goref_proto diff --git a/proto/ref.pb.go b/proto/ref.pb.go new file mode 100644 index 0000000..d4d9446 --- /dev/null +++ b/proto/ref.pb.go @@ -0,0 +1,218 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: ref.proto + +/* +Package goref_proto is a generated protocol buffer package. + +It is generated from these files: + ref.proto + +It has these top-level messages: + Ref + Location + Position +*/ +package goref_proto + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type Type int32 + +const ( + Type_Instantiation Type = 0 + Type_Call Type = 1 + Type_Implementation Type = 2 + Type_Extension Type = 3 + Type_Import Type = 4 + Type_Reference Type = 5 +) + +var Type_name = map[int32]string{ + 0: "Instantiation", + 1: "Call", + 2: "Implementation", + 3: "Extension", + 4: "Import", + 5: "Reference", +} +var Type_value = map[string]int32{ + "Instantiation": 0, + "Call": 1, + "Implementation": 2, + "Extension": 3, + "Import": 4, + "Reference": 5, +} + +func (x Type) String() string { + return proto.EnumName(Type_name, int32(x)) +} +func (Type) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +type Ref struct { + Version int64 `protobuf:"varint,1,opt,name=version" json:"version,omitempty"` + From *Location `protobuf:"bytes,2,opt,name=from" json:"from,omitempty"` + To *Location `protobuf:"bytes,3,opt,name=to" json:"to,omitempty"` + Type Type `protobuf:"varint,4,opt,name=type,enum=goref.proto.Type" json:"type,omitempty"` +} + +func (m *Ref) Reset() { *m = Ref{} } +func (m *Ref) String() string { return proto.CompactTextString(m) } +func (*Ref) ProtoMessage() {} +func (*Ref) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +func (m *Ref) GetVersion() int64 { + if m != nil { + return m.Version + } + return 0 +} + +func (m *Ref) GetFrom() *Location { + if m != nil { + return m.From + } + return nil +} + +func (m *Ref) GetTo() *Location { + if m != nil { + return m.To + } + return nil +} + +func (m *Ref) GetType() Type { + if m != nil { + return m.Type + } + return Type_Instantiation +} + +type Location struct { + Position *Position `protobuf:"bytes,1,opt,name=position" json:"position,omitempty"` + Package string `protobuf:"bytes,2,opt,name=package" json:"package,omitempty"` + Ident string `protobuf:"bytes,3,opt,name=ident" json:"ident,omitempty"` +} + +func (m *Location) Reset() { *m = Location{} } +func (m *Location) String() string { return proto.CompactTextString(m) } +func (*Location) ProtoMessage() {} +func (*Location) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } + +func (m *Location) GetPosition() *Position { + if m != nil { + return m.Position + } + return nil +} + +func (m *Location) GetPackage() string { + if m != nil { + return m.Package + } + return "" +} + +func (m *Location) GetIdent() string { + if m != nil { + return m.Ident + } + return "" +} + +type Position struct { + Filename string `protobuf:"bytes,1,opt,name=filename" json:"filename,omitempty"` + StartLine int32 `protobuf:"varint,2,opt,name=start_line,json=startLine" json:"start_line,omitempty"` + StartCol int32 `protobuf:"varint,3,opt,name=start_col,json=startCol" json:"start_col,omitempty"` + EndLine int32 `protobuf:"varint,4,opt,name=end_line,json=endLine" json:"end_line,omitempty"` + EndCol int32 `protobuf:"varint,5,opt,name=end_col,json=endCol" json:"end_col,omitempty"` +} + +func (m *Position) Reset() { *m = Position{} } +func (m *Position) String() string { return proto.CompactTextString(m) } +func (*Position) ProtoMessage() {} +func (*Position) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } + +func (m *Position) GetFilename() string { + if m != nil { + return m.Filename + } + return "" +} + +func (m *Position) GetStartLine() int32 { + if m != nil { + return m.StartLine + } + return 0 +} + +func (m *Position) GetStartCol() int32 { + if m != nil { + return m.StartCol + } + return 0 +} + +func (m *Position) GetEndLine() int32 { + if m != nil { + return m.EndLine + } + return 0 +} + +func (m *Position) GetEndCol() int32 { + if m != nil { + return m.EndCol + } + return 0 +} + +func init() { + proto.RegisterType((*Ref)(nil), "goref.proto.Ref") + proto.RegisterType((*Location)(nil), "goref.proto.Location") + proto.RegisterType((*Position)(nil), "goref.proto.Position") + proto.RegisterEnum("goref.proto.Type", Type_name, Type_value) +} + +func init() { proto.RegisterFile("ref.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 347 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x7c, 0x91, 0x4f, 0x4b, 0xf3, 0x40, + 0x10, 0xc6, 0xdf, 0xfc, 0x6b, 0x93, 0x29, 0x2d, 0xe9, 0xf0, 0x8a, 0x51, 0x11, 0x4a, 0xa1, 0x50, + 0x3d, 0x14, 0xac, 0x1f, 0xa1, 0x78, 0x28, 0xf4, 0x20, 0x8b, 0xf7, 0xb2, 0x26, 0x93, 0xb2, 0xb8, + 0xd9, 0x0d, 0x9b, 0x45, 0xec, 0x17, 0x11, 0x3f, 0xae, 0x64, 0x63, 0x8a, 0x7a, 0xf0, 0x96, 0x67, + 0x7e, 0xcf, 0x33, 0x33, 0x99, 0x85, 0xc4, 0x50, 0xb9, 0xaa, 0x8d, 0xb6, 0x1a, 0x47, 0x07, 0x7d, + 0x12, 0xf3, 0x0f, 0x0f, 0x02, 0x46, 0x25, 0x66, 0x30, 0x7c, 0x25, 0xd3, 0x08, 0xad, 0x32, 0x6f, + 0xe6, 0x2d, 0x03, 0xd6, 0x4b, 0xbc, 0x81, 0xb0, 0x34, 0xba, 0xca, 0xfc, 0x99, 0xb7, 0x1c, 0xad, + 0xcf, 0x56, 0xdf, 0xd2, 0xab, 0x9d, 0xce, 0xb9, 0x15, 0x5a, 0x31, 0x67, 0xc1, 0x05, 0xf8, 0x56, + 0x67, 0xc1, 0x5f, 0x46, 0xdf, 0x6a, 0x5c, 0x40, 0x68,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x69, + 0xd8, 0x22, 0x46, 0x25, 0x19, 0x52, 0x39, 0xa5, 0xd1, 0xf3, 0xc0, 0x5d, 0xf1, 0xfe, 0x33, 0x00, + 0x00, 0xff, 0xff, 0x6d, 0xca, 0x56, 0x68, 0x26, 0x02, 0x00, 0x00, +} diff --git a/proto/ref.proto b/proto/ref.proto new file mode 100644 index 0000000..905efbb --- /dev/null +++ b/proto/ref.proto @@ -0,0 +1,33 @@ +syntax = "proto3"; + +package goref.proto; + +message Ref { + int64 version = 1; + Location from = 2; + Location to = 3; + Type type = 4; +} + +message Location { + Position position = 1; + string package = 2; + string ident = 3; +} + +message Position { + string filename = 1; + int32 start_line = 2; + int32 start_col = 3; + int32 end_line = 4; + int32 end_col = 5; +} + +enum Type { + Instantiation = 0; + Call = 1; + Implementation = 2; + Extension = 3; + Import = 4; + Reference = 5; +}