pulumi/proto/pulumi
Pat Gavlin 948bb36e7e [engine] Add support for source positions
These changes add support for passing source position information in
gRPC metadata and recording the source position that corresponds to a
resource registration in the statefile.

Enabling source position information in the resource model can provide
substantial benefits, including but not limited to:

- Better errors from the Pulumi CLI
- Go-to-defintion for resources in state
- Editor integration for errors, etc. from `pulumi preview`

Source positions are (file, line) or (file, line, column) tuples
represented as URIs. The line and column are stored in the fragment
portion of the URI as "line(,column)?". The scheme of the URI and the
form of its path component depends on the context in which it is
generated or used:

- During an active update, the URI's scheme is `file` and paths are
  absolute filesystem paths. This allows consumers to easily access
  arbitrary files that are available on the host.
- In a statefile, the URI's scheme is `project` and paths are relative
  to the project root. This allows consumers to resolve source positions
  relative to the project file in different contexts irrespective of the
  location of the project itself (e.g. given a project-relative path and
  the URL of the project's root on GitHub, one can build a GitHub URL for
  the source position).

During an update, source position information may be attached to gRPC
calls as "source-position" metadata. This allows arbitrary calls to be
associated with source positions without changes to their protobuf
payloads. Modifying the protobuf payloads is also a viable approach, but
is somewhat more invasive than attaching metadata, and requires changes
to every call signature.

Source positions should reflect the position in user code that initiated
a resource model operation (e.g. the source position passed with
`RegisterResource` for `pet` in the example above should be the source
position in `index.ts`, _not_ the source position in the Pulumi SDK). In
general, the Pulumi SDK should be able to infer the source position of
the resource registration, as the relationship between a resource
registration and its corresponding user code should be static per SDK.

Source positions in state files will be stored as a new `registeredAt`
property on each resource. This property is optional.
2023-07-10 14:35:40 -07:00
..
codegen Allow mapping requests to install plugins 2023-05-29 14:53:04 +01:00
alias.proto feat(engine): Adds structured alias support to the engine 2022-10-11 17:56:32 -04:00
analyzer.proto feat(engine): Adds structured alias support to the engine 2022-10-11 17:56:32 -04:00
converter.proto Allow converter plugins to return diagnostics 2023-06-05 17:38:59 +01:00
engine.proto Fix the go_package option on the .proto files 2022-09-20 09:31:03 +01:00
errors.proto Fix the go_package option on the .proto files 2022-09-20 09:31:03 +01:00
language.proto Make convert more lenient 2023-06-08 11:14:31 +01:00
plugin.proto Fix the go_package option on the .proto files 2022-09-20 09:31:03 +01:00
provider.proto [engine] Add support for source positions 2023-07-10 14:35:40 -07:00
resource.proto [engine] Add support for source positions 2023-07-10 14:35:40 -07:00
source.proto [engine] Add support for source positions 2023-07-10 14:35:40 -07:00