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

Only run init() on commands that need it #89

Merged

Conversation

asnewman
Copy link
Contributor

@asnewman asnewman commented Nov 16, 2023

Overview

This PR makes a change to take into account what command is being run before deciding to run init() or not.

Also includes two minor improvements:

  • Explicitly use structured format when querying for components
  • Ignore white space only lines of code and components when generating suggestions

Context

The Ditto VSCode extension runs commands such as generate-suggestions, component-folders, and replace. These commands don't rely on local data (it calls the Ditto API) and thus doesn't require a config.yml to be present. Because of this, it is unnecessary to run init() when these commands are called.

Test Plan

Testing successfully completed in via:

  • Delete ditto directory
  • Run yarn start generate-suggestions, verify that the ditto directory isn't created
  • Run yarn start pull, verify that the ditto directory is created
  • Update testfiles/test1.jsx to include text for a component in your workspace. Verify yarn start generate-suggestions results in a suggestion for that text

lib/ditto.ts Outdated
"project",
"project add",
"project remove",
];
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: could move these commands to top of file as a constant

@asnewman asnewman merged commit ed421a2 into master Nov 28, 2023
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

Successfully merging this pull request may close these issues.

None yet

2 participants