Skip to content

Commit aa63c7a

Browse files
committed
add flink sql formatter
1 parent 1650d16 commit aa63c7a

3 files changed

Lines changed: 43 additions & 235 deletions

File tree

package-lock.json

Lines changed: 10 additions & 217 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,39 @@
2323
},
2424
"homepage": "https://github.com/camilesing/flink-sql-vscode/master/README.md",
2525
"categories": [
26-
"Programming Languages", "Formatters"
26+
"Programming Languages",
27+
"Formatters"
2728
],
2829
"keywords": [
29-
"Flink SQL", "Flink", "Formatter"
30+
"Flink SQL",
31+
"Flink",
32+
"Formatter"
3033
],
3134
"preview": false,
3235
"contributes": {
33-
"languages": [{
34-
"id": "flink-sql",
35-
"aliases": ["FlinkSQL", "flink-sql", "Flink SQL","fql"],
36-
"extensions": [".sql", ".fql"],
37-
"configuration": "./language-configuration.json"
38-
}],
39-
"grammars": [{
40-
"language": "flink-sql",
41-
"scopeName": "source.flink",
42-
"path": "./syntaxes/flink.tmLanguage.json"
43-
}],
36+
"languages": [
37+
{
38+
"id": "flink-sql",
39+
"aliases": [
40+
"FlinkSQL",
41+
"flink-sql",
42+
"Flink SQL",
43+
"fql"
44+
],
45+
"extensions": [
46+
".sql",
47+
".fql"
48+
],
49+
"configuration": "./language-configuration.json"
50+
}
51+
],
52+
"grammars": [
53+
{
54+
"language": "flink-sql",
55+
"scopeName": "source.flink",
56+
"path": "./syntaxes/flink.tmLanguage.json"
57+
}
58+
],
4459
"snippets": [
4560
{
4661
"language": "flink-sql",
@@ -49,11 +64,11 @@
4964
]
5065
},
5166
"activationEvents": [
52-
"onLanguage:sql",
67+
"onLanguage:fql",
5368
"onLanguage:flink-sql"
54-
],
69+
],
5570
"main": "./src/extension.js",
5671
"dependencies": {
57-
"sql-formatter-plus": "^1.3.6"
72+
"sql-formatter-plus": "git+ssh://git@github.com:AChangFeng/sql-formatter-plus.git#v0.0.1"
5873
}
5974
}

src/extension.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const sqlFormatter = require('sql-formatter-plus');
55

66
const config = {
77
indent: ' '.repeat(2),
8-
language: 'sql',
8+
language: 'fql',
99
uppercase: true,
1010
linesBetweenQueries: 2
1111
}
@@ -20,7 +20,7 @@ module.exports.activate = () => {
2020
vscode.TextEdit.replace(range, format(document.getText(range)))
2121
]
2222
});
23-
vscode.languages.registerDocumentRangeFormattingEditProvider('sql', {
23+
vscode.languages.registerDocumentRangeFormattingEditProvider('fql', {
2424
provideDocumentRangeFormattingEdits: (document, range, options) => [
2525
vscode.TextEdit.replace(range, format(document.getText(range)))
2626
]

0 commit comments

Comments
 (0)