Skip to content

Commit f4a6138

Browse files
committed
Add Qute format settings (used only by completion)
Signed-off-by: azerr <azerr@redhat.com>
1 parent 0c3f186 commit f4a6138

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

package.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,22 @@
399399
"markdownDescription": "Validation severity for undefined section tag in Qute template files.",
400400
"scope": "resource"
401401
},
402+
"qute.format.splitSectionParameters": {
403+
"type": "string",
404+
"enum": [
405+
"preserve",
406+
"splitNewLine",
407+
"alignWithFirstParam"
408+
],
409+
"default": "preserve",
410+
"markdownDescription": "Split multiple section parameters each onto a new line or align parameters to the first. Default is `preserve`. Indicate level of indentation with `#qute.format.splitSectionParametersIndentSize#`.",
411+
"scope": "window"
412+
},
413+
"qute.format.splitSectionParametersIndentSize": {
414+
"type": "number",
415+
"default": 2,
416+
"markdownDescription": "How many levels to indent the section parameters by when `#qute.format.splitSectionParameters#` is `true`. Default value is `2`."
417+
},
402418
"qute.trace.debug": {
403419
"type": "string",
404420
"enum": [

src/qute/languageServer/client.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const clientOptions: LanguageClientOptions = {
4646
},
4747
synchronize: {
4848
// preferences starting with these will trigger didChangeConfiguration
49-
configurationSection: ['qute']
49+
configurationSection: ['qute', '[qute]', 'editor.tabSize', 'editor.insertSpaces']
5050
},
5151
middleware: {
5252
workspace: {
@@ -187,7 +187,10 @@ function getQuteSettings(): any {
187187

188188
function toJSONObject(configQute: unknown): any {
189189
const x = JSON.stringify(configQute); // configQute is not a JSON type
190-
return JSON.parse(x);
190+
const config = JSON.parse(x);
191+
config['format']['tabSize'] = workspace.getConfiguration('editor').get('tabSize', 4);
192+
config['format']['insertSpaces'] = workspace.getConfiguration('editor').get('insertSpaces', true);
193+
return config;
191194
}
192195

193196
function hasShownQuteValidationPopUp(context: ExtensionContext): boolean {

0 commit comments

Comments
 (0)