简体   繁体   English

带有 Thymeleaf 的 IntelliJ (2018.3) - static 内容的路径上没有自动完成?

[英]IntelliJ (2018.3) with Thymeleaf - NO auto completion on paths to static content?

Code completion for paths and filenames do NOT seem to work in IntelliJ with Thymeleaf: th:src="@{...}" attributes - eg files in the resources/static/ folder.路径文件名的代码完成在具有 Thymeleaf: th:src="@{...}"属性的 IntelliJ 中似乎不起作用 - 例如resources/static/文件夹中的文件。

I'm using the latest version of IntelliJ Ultimate Edition (2018.3.x as I am typing this) with the latest Spring Boot "2.1.3.RELEASE", along with the latest Thymeleaf packages.我正在使用最新版本的 IntelliJ Ultimate Edition(我输入时为 2018.3.x)和最新的 Spring Boot“2.1.3.RELEASE”,以及最新的 Thymeleaf 软件包。

I have only one controller class, and one HTML template.我只有一个controller class和一个HTML模板。 Simple stuff.简单的东西。 I can run the app fine and the content shows up.我可以正常运行该应用程序并显示内容。

However, auto completion for static resources is NOT working when typing in the template - for images, css etc. When using the standard HTML src= attribute eg src="../static/images/mylogo.png" code completion works fine.但是,在模板中键入时, static资源的自动完成不起作用 - 对于图像,css 等。当使用标准 HTML src=属性时,例如src="../static/images/mylogo.png"代码完成工作正常。 Paths to static content with Thymeleaf th:src="@{...}" tags have no auto completion at all.带有 Thymeleaf th:src="@{...}"标签的 static 内容的路径根本没有自动完成。

模板中的静态内容示例

Any suggestions or help would be VERY welcome.非常欢迎任何建议或帮助。 I've been using IntelliJ Ultimate for many years, and hopefully this is just a setting I am overlooking.多年来我一直在使用 IntelliJ Ultimate,希望这只是我忽略的一个设置。 Cannot find anything online pointing at this or a solution.在网上找不到任何指向此或解决方案的内容。 I recall (maybe mistakenly) that this worked a couple years back on a project.我记得(也许是错误的)这在几年前的一个项目中起作用。 Tried on 3 systems and the same behavior.尝试了 3 个系统和相同的行为。 Setting?环境? Config?配置? IntelliJ Bug? IntelliJ 错误?

  1. File -> Other Settings -> Config Plugins -> check thymeleaf.文件 -> 其他设置 -> 配置插件 -> 检查 thymeleaf。

  2. Add dependency in file: porm.xml在文件中添加依赖:porm.xml

  3. In HTML,don't forget to add xmlns:th="http://www.thymeleaf.org"在HTML中不要忘记加上xmlns:th="http://www.thymeleaf.org"

在此处输入图像描述

You can see more at here你可以在这里看到更多

https://www.thymeleaf.org/doc/tutorials/3.0/usingthymeleaf.html https://www.thymeleaf.org/doc/tutorials/3.0/usingthymeleaf.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM