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.
This commit is contained in:
Andrew Eisenberg
2020-06-02 16:55:16 -07:00
parent 71f74cb620
commit b84c429882
2 changed files with 5 additions and 6 deletions

View File

@@ -30,9 +30,5 @@
"end": "^\\s*//\\s*#?endregion\\b" "end": "^\\s*//\\s*#?endregion\\b"
} }
}, },
"wordPattern": "(-?\\d*\\.\\d\\w*)|([^\\~\\!\\@\\#\\%\\^\\&\\*\\(\\)\\-\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:\\'\\\"\\.\\<\\>\\/\\?\\s]+)", "wordPattern": "(-?\\d*\\.\\d\\w*)|([^\\~\\!\\@\\#\\%\\^\\&\\*\\(\\)\\-\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:\\'\\\"\\.\\<\\>\\/\\?\\s]+)"
"indentationRules": {
"increaseIndentPattern": "^((?!.*?\\/\\*).*\\*/)?\\s*[\\}\\]].*$",
"decreaseIndentPattern": "^((?!\\/\\/).)*(\\{[^}\"']*|\\([^)\"']*|\\[[^\\]\"']*)$"
}
} }

View File

@@ -17,11 +17,14 @@ export function install() {
// setLanguageConfiguration requires a regexp for the wordpattern, not a string // setLanguageConfiguration requires a regexp for the wordpattern, not a string
langConfig.wordPattern = new RegExp(langConfig.wordPattern); langConfig.wordPattern = new RegExp(langConfig.wordPattern);
langConfig.onEnterRules = onEnterRules; langConfig.onEnterRules = onEnterRules;
langConfig.indentationRules = {
decreaseIndentPattern: /^((?!.*?\/\*).*\*\/)?\s*[\}\]].*$/,
increaseIndentPattern: /^((?!\/\/).)*(\{[^}"'`]*|\([^)"'`]*|\[[^\]"'`]*)$/
};
languages.setLanguageConfiguration('ql', langConfig); languages.setLanguageConfiguration('ql', langConfig);
languages.setLanguageConfiguration('qll', langConfig); languages.setLanguageConfiguration('qll', langConfig);
languages.setLanguageConfiguration('dbscheme', langConfig); languages.setLanguageConfiguration('dbscheme', langConfig);
} }
const onEnterRules = [ const onEnterRules = [