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",
"command": "ktxt2.importKTxt2InputFile"
}
]
],
"configuration": {
"title": "ktxt2",
"properties": {
"ktxt2.nameExceptions": {
"description": "Treat these tokens as names",
"items": {
"type": "string"
},
"type": [
"array"
],
"default": []
}
}
}
},
"engines": {
"vscode": "^1.4.0"

View File

@@ -17,11 +17,12 @@
// Add your extension's commands here with (defCommand <...>):
(load "Commands.kiss")
// Add your extension's configuration here with (defConfiguration <...>):
// (defConfiguration
// :Bool configBool
// (object
// default false)
// :String configString
// (object
// default ""))
)
(defConfiguration
:Array<String> nameExceptions
(object
description "Treat these tokens as names"
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
:Array<String>->String convertNames]
[
&mut :String->Bool canConvert ->block ?(whenLet [names (Names.findNames block)] (canConvertNames block names))
&mut :String->String convert ->block (let [names (Names.findNames block)] (convertNames names))
&mut :String->Bool canConvert ->block {
(Main.updateNameExceptions)
?(whenLet [names (Names.findNames block)] (canConvertNames block names))
}
&mut :String->String convert ->block {
(Main.updateNameExceptions)
(let [names (Names.findNames block)] (convertNames names))
}
])