дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-06 01:57:13 +02:00
feat(thymeleaf): warn on fragment expressions naming a missing template or fragment (#6598)
Templates under src/main/resources/templates get a warning (underline and Problems) on a fragment expression whose template does not exist or does not define the fragment, as the inspection Thymeleaf > Unresolved template and fragment references. A fragment counts as defined by th:fragment, th:ref, an element of that name, or an id. It stays silent where names cannot be resolved as Spring Boot's defaults do: spring.thymeleaf.prefix or suffix set in application.properties / .yml, missing templates outside the project folder's own templates directory, ~{_}, ?: fallbacks, expression names, relative names and comments. Template names get .html unless they end in an extension Thymeleaf recognizes, which also fixes Go to Declaration on names with a dot.
Part of #2889
Co-authored-by: audichuang <[email protected]>
Цей коміт міститься в:
1 джерело
929b6837f9
коміт
91ff5c8a15
9 files changed
+248
-14
No files matched your search
@@ -51,6 +51,7 @@ describe("inspection profiles", () => {
|
||||
|
||||
it("maps built-in producers to their inspections", () => {
|
||||
expect(producerInspectionId("file-references")).toBe("builtin:file-references");
|
||||
expect(producerInspectionId("thymeleaf-references")).toBe("builtin:thymeleaf-references");
|
||||
expect(producerInspectionId("ruff")).toBe("lsp:ruff");
|
||||
});
|
||||
|
||||
|
||||
@@ -312,6 +312,15 @@ export const BUILTIN_INSPECTIONS: readonly BuiltinInspection[] = [
|
||||
description:
|
||||
"Reports paths in HTML attributes, CSS url() and @import that do not name an existing file, resolved relative to the file, the project root and its resource roots.",
|
||||
},
|
||||
{
|
||||
id: "builtin:thymeleaf-references",
|
||||
producer: "thymeleaf-references",
|
||||
name: "Unresolved template and fragment references",
|
||||
group: "Thymeleaf",
|
||||
description:
|
||||
"Reports Thymeleaf fragment expressions under src/main/resources/templates that name a missing template, or a fragment the template does not define. Off when application.properties or .yml sets spring.thymeleaf.prefix or suffix.",
|
||||
defaultLevel: "warning",
|
||||
},
|
||||
{
|
||||
id: "builtin:build",
|
||||
producer: "build",
|
||||
|
||||
@@ -669,6 +669,10 @@
|
||||
"Dark gray": "Dark gray",
|
||||
"Magenta": "Magenta",
|
||||
"Editor inline blame": "Editor inline blame",
|
||||
"Cannot resolve template '{template}'": "Cannot resolve template '{template}'",
|
||||
"Cannot resolve fragment '{fragment}'": "Cannot resolve fragment '{fragment}'",
|
||||
"Unresolved template and fragment references": "Unresolved template and fragment references",
|
||||
"Reports Thymeleaf fragment expressions under src/main/resources/templates that name a missing template, or a fragment the template does not define. Off when application.properties or .yml sets spring.thymeleaf.prefix or suffix.": "Reports Thymeleaf fragment expressions under src/main/resources/templates that name a missing template, or a fragment the template does not define. Off when application.properties or .yml sets spring.thymeleaf.prefix or suffix.",
|
||||
"Annotations": "Annotations",
|
||||
"Last commit": "Last commit",
|
||||
"Annotations › Last commit": "Annotations › Last commit",
|
||||
|
||||
@@ -5574,6 +5574,10 @@
|
||||
"No editor for “{kind}”": "没有适用于“{kind}”的编辑器",
|
||||
"Show usages of {name}": "显示 {name} 的用法",
|
||||
"Cannot resolve file '{value}'": "无法解析文件 '{value}'",
|
||||
"Cannot resolve template '{template}'": "无法解析模板 '{template}'",
|
||||
"Cannot resolve fragment '{fragment}'": "无法解析片段 '{fragment}'",
|
||||
"Unresolved template and fragment references": "未解析的模板和片段引用",
|
||||
"Reports Thymeleaf fragment expressions under src/main/resources/templates that name a missing template, or a fragment the template does not define. Off when application.properties or .yml sets spring.thymeleaf.prefix or suffix.": "报告 src/main/resources/templates 下 Thymeleaf 片段表达式中不存在的模板,或模板中未定义的片段。application.properties 或 .yml 设置了 spring.thymeleaf.prefix 或 suffix 时不检查。",
|
||||
"Reformat File: {name}": "重新格式化文件:{name}",
|
||||
"Inspection '{name}' options": "检查 '{name}' 的选项",
|
||||
"Choose Declaration of '{label}' ({count} found)": "选择 '{label}' 的声明(找到 {count} 个)",
|
||||
|
||||
Reference in new issue
Заблокувати користувача