Allow custom names in ktxt2 settings

This commit is contained in:
2023-03-20 21:30:46 -06:00
parent cf0e0800a5
commit 4c41781ccb
3 changed files with 33 additions and 11 deletions

View File

@@ -38,7 +38,22 @@
"title": "ktxt2: Import a file to a new KTxt2 file", "title": "ktxt2: Import a file to a new KTxt2 file",
"command": "ktxt2.importKTxt2InputFile" "command": "ktxt2.importKTxt2InputFile"
} }
] ],
"configuration": {
"title": "ktxt2",
"properties": {
"ktxt2.nameExceptions": {
"description": "Treat these tokens as names",
"items": {
"type": "string"
},
"type": [
"array"
],
"default": []
}
}
}
}, },
"engines": { "engines": {
"vscode": "^1.4.0" "vscode": "^1.4.0"

View File

@@ -17,11 +17,12 @@
// Add your extension's commands here with (defCommand <...>): // Add your extension's commands here with (defCommand <...>):
(load "Commands.kiss") (load "Commands.kiss")
// Add your extension's configuration here with (defConfiguration <...>): // Add your extension's configuration here with (defConfiguration <...>):
// (defConfiguration (defConfiguration
// :Bool configBool :Array<String> nameExceptions
// (object (object
// default false) description "Treat these tokens as names"
// :String configString default [])))
// (object
// default "")) (function updateNameExceptions []
) (doFor name nameExceptions
(dictSet bad_nlp.Names.yesNames (name.toLowerCase) true)))

View File

@@ -4,6 +4,12 @@
:(String,Array<String>)->Bool canConvertNames :(String,Array<String>)->Bool canConvertNames
:Array<String>->String convertNames] :Array<String>->String convertNames]
[ [
&mut :String->Bool canConvert ->block ?(whenLet [names (Names.findNames block)] (canConvertNames block names)) &mut :String->Bool canConvert ->block {
&mut :String->String convert ->block (let [names (Names.findNames block)] (convertNames names)) (Main.updateNameExceptions)
?(whenLet [names (Names.findNames block)] (canConvertNames block names))
}
&mut :String->String convert ->block {
(Main.updateNameExceptions)
(let [names (Names.findNames block)] (convertNames names))
}
]) ])