Switch from flatKeywordList()
to flat arrays
#676
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Part of preparations for PR #673
Copied from my original comment:
I see there is no distinction in the keyword tokens between
all
anddataType
/datatype
/dataTypes
:sql-formatter/src/languages/postgresql/postgresql.keywords.ts
Lines 4 to 8 in 290f3b7
sql-formatter/src/languages/transactsql/transactsql.functions.ts
Lines 78 to 83 in 290f3b7
sql-formatter/src/languages/snowflake/snowflake.keywords.ts
Lines 102 to 106 in 290f3b7
sql-formatter/src/languages/transactsql/transactsql.functions.ts
Lines 303 to 309 in 290f3b7
This is because of the
flatKeywordList()
function, which effectively discards the key information:sql-formatter/src/utils.ts
Lines 18 to 20 in 290f3b7
Because of this, I would like to simplify the
src/languages/*/*.keywords.ts
files to export 1 flat array (with empty lines + comments as separators instead of object keys) and delete theflatKeywordList()
function - this will prevent unusual, inconsistent naming conventions and also clarify that the object keys do nothing.Reviewer notes
master
anddevelop
, so that PRs from community members can be tested on GitHub Actionsa. if there was a commented URL above the key, I removed the key and left the URL as the sole comment (eg. in
src/languages/db2i/db2i.functions.ts
)b. if there was no other comment (or if the commented URL was generic, for multiple sections), I left the key name as the comment (eg. in
src/languages/hive/hive.functions.ts
)