Skip to content

Commit 89dccda

Browse files
authored
Merge pull request #602 from jpogran/GH-289-auto-indent
(GH-289) Auto Indent for Types with Titles
2 parents 72a9766 + fa2ef7c commit 89dccda

File tree

3 files changed

+38
-76
lines changed

3 files changed

+38
-76
lines changed

languages/puppet-language-configuration.json

Lines changed: 0 additions & 38 deletions
This file was deleted.

languages/puppetfile-language-configuration.json

Lines changed: 0 additions & 38 deletions
This file was deleted.

src/extension.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ let extensionFeatures: IFeature[] = [];
3636

3737
export function activate(context: vscode.ExtensionContext) {
3838
extContext = context;
39+
40+
setLanguageConfiguration();
3941

4042
notifyOnNewExtensionVersion(extContext);
4143

@@ -291,3 +293,39 @@ async function notifyIfNewPDKVersion(context: vscode.ExtensionContext, settings:
291293
logger.error(error);
292294
});
293295
}
296+
297+
function setLanguageConfiguration() {
298+
vscode.languages.setLanguageConfiguration(puppetLangID, {
299+
onEnterRules: [
300+
{
301+
// foo{'bar':}
302+
beforeText: /^.*{\s{0,}'.*':/,
303+
afterText: /\s{0,}}$/,
304+
action: {
305+
indentAction: vscode.IndentAction.IndentOutdent
306+
}
307+
}
308+
],
309+
brackets: [
310+
["{", "}"],
311+
["[", "]"],
312+
["(", ")"]
313+
],
314+
comments: {
315+
lineComment: "#",
316+
blockComment: ["/*", "*/"]
317+
}
318+
});
319+
vscode.languages.setLanguageConfiguration(puppetFileLangID, {
320+
onEnterRules: [],
321+
brackets: [
322+
["{", "}"],
323+
["[", "]"],
324+
["(", ")"]
325+
],
326+
comments: {
327+
lineComment: "#",
328+
blockComment: ["/*", "*/"]
329+
}
330+
});
331+
}

0 commit comments

Comments
 (0)