fix: ensure Dockerfile analysis works in IntelliJ 2026.1 with bundled TextMate Docker grammar#249
Conversation
The parser was failing on common Dockerfile constructs: - Missing instructions: MAINTAINER, HEALTHCHECK, SHELL, STOPSIGNAL, ONBUILD - Line continuations with trailing whitespace after backslash - Comments inside multi-line instructions breaking continuation - ARG values containing paths (e.g., ARG HOME=/app) - Heredoc syntax (<<EOF...EOF) causing parse errors - Single-digit image tags (e.g., FROM rust:1) misidentified by lexer Add unknownLine catch-all rule so unrecognized content is silently skipped instead of causing parse errors. Reorder lexer rules so ANY_CHAR (single-char catch-all) doesn't shadow VERSION, IDENTIFIER, and IMAGE_NAME_TOKEN on same-length matches. Tested against 85+ real-world Dockerfiles across multiple frameworks. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… TextMate Docker grammar IntelliJ 2026.1 bundles a TextMate Docker grammar that claims Dockerfile files with TextMateFileType, which implements PlainTextLikeFileType. This marker interface causes IntelliJ's DaemonCodeAnalyzer to skip ExternalAnnotator execution, preventing vulnerability analysis. Add FileTypeOverrider to force Dockerfiles to use our rhda-dockerfile file type and parser, ensuring the annotator and inspection fire correctly. Also add isDockerfile() utility for filename-based detection supporting Dockerfile, Containerfile, and their variants. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Review Summary by QodoFix Dockerfile parser for real-world syntax and IntelliJ 2026.1 compatibility
WalkthroughsDescription• Improve Dockerfile parser to handle real-world syntax constructs - Add support for missing instructions: MAINTAINER, HEALTHCHECK, SHELL, STOPSIGNAL, ONBUILD - Fix line continuations with trailing whitespace after backslash - Handle comments inside multi-line instructions without breaking continuation - Support ARG values containing paths and heredoc syntax - Fix single-digit image tags misidentified by lexer • Ensure Dockerfile analysis works in IntelliJ 2026.1 with bundled TextMate Docker grammar - Add FileTypeOverrider to force Dockerfiles to use custom rhda-dockerfile file type - Add isDockerfile() utility for filename-based detection supporting Dockerfile, Containerfile variants • Add comprehensive parser tests covering 85+ real-world Dockerfile patterns Diagramflowchart LR
A["Dockerfile Lexer<br/>dockerfile.flex"] -->|Add LINE_CONTINUATION<br/>Reorder lexer rules| B["DockerfileLexer.java<br/>Generated"]
A -->|Add missing keywords| C["DockerfileTypes.java<br/>Token types"]
D["Dockerfile Grammar<br/>dockerfile.bnf"] -->|Add unknownLine rule<br/>Add new instructions| E["DockerfileParser.java<br/>Generated"]
D -->|Update argValue<br/>instructionArgs| F["Parser Rules"]
G["DockerfileFileType.java"] -->|Add isDockerfile utility| H["File Detection"]
I["DockerfileFileTypeOverrider.java<br/>New"] -->|Override TextMate<br/>file type| J["IntelliJ 2026.1<br/>Compatibility"]
K["DockerfileAnnotator.java"] -->|Use isDockerfile| L["Vulnerability Analysis"]
M["Test Resources<br/>9 Dockerfiles"] -->|Validate parser| N["DockerfileParserTest.java<br/>258 test cases"]
File Changes1. src/main/java/org/jboss/tools/intellij/image/build/dockerfile.flex
|
Code Review by Qodo
1. Annotator gated by filename
|
|


fixes: #248
Jira: https://redhat.atlassian.net/browse/TC-3906