Skip to content

Commit b84c429

Browse files
committed
Fix bad indentation on paste
I don't fully understand why this is working differently, but these changes enable proper behavior on pasting ql into the editor.
1 parent 71f74cb commit b84c429

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

extensions/ql-vscode/language-configuration.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,5 @@
3030
"end": "^\\s*//\\s*#?endregion\\b"
3131
}
3232
},
33-
"wordPattern": "(-?\\d*\\.\\d\\w*)|([^\\~\\!\\@\\#\\%\\^\\&\\*\\(\\)\\-\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:\\'\\\"\\.\\<\\>\\/\\?\\s]+)",
34-
"indentationRules": {
35-
"increaseIndentPattern": "^((?!.*?\\/\\*).*\\*/)?\\s*[\\}\\]].*$",
36-
"decreaseIndentPattern": "^((?!\\/\\/).)*(\\{[^}\"']*|\\([^)\"']*|\\[[^\\]\"']*)$"
37-
}
33+
"wordPattern": "(-?\\d*\\.\\d\\w*)|([^\\~\\!\\@\\#\\%\\^\\&\\*\\(\\)\\-\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:\\'\\\"\\.\\<\\>\\/\\?\\s]+)"
3834
}

extensions/ql-vscode/src/languageSupport.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,14 @@ export function install() {
1717
// setLanguageConfiguration requires a regexp for the wordpattern, not a string
1818
langConfig.wordPattern = new RegExp(langConfig.wordPattern);
1919
langConfig.onEnterRules = onEnterRules;
20+
langConfig.indentationRules = {
21+
decreaseIndentPattern: /^((?!.*?\/\*).*\*\/)?\s*[\}\]].*$/,
22+
increaseIndentPattern: /^((?!\/\/).)*(\{[^}"'`]*|\([^)"'`]*|\[[^\]"'`]*)$/
23+
};
2024

2125
languages.setLanguageConfiguration('ql', langConfig);
2226
languages.setLanguageConfiguration('qll', langConfig);
2327
languages.setLanguageConfiguration('dbscheme', langConfig);
24-
2528
}
2629

2730
const onEnterRules = [

0 commit comments

Comments
 (0)