4 ms·
Fun fact: IJ has "embedded language" support, meaning it understands that some parts of yaml (and any other source code) are another source code and thus offers
by mdaniel 3y ago
Fun fact: IJ has "embedded language" support, meaning it understands that some parts of yaml (and any other source code) are another source code and thus offers both syntax highlighting and its usual bunch of introspections. That may not be as meaningful for test SQL, since it probably doesn't have a ton of existing schema against which it should check, but it undoubtedly is helpful when IJ is told this is the PostgreSQL dialect of SQL and thus is able to offer relevant completion and quick-doc for the functions
One can tell IJ what's going on in one of two ways: comment markup or creating a JSON Schema for the yaml and placing x-intellij-language-injection metadata into the relevant elements
tests:
- #language=SQL
query: select 1 as result
results:
- result: 1
or
$id: pg_yregress
$schema: "http://json-schema.org/draft-07/schema#"
properties:
tests:
type: array
items:
$ref: '#/definitions/Test'
definitions:
Test:
type: object
properties:
query:
description: the test query to run
type: string
# https://github.com/JetBrains/intellij-community/blob/idea/233.9802.14/json/src/jsonSchema/schema.json#L52
x-intellij-language-injection: SQL
results:
type: array
item:
type: object
additionalProperties: true
- yrashk 3y agoThis is incredibly useful and it'd be great to add this helper to pg_yregress to improve the experience for IntelliJ users!