~bigbes/tarantool-protobuf: b75b8791

codegen: EmmyLua type annotations for messages, enums, wrappers

Generated Lua modules now carry lua-language-server type annotations:
  ---@alias <full.Enum> integer            per enum
  ---@class <full.Message>                  per message
  ---@field <name> <type>                   per field
  ---@param / ---@return                    per wrapper

Mappings:
  bool                       -> boolean
  string / bytes             -> string
  float / double             -> number
  all int kinds              -> integer  (64-bit cdata typed as integer;
                                          LSP has no cdata model)
  enum / message             -> <full.Name>  (resolves to declared alias/class)
  repeated T                 -> T[]
  map<K,V>                   -> table<K, V>

Presence markers (trailing `?` on field name):
  proto3 explicit optional
  oneof branches             (only one is set at a time)

Wrapper signatures cover _new / _encode / _decode / _decode_lazy plus
_has_<field> / _clear_<field> on optional fields. _decode_lazy returns
pb.MessageView, which is declared inline in runtime/pb/lazy.lua along
with pb.ArrayView and pb.MapView so cross-file references resolve in
any project that requires('pb.lazy').

Class identifiers use proto full names verbatim (e.g. `hello.Person`)
so cross-file imports and WKT references both resolve to a single
declared `---@class` block — no per-module renaming needed.

Pure comment addition: 300/300 luatest + 19/19 jit-trace gate stay
green. Generated examples regenerated and committed.

Eugene Blikh <bigbes@gmail.com> — 2026-05-15 15:20:45 UTC

Commit b75b87912eb710e71f73380e6b98c312f25a74d5view raw patch

Parent(s): d6570ec6

11 changed file(s)

FileStatus+
PLAN.md M +11 -1
cmd/protoc-gen-tarantool/internal/gen/emmylua.go A +209
cmd/protoc-gen-tarantool/internal/gen/gen.go M +15 -2
cmd/protoc-gen-tarantool/internal/gen/inline.go M +6 -1
examples/expected/full/conformance/conformance_pb.lua M +79
examples/expected/full/hello/hello_pb.lua M +104
examples/expected/full/protobuf_test_messages/proto3/test_messages_proto3_pb.lua M +214
examples/expected/runtime/conformance/conformance_pb.lua M +79
examples/expected/runtime/hello/hello_pb.lua M +104
examples/expected/runtime/protobuf_test_messages/proto3/test_messages_proto3_pb.lua M +214
runtime/pb/lazy.lua M +24