Allow custom names in ktxt2 settings
This commit is contained in:
@@ -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"
|
||||
|
@@ -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)))
|
||||
|
@@ -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))
|
||||
}
|
||||
])
|
Reference in New Issue
Block a user