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

Autocomplete for file paths #146

Merged
merged 10 commits into from
Dec 19, 2022
Merged

Conversation

anthmatic
Copy link
Contributor

@anthmatic anthmatic commented Dec 2, 2022

Autocomplete for file paths!
image

This will apply to these HubL tags/params:

  • include
  • import
  • <tag> path=""
  • extend

Currently supports file paths and does not autocomplete built-in module names. After choosing a file path, if there is no closing quote, it will automatically be added.

@anthmatic anthmatic requested a review from miketalley December 7, 2022 21:25
@anthmatic anthmatic marked this pull request as ready for review December 7, 2022 22:00
@anthmatic anthmatic changed the title [WIP] Autocomplete for file paths Autocomplete for file paths Dec 7, 2022
@TanyaScales TanyaScales mentioned this pull request Dec 18, 2022
@anthmatic anthmatic merged commit 61947a5 into mike-testing Dec 19, 2022
@anthmatic anthmatic deleted the ap/better-file-autocomplete branch December 19, 2022 16:31
@anthmatic anthmatic restored the ap/better-file-autocomplete branch December 19, 2022 19:21
@lolcabanon
Copy link

lolcabanon commented Sep 30, 2023

Hey @anthmatic !

I don't really know where else to submit my idea, so i'll do it here, since it is a little bit on the same vibe. Feel free to point me in the right direction if there is a better place to discuss that!

I am currently building a CMS Theme starting from the wonderful cms-theme-boilerplate and the experience is mostly awesome! Congrats to HubSpot team for this btw!

Here is an idea I got and would love to see implemented :

Common paths shorthand/alias a bit like the @hubspot/module-name functionality and inspired by the SvelteKit $lib alias (see doc for details).

The possibility to use custom aliases like @theme/module-name or @modules/module-name in templates would be amazing instead of the current ../../modules/module-name. At least predefined aliases for common paths like "modules" or "sections" would be good enough and probably easier to manage on your end (if the project structure follows a standard pattern, of course).

I also understand that paths like @hubspot/module-name seems to be absolute paths to HubSpot built-in modules, so it might not be just "add another alias" but rather adding a completely new alias feature.

Anyway, just wanted to start the discussion and see where it would go! 😄

Edit :

I also cannot get path autocompletion for module blocks path in my template to work in parent directories... If I type {% module "button" path=" I will get my current folder files as suggestions, but as soon as I type ../ to go towards my modules folder, the autocompletion stops to work.

I get a lint warning "unable to find module ../../modules/button" but the module is showing as expected in my demo page using the template.

(My starting point is a header partial, thus going up from partials -> templates -> src and then down into modules -> button.module.)

@jsines
Copy link
Contributor

jsines commented Oct 2, 2023

Hi @lolcabanon ! 👋

We always love hearing feedback on these tools so your contribution is well appreciated.

I've filed two separate issues based on your comment to get them on our dev team's radar. Feel free if you'd like to add additional info to those tickets, otherwise you can just watch them for any updates.

#252
#253

Thanks for the suggestion & bug report!

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