Overhaul ktxt2. Close #184
This commit is contained in:
3
projects/ktxt2/.gitignore
vendored
Normal file
3
projects/ktxt2/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
bin/
|
||||
*.vsix
|
||||
node_modules/
|
19
projects/ktxt2/.vscode/launch.json
vendored
Normal file
19
projects/ktxt2/.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Launch Extension",
|
||||
"type": "extensionHost",
|
||||
"request": "launch",
|
||||
"runtimeExecutable": "${execPath}",
|
||||
"args": [
|
||||
"--extensionDevelopmentPath=${workspaceFolder}"
|
||||
],
|
||||
"stopOnEntry": false,
|
||||
"sourceMaps": true,
|
||||
"outFiles": [
|
||||
"${workspaceFolder}/*.js"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
13
projects/ktxt2/.vscode/tasks.json
vendored
Normal file
13
projects/ktxt2/.vscode/tasks.json
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"type": "hxml",
|
||||
"file": "build.hxml",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
5
projects/ktxt2/.vscodeignore
Normal file
5
projects/ktxt2/.vscodeignore
Normal file
@@ -0,0 +1,5 @@
|
||||
.vscode
|
||||
bin/*.map
|
||||
src
|
||||
build.hxml
|
||||
test.sh
|
@@ -1,4 +0,0 @@
|
||||
(var :Array<KTxt2Conversion> conversions [])
|
||||
|
||||
(function registerConversion [:KTxt2Conversion conversion] (conversions.push conversion)))
|
||||
|
@@ -1,2 +0,0 @@
|
||||
(context.subscriptions.push
|
||||
(KTxt2EditorProvider.register context))
|
11
projects/ktxt2/README.md
Normal file
11
projects/ktxt2/README.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# ktxt2 README
|
||||
|
||||
A tool for side-by-side, semi-automatic conversion between plaintext formats.
|
||||
|
||||
## Features
|
||||
|
||||
## Extension Settings
|
||||
|
||||
## Known Issues
|
||||
|
||||
## Release Notes
|
@@ -1,6 +1,15 @@
|
||||
-lib kiss
|
||||
-lib kiss-vscode
|
||||
-lib re-flex
|
||||
-lib kiss-vscode-api
|
||||
-cp src
|
||||
-dce full
|
||||
-D analyzer-optimize
|
||||
-D js-es=6
|
||||
--each
|
||||
|
||||
-js bin/ktxt2editor.js
|
||||
--main ktxt2.KTxt2Editor
|
||||
--main ktxt2.KTxt2Editor
|
||||
--next
|
||||
|
||||
-js bin/extension.js
|
||||
ktxt2.Main
|
||||
-cmd npx vsce package
|
2138
projects/ktxt2/package-lock.json
generated
Normal file
2138
projects/ktxt2/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,12 +1,52 @@
|
||||
"customEditors": [
|
||||
{
|
||||
"selector": [
|
||||
{
|
||||
"filenamePattern": "*.*.*.ktxt2"
|
||||
}
|
||||
],
|
||||
"priority": "default",
|
||||
"viewType": "ktxt2.splitView",
|
||||
"displayName": "KTxt2 Split View"
|
||||
}
|
||||
],
|
||||
{
|
||||
"main": "bin/extension.js",
|
||||
"name": "ktxt2",
|
||||
"description": "",
|
||||
"repository": {
|
||||
"url": "https://github.com/NQNStudios/kisslang",
|
||||
"type:": "git"
|
||||
},
|
||||
"homepage": "",
|
||||
"categories": [],
|
||||
"extensionPack": [],
|
||||
"publisher": "NQNStudios",
|
||||
"contributes": {
|
||||
"keybindings": [
|
||||
{
|
||||
"command": "ktxt2.importKTxt2InputFile",
|
||||
"mac": "Cmd+; Cmd+i",
|
||||
"key": "Ctrl+; Ctrl+i"
|
||||
}
|
||||
],
|
||||
"customEditors": [
|
||||
{
|
||||
"selector": [
|
||||
{
|
||||
"filenamePattern": "*.*.*.ktxt2"
|
||||
}
|
||||
],
|
||||
"priority": "default",
|
||||
"viewType": "ktxt2.splitView",
|
||||
"displayName": "KTxt2 Split View"
|
||||
}
|
||||
],
|
||||
"commands": [
|
||||
{
|
||||
"title": "ktxt2: Import a file to a new KTxt2 file",
|
||||
"command": "ktxt2.importKTxt2InputFile"
|
||||
}
|
||||
]
|
||||
},
|
||||
"engines": {
|
||||
"vscode": "^1.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"vsce": "^2.15.0"
|
||||
},
|
||||
"version": "0.0.0",
|
||||
"activationEvents": [],
|
||||
"displayName": "",
|
||||
"dependencies": {
|
||||
"monaco-editor": "^0.36.1"
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,4 @@
|
||||
// Command to import a file to a new KTxt2 file:
|
||||
(function :Void importKTxt2InputFile [&opt _]
|
||||
(defCommand context importKTxt2InputFile "Import a file to a new KTxt2 file" "C-; C-i" []
|
||||
(awaitLet [uris (openDialog (object openLabel "Import" title "File to import as KTxt2 input" canSelectMany false))
|
||||
outputType (inputBox (object prompt "Output file extension"))
|
||||
splitBy (quickPickMap [=>"↵ (new line)" "\n" =>"¶ (new paragraph)" "\n\n" =>"Other (specify via text box)" ""])]
|
@@ -65,13 +65,13 @@
|
||||
(makeEdit
|
||||
->edit (edit.delete document.uri (new Range (streamPosToOffsetDocumentPos start -KTxt2.blockStartEnd.length) (streamPosToOffsetDocumentPos end KTxt2.blockStartEnd.length)))))
|
||||
((object type "tryFullAutoConvert")
|
||||
(let [fullConverted (KTxt2.tryFullAutoConvert document.fileName Main.config.conversions)]
|
||||
(let [fullConverted (KTxt2.tryFullAutoConvert document.fileName Main.conversions)]
|
||||
(makeEdit
|
||||
->edit (edit.replace document.uri (let [fullText (document.getText)] (new Range (document.positionAt 0) (document.positionAt (- fullText.length 1)))) fullConverted))))
|
||||
((objectWith [type "tryAutoConvert"] source output outputStart outputEnd)
|
||||
(let [[base sourceExt outputExt _] (document.fileName.split ".")
|
||||
conversions
|
||||
(KTxt2.validConversions Main.config.conversions "${base}.${sourceExt}" "${base}.${outputExt}" source)]
|
||||
(KTxt2.validConversions Main.conversions "${base}.${sourceExt}" "${base}.${outputExt}" source)]
|
||||
(if (> (Lambda.count conversions) 0)
|
||||
(let [overwrite (if output "" "Overwrite")
|
||||
chosenConversion (if (= 1 (Lambda.count conversions)) (first (collect (conversions.iterator))) null)]
|
||||
|
14
projects/ktxt2/src/ktxt2/Main.hx
Normal file
14
projects/ktxt2/src/ktxt2/Main.hx
Normal file
@@ -0,0 +1,14 @@
|
||||
package ktxt2;
|
||||
|
||||
import kiss.Prelude;
|
||||
import kiss.List;
|
||||
|
||||
import vscode.*;
|
||||
import ktxt2.KTxt2;
|
||||
|
||||
import sys.io.File;
|
||||
|
||||
using StringTools;
|
||||
|
||||
@:build(kiss.Kiss.build())
|
||||
class Main {}
|
25
projects/ktxt2/src/ktxt2/Main.kiss
Normal file
25
projects/ktxt2/src/ktxt2/Main.kiss
Normal file
@@ -0,0 +1,25 @@
|
||||
(loadFrom "kiss-vscode-api" "src/Util.kiss")
|
||||
(loadFrom "kiss-vscode-api" "src/KissUtil.kiss")
|
||||
|
||||
(var :Array<KTxt2Conversion> conversions [])
|
||||
|
||||
(function registerConversion [:KTxt2Conversion conversion] (conversions.push conversion))
|
||||
|
||||
@(:expose "activate")
|
||||
(function activate [:ExtensionContext context]
|
||||
(printThroughInfoMessage)
|
||||
|
||||
(context.subscriptions.push
|
||||
(KTxt2EditorProvider.register context))
|
||||
|
||||
// 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 ""))
|
||||
)
|
3
projects/ktxt2/test.sh
Normal file
3
projects/ktxt2/test.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
#! /bin/bash
|
||||
|
||||
haxe build.hxml
|
Reference in New Issue
Block a user