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

Support for Quarkus Web Bundler #876

Open
angelozerr opened this issue Jun 1, 2023 · 7 comments
Open

Support for Quarkus Web Bundler #876

angelozerr opened this issue Jun 1, 2023 · 7 comments
Assignees
Labels
enhancement New feature or request qute

Comments

@angelozerr
Copy link
Contributor

Support for https://github.com/quarkiverse/quarkus-web-bundler

If you open https://github.com/ia3andy/renotes/blob/98b21e4b465d49171f22e11296f6a1bc6ff0e75b/src/main/resources/templates/Notes/notes.html#L13

You see the unexpected error "No section helper found for NoteSearch.qute(UndefinedSectionTag)":

image

It is because we don't scan the folder https://github.com/ia3andy/renotes/tree/main/src/main/resources/web/components which contains user tags (like NoteSearch).

According my understand

It seems that the web folder root can be custumized with application.properties https://github.com/quarkiverse/quarkus-web-bundler/blob/dccfa84afdea9479678dd9fa761a2ba9d4706598/deployment/src/main/java/io/quarkiverse/web/bundler/deployment/WebBundlerConfig.java#L25 We could start to hard coding this web root folder with web

//cc @ia3andy is it correct?

@angelozerr angelozerr added enhancement New feature or request qute labels Jun 1, 2023
@angelozerr angelozerr self-assigned this Jun 1, 2023
@ia3andy
Copy link

ia3andy commented Jun 1, 2023

Support for https://github.com/quarkiverse/quarkus-web-bundler

If you open https://github.com/ia3andy/renotes/blob/98b21e4b465d49171f22e11296f6a1bc6ff0e75b/src/main/resources/templates/Notes/notes.html#L13

You see the unexpected error "No section helper found for NoteSearch.qute(UndefinedSectionTag)":

image

It is because we don't scan the folder https://github.com/ia3andy/renotes/tree/main/src/main/resources/web/components which contains user tags (like NoteSearch).

According my understand

It seems that the web folder root can be custumized with application.properties https://github.com/quarkiverse/quarkus-web-bundler/blob/dccfa84afdea9479678dd9fa761a2ba9d4706598/deployment/src/main/java/io/quarkiverse/web/bundler/deployment/WebBundlerConfig.java#L25 We could start to hard coding this web root folder with web

//cc @ia3andy is it correct?

Stupid thought, why not look at any src/main/resoucres/**/*.html file with the same name as the tag?

@angelozerr
Copy link
Contributor Author

angelozerr commented Jun 1, 2023

Stupid thought, why not look at any src/main/resoucres/**/*.html file with the same name as the tag?

Because all html files cannot be an user tag. Today only HTML files coming friom src/main/resources/templates/tags are considered as user tags. We need to flag HTML file as user tag to provide proper completion, validation, etc for user tag

@ia3andy
Copy link

ia3andy commented Jun 1, 2023

Stupid thought, why not look at any src/main/resoucres/**/*.html file with the same name as the tag?

Because all html files cannot be an user tag. Today only HTML files coming friom src/main/resources/templates/tags are considered as user tags. We need to flag HTML file as user tag to provide proper completion, validation, etc for user tag

There is 99% chance that a file in src/main/resoucres/**/*.html with the same name as the Tag is actually the tag :), but you could obviously give priority to the src/main/resources/templates/tags.

You could probably use a list of directories we know for sure contains tags to fill the flag Map, then have a "best guess" flag Map with the other src/main/resoucres/**/*.html`.

@angelozerr
Copy link
Contributor Author

angelozerr commented Jun 1, 2023

There is 99% chance that a file in src/main/resoucres/**/*.html with the same name as the Tag is actually the tag :), but you could obviously give priority to the src/main/resources/templates/tags.

Today we consider that user tags comes from src/main/resources/templates/tags (it follows the behavior of Quarkus support for Qute).

You could probably use a list of directories we know for sure contains tags to fill the flag Map, then have a "best guess" flag Map with the other src/main/resoucres/**/*.html`.

We need to know if HTML file is an user tag or not because:

  • when you open completion for {#| it should show core user tags like #for, #fragment etc and show only HTML files coming from src/main/resources/templates/tags. For instance if you create an HTML file src/main/resoucres/templates/main.html, you should not show incompletion #main. If you write {#main} it should report an error Undefined User Tags.
  • User tags HTML file validation have different behavior thanother HTML files. For instance if you write {name} in your user tag HTML file, it should not report an error that name is undefined, because the use of user tag is like {#MyUserTag name=""}
  • User tags HTML completion provide custom it and nested-content properties.

We need to follow the behavior of component like Quarkus Qute integration or Quarkus Web Bundler which register user tag with addSectionHelper

@ia3andy
Copy link

ia3andy commented Jun 1, 2023

Ok that makes sense, then having a static list of path to look for is alright :)

@angelozerr
Copy link
Contributor Author

Ok that makes sense, then having a static list of path to look for is alright :)

Today src/main/resources/templates is hard coded, but in this issue I would like to provide an extension point to contribute to Qute HTML paths. In the future if it will have new component (like Quarkus Web Bundler), it will be easy to contribute to manage new paths scanning.

I think too we should provide an user settings to add custom paths to scan.

@angelozerr
Copy link
Contributor Author

We need to add web/templates folder to scan if Quarkus web bundler is on classpath, see @ia3andy comments at quarkusio/quarkus#37005 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request qute
Projects
None yet
Development

No branches or pull requests

2 participants