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

Formatting Constructor Parameters after insertion #1539

Open
HaychBe opened this issue Jun 5, 2024 · 0 comments
Open

Formatting Constructor Parameters after insertion #1539

HaychBe opened this issue Jun 5, 2024 · 0 comments

Comments

@HaychBe
Copy link

HaychBe commented Jun 5, 2024

Hi, wasn't sure where to put this. Isn't a request and isn't a bug but I was just wondering whether it is possible to add each new parameter to a new line. I've tried everything I can think of and googled. But nothing works, maybe I'm doing it wrong. I'm not sure.

This is the logic I have

    const paramsToAdd = [
    { name: 'route', type: 'ActivatedRoute', scope: Scope.Protected },
    { name: 'location', type: 'Location', scope: Scope.Protected },
    { name: 'routeService', type: 'RouteStateService', scope: Scope.Protected },
  ];

One thing I've tried

  let insertionIndex = 0;
  paramsToAdd.forEach(param => {
    if (!constructor.getParameter(param.name)) {
      constructor.insertParameter(insertionIndex, {
        name: param.name,
        type: param.type,
      });
      insertionIndex++;
    }
  });

Another I've tried

 paramsToAdd.forEach(param => {
    if (!constructor.getParameter(param.name)) {
      constructor.addParameter(param);
    }
  });

Just can't seem to get it working

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