Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set indentation to zero when including file fragments #69

Open
octonato opened this issue Oct 20, 2020 · 0 comments
Open

Set indentation to zero when including file fragments #69

octonato opened this issue Oct 20, 2020 · 0 comments

Comments

@octonato
Copy link
Member

octonato commented Oct 20, 2020

As discussed here:
https://github.com/akka/akka-platform-guide/pull/322#discussion_r508310150

Ideally we could solve that using styling.

It can be a challenge when including different fragments by toggling the same tag.

For instance, this:

// tag::SendOrderProjection[]
import shopping.order.proto.ShoppingOrderService;
import shopping.order.proto.ShoppingOrderServiceClient;
import akka.grpc.GrpcClientSettings;
// end::SendOrderProjection[]

public class Main extends AbstractBehavior<Void> {

    public Main(ActorContext<Void> context) {
        // tag::SendOrderProjection[]
        ShoppingOrderService orderService = orderServiceClient(system);
        SendOrderProjection.init(system, orderService);
        // end::SendOrderProjection[]
    }

    // can be overridden in tests
    // tag::SendOrderProjection[]
    protected ShoppingOrderService orderServiceClient(ActorSystem<?> system) {
        GrpcClientSettings orderServiceClientSettings =
                GrpcClientSettings
                        .connectToServiceAt(
                                system.settings().config().getString("shopping-order-service.host"),
                                system.settings().config().getInt("shopping-order-service.port"),
                                system)
                .withTls(false);

        return ShoppingOrderServiceClient.create(orderServiceClientSettings, system);
    }
    // end::SendOrderProjection[]
}

will show as:

import shopping.order.proto.ShoppingOrderService;
import shopping.order.proto.ShoppingOrderServiceClient;
import akka.grpc.GrpcClientSettings;
        ShoppingOrderService orderService = orderServiceClient(system);
        SendOrderProjection.init(system, orderService);
    protected ShoppingOrderService orderServiceClient(ActorSystem<?> system) {
        GrpcClientSettings orderServiceClientSettings =
                GrpcClientSettings
                        .connectToServiceAt(
                                system.settings().config().getString("shopping-order-service.host"),
                                system.settings().config().getInt("shopping-order-service.port"),
                                system)
                .withTls(false);

        return ShoppingOrderServiceClient.create(orderServiceClientSettings, system);
    }

while we probably want it to be:

import shopping.order.proto.ShoppingOrderService;
import shopping.order.proto.ShoppingOrderServiceClient;
import akka.grpc.GrpcClientSettings;

ShoppingOrderService orderService = orderServiceClient(system);
SendOrderProjection.init(system, orderService);

protected ShoppingOrderService orderServiceClient(ActorSystem<?> system) {
    GrpcClientSettings orderServiceClientSettings =
        GrpcClientSettings
            .connectToServiceAt(
                system.settings().config().getString("shopping-order-service.host"),
                system.settings().config().getInt("shopping-order-service.port"),
                system)
            .withTls(false);

	return ShoppingOrderServiceClient.create(orderServiceClientSettings, system);
}

Most probably we can't solve this with styling though.

We will need to have different tags: tag::SendOrderProjection-part1[], tag::SendOrderProjection-part2[], tag::SendOrderProjection-part3[], etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant