admin管理员组文章数量:1355694
I am trying to use Spotless formatter to format XML that have SQL in it. Like this
<?xml version="1.0" encoding="UTF-8" ?>
<databaseChangeLog
xmlns:xsi=";
xmlns=";
xsi:schemaLocation="
.9.xsd">
<changeSet id="0195ed19-d3c2-7eb4-9322-55ace4932598">
<sql splitStatements="true">
<![CDATA[
CREATE TABLE IF NOT EXISTS students
(
id character varying(18) NOT NULL,
name character varying(32) NOT NULL
)
]]>
</sql>
<rollback>
<sql splitStatements="true">
<![CDATA[
DROP TABLE IF EXISTS students
]]>
</sql>
</rollback>
</changeSet>
</databaseChangeLog>
I am using following configuration
format("xml") {
target("tt.xml")
toggleOffOn()
prettier().config(mapOf("parser" to "html", "tabWidth" to 4))
withinBlocks("SQL Statements", "<![CDATA[", "]]>") {
prettier(mapOf("prettier" to "3.5.3", "prettier-plugin-sql" to "0.18.0")).config(
mapOf(
"parser" to "sql",
"language" to "sql",
"tabWidth" to 4,
),
)
}
}
But I am getting this error
There were 1 lint error(s), they must be fixed or suppressed.
tt.xml:LINE_UNDEFINED toggle(com.diffplug.spotless.npm.SimpleRestClient$SimpleRestResponseException) Unexpected response status code at /prettier/format [HTTP 500] -- (Error while formatting: ConfigError: Couldn't resolve parser "sql".) (...)
Resolve these lints or suppress with `suppressLintsFor`
Is there anyway to fix this error?
I am trying to use Spotless formatter to format XML that have SQL in it. Like this
<?xml version="1.0" encoding="UTF-8" ?>
<databaseChangeLog
xmlns:xsi="http://www.w3./2001/XMLSchema-instance"
xmlns="http://www.liquibase./xml/ns/dbchangelog"
xsi:schemaLocation="http://www.liquibase./xml/ns/dbchangelog
https://www.liquibase./xml/ns/dbchangelog/dbchangelog-4.9.xsd">
<changeSet id="0195ed19-d3c2-7eb4-9322-55ace4932598">
<sql splitStatements="true">
<![CDATA[
CREATE TABLE IF NOT EXISTS students
(
id character varying(18) NOT NULL,
name character varying(32) NOT NULL
)
]]>
</sql>
<rollback>
<sql splitStatements="true">
<![CDATA[
DROP TABLE IF EXISTS students
]]>
</sql>
</rollback>
</changeSet>
</databaseChangeLog>
I am using following configuration
format("xml") {
target("tt.xml")
toggleOffOn()
prettier().config(mapOf("parser" to "html", "tabWidth" to 4))
withinBlocks("SQL Statements", "<![CDATA[", "]]>") {
prettier(mapOf("prettier" to "3.5.3", "prettier-plugin-sql" to "0.18.0")).config(
mapOf(
"parser" to "sql",
"language" to "sql",
"tabWidth" to 4,
),
)
}
}
But I am getting this error
There were 1 lint error(s), they must be fixed or suppressed.
tt.xml:LINE_UNDEFINED toggle(com.diffplug.spotless.npm.SimpleRestClient$SimpleRestResponseException) Unexpected response status code at /prettier/format [HTTP 500] -- (Error while formatting: ConfigError: Couldn't resolve parser "sql".) (...)
Resolve these lints or suppress with `suppressLintsFor`
Is there anyway to fix this error?
Share Improve this question asked Mar 31 at 17:00 nicholasnetnicholasnet 2,2874 gold badges25 silver badges54 bronze badges1 Answer
Reset to default 0in the configurations try to load both prettier and SQL plugging's globally.
prettier(mapOf("prettier" to "3.5.3", "prettier-plugin-sql" to "0.18.0")).config(mapOf("parser" to "html", "tabWidth" to 4))
本文标签: javaSQL formatting inside an XML not working in Spotless using PrettierStack Overflow
版权声明:本文标题:java - SQL formatting inside an XML not working in Spotless using Prettier - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743932568a2564112.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论