Skip to content

Add initial implementation of framework mode#2535

Merged
koesie10 merged 10 commits intomainfrom
koesie10/framework-mode
Jun 23, 2023
Merged

Add initial implementation of framework mode#2535
koesie10 merged 10 commits intomainfrom
koesie10/framework-mode

Conversation

@koesie10
Copy link
Copy Markdown
Member

This adds an initial rough implementation of framework mode for the data extensions editor. Framework mode will do the following:

  • Load public methods instead of external API calls
  • Group by package instead of library
  • Remove the usages in the table because we do not have access to usages
  • Change "Download and generate" to "Generate"

Short demo:

Screen.Recording.2023-06-21.at.16.53.06.mov

Checklist

  • CHANGELOG.md has been updated to incorporate all user visible changes made by this pull request.
  • Issues have been created for any UI or other user-facing changes made by this pull request.
  • [Maintainers only] If this pull request makes user-facing changes that require documentation changes, open a corresponding docs pull request in the github/codeql repo and add the ready-for-doc-review label there.

@koesie10 koesie10 force-pushed the koesie10/framework-mode branch from 2ccee67 to 4a94685 Compare June 22, 2023 07:11
@koesie10 koesie10 marked this pull request as ready for review June 22, 2023 08:38
@koesie10 koesie10 requested review from a team as code owners June 22, 2023 08:38
@koesie10 koesie10 requested a review from starcke June 22, 2023 08:38
@koesie10 koesie10 force-pushed the koesie10/framework-mode branch from 4a94685 to 8c36e57 Compare June 23, 2023 08:04
Copy link
Copy Markdown
Contributor

@starcke starcke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love that we already have a rough version of framework mode! I do think that it is a bit more rough than the normal mode, (kinda like the poc we did). I think this can go in now and then next week we can discuss what next steps should be for this mode.


// In application mode, we need the database of a specific library to generate
// the modeled methods. In framework mode, we'll use the current database.
if (this.mode === Mode.Application) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are quite a lot of mode checks. It is probably ok, but if we start to get even more we might want to consider some kind of mode abstraction, so that we dont have to do an if in all the logic.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely. I think for now with just two modes this works fine, but this will break down if we have more modes.

return result;
}

export function createDataExtensionYamlsForFrameworkMode(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something to think about, is that eventually it would be amazing if modelling library X while in application mode for A, would yield the same file as modelling library X in framework mode.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think this is something to think about. For now, I don't think we can really detect this reliably because we're depending on two different inputs (database vs JAR name).

{externalApiUsage.usages.length}
</UsagesButton>
</VSCodeDataGridCell>
{mode === Mode.Application && (
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... these mode comparisons do go in many places.

c.(Constructor).isParameterless()
}

class PublicMethod extends Callable {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For my understanding: this is basically a copy of ExternalAPI with the constructor changed? I cannot completely parse whether that is exactly what we want, but I think at a minimum it is close.

I think moving to the CodeML queries is something we should do, otherwise we probably want to make some changes (e.g. sharing the code for all those methods).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this basically changes not this.fromSource() to this.isPublic() in the constructor. The rest of the methods are very similar. We can work on reducing the duplication in a follow-up.

usage = aUsage(api)
select usage, apiName, supported.toString(), "supported", api.getFile().getBaseName(), "library"
`,
frameworkModeQuery: `/**
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comments as the java method below.

@koesie10 koesie10 enabled auto-merge June 23, 2023 10:10
@koesie10 koesie10 merged commit a76bd46 into main Jun 23, 2023
@koesie10 koesie10 deleted the koesie10/framework-mode branch June 23, 2023 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants