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

🎉 Add vscode extension to find ETL step files more easily #3365

Merged
merged 17 commits into from
Oct 4, 2024

Conversation

pabloarosado
Copy link
Contributor

The idea was to create a VSCode extension that makes browsing in ETL easier.

The goal is to have a shortcut to open a search bar (similar to cmd+p), type a file name, and files should appear sorted in descending order of date (given in the paths). Even more ideal would be to show first garden, then meadow, then grapher, then the rest.

I created two versions of *.vsix files. The first version sorts better (although it doesn't seem to be perfectly right). The second version has a better response (it shows relative paths without showing file names twice), however it clearly doesn't sort well. I tried to combine both solutions, but didn't manage to make it work.

To install a version:

  • cmd+shift+p -> Extensions: Install from VSIX. Choose find-latest-etl-step-0.0.1.vsix.
  • Restart VSCode. For some reason, you may need to open a random file before the extension works.
  • Type ctrl+shift+L, and type a file name.

Ideally, you should first see the latest version of a step (usually a garden step). It would be nice to be able to type "meadow step_name" to find the latest meadow file for that step, but I didn't manage to achieve that.

@pabloarosado pabloarosado marked this pull request as ready for review October 3, 2024 11:31
@owidbot
Copy link
Contributor

owidbot commented Oct 3, 2024

Quick links (staging server):

Site Admin Wizard

Login: ssh owid@staging-site-add-vscode-extension-to-find-files

chart-diff: ✅ No charts for review.
data-diff: ✅ No differences found
Legend: +New  ~Modified  -Removed  =Identical  Details
Hint: Run this locally with etl diff REMOTE data/ --include yourdataset --verbose --snippet

Automatically updated datasets matching weekly_wildfires|excess_mortality|covid|fluid|flunet|country_profile|garden/ihme_gbd/2019/gbd_risk are not included

Edited: 2024-10-04 09:26:49 UTC
Execution time: 12.25 seconds

@lucasrodes
Copy link
Member

lucasrodes commented Oct 3, 2024

Haven't tested, but I just read the name of this issue and fell in love ー thanks Pablo, great idea!

If we find it useful, we should definitely add it to our VSCode setup section

@Marigold
Copy link
Collaborator

Marigold commented Oct 3, 2024

Nice! I spent some time (actually, too much time...) trying to get searches like "meadow cherry" to work, but apparently, QuickPick doesn’t support fuzzy matching, and I couldn’t find a way to hack it. I think it should be possible to sort the results not just by date, but also by channel.

(It took me a while to figure out how to run the extension in development mode. If anyone wants to develop this further and hear about my experience, feel free to reach out.)

@pabloarosado
Copy link
Contributor Author

pabloarosado commented Oct 4, 2024

Thanks both! I also spent some time just setting things up.
Creating the extension was quite easy, I think all you need is:

npm install -g yo generator-code 
yo code

This will create all the boilerplate code.

Then, to develop and debug, I think I've figured out the easiest way to set it all up:

  • Go to the root folder of the extension, find-latest-etl-step.
  • Run: npm run install
  • Open a VSCode on that folder. On the terminal, run npm run watch (and keep this open).
  • Then go to the debug pane, and hit the play button to Run Extension. This will open a new VSCode window.
  • On the new window, hit cmd+shift+p and select Find Latest ETL Step to test the extension.
  • You can now make changes in the code, then go to the new window, and hit cmd+r to refresh. Then rerun cmd+shift+p and select Find latest ETL step.
    • Actually, it seems that the shortcut ctrl+shift+l works well on the debugging window.

Once you are happy with the result, bump up the version in package.json (although for now version 0.0.2 was not properly working, so I'll try to get that to work), go to the terminal, ensure the extension compiles, and package it.

npm run compile
vsce package

This creates a new .vsix file for the new version.

@Marigold is that more or less what you found?

@Marigold
Copy link
Collaborator

Marigold commented Oct 4, 2024

Yeah, that's what I learned the hard way :). Could you add your instructions README?

Copy link
Collaborator

@Marigold Marigold left a comment

Choose a reason for hiding this comment

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

Very nice for the first prototype! I'm good with merging it, giving it a try and improving on the fly.

@pabloarosado
Copy link
Contributor Author

OK, I'll start using it in the coming days, and, if it turns out to work well, I'll add the instructions to the ETL documentation and announce it to the rest of the team.

@pabloarosado pabloarosado merged commit d426619 into master Oct 4, 2024
6 of 7 checks passed
@pabloarosado pabloarosado deleted the add-vscode-extension-to-find-files branch October 4, 2024 10:29
paarriagadap pushed a commit that referenced this pull request Oct 6, 2024
* Add prototype of VSCode extension to better search for ETL step files

* Update gitignore to ignore node_modules

* Move to a non-hidden folder

* Remove dist folder

* Ignore dist folder

* Revert to original version and allow for easy debugging

* Ignore etl/data explicitly

* Show relative path

* Show only latest version

* Allow for latest steps

* Fix bug and hide unnecessary part of the path in display

* Show only path, without date

* Ignore backports and archive files

* Fix bug

* Package new version

* Add documentation
Marigold pushed a commit that referenced this pull request Oct 7, 2024
* Add prototype of VSCode extension to better search for ETL step files

* Update gitignore to ignore node_modules

* Move to a non-hidden folder

* Remove dist folder

* Ignore dist folder

* Revert to original version and allow for easy debugging

* Ignore etl/data explicitly

* Show relative path

* Show only latest version

* Allow for latest steps

* Fix bug and hide unnecessary part of the path in display

* Show only path, without date

* Ignore backports and archive files

* Fix bug

* Package new version

* Add documentation
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.

4 participants