hank-vscode extension

This commit is contained in:
2025-10-29 16:24:02 -05:00
parent a7bd12074c
commit 06643052ec
28 changed files with 2830 additions and 0 deletions

3
hank-vscode/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
bin/
*.vsix
node_modules/

4
hank-vscode/.haxerc Normal file
View File

@@ -0,0 +1,4 @@
{
"version": "4.3.1",
"resolveLibs": "scoped"
}

19
hank-vscode/.vscode/launch.json vendored Normal file
View 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
hank-vscode/.vscode/tasks.json vendored Normal file
View File

@@ -0,0 +1,13 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "hxml",
"file": "build.hxml",
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -0,0 +1,7 @@
.vscode
bin/*.map
src
haxe_libraries
build.hxml
haxelib.json
test.sh

10
hank-vscode/README.md Normal file
View File

@@ -0,0 +1,10 @@
# hank-vscode
hank_vscode
## Features
## Extension Settings
## Known Issues
## Release Notes

12
hank-vscode/build.hxml Normal file
View File

@@ -0,0 +1,12 @@
-lib kiss-vscode-api
-lib kiss
-lib hxnodejs
-lib hank
-cp src
-js bin/extension.js
-dce full
-D analyzer-optimize
-D js-es=6
-debug
Main
-cmd npx @vscode/vsce package

View File

@@ -0,0 +1,6 @@
# @install: lix --silent download "git:https://k7izh9.gitea.cloud/NQN/hank#a7bd12074c88b29a58d68eba720c657f6a267cc6" into hank/0.0.8/git/a7bd12074c88b29a58d68eba720c657f6a267cc6
# @run: haxelib run-dir hank "${HAXE_LIBCACHE}/hank/0.0.8/git/a7bd12074c88b29a58d68eba720c657f6a267cc6"
-lib hscript
-lib utest
-cp ${HAXE_LIBCACHE}/hank/0.0.8/git/a7bd12074c88b29a58d68eba720c657f6a267cc6/
-D hank=0.0.8

View File

@@ -0,0 +1,5 @@
# @install: lix --silent download "haxelib:/haxe-strings#7.0.3" into haxe-strings/7.0.3/haxelib
-cp ${HAXE_LIBCACHE}/haxe-strings/7.0.3/haxelib/src/
-D haxe-strings=7.0.3
--macro hx.strings.internal.Macros.addDefines()
--macro hx.strings.internal.Macros.configureNullSafety()

View File

@@ -0,0 +1,5 @@
# @install: lix --silent download "haxelib:/hscript#2.5.0" into hscript/2.5.0/haxelib
# @run: haxelib run-dir hscript "${HAXE_LIBCACHE}/hscript/2.5.0/haxelib"
-cp ${HAXE_LIBCACHE}/hscript/2.5.0/haxelib/
-D hscript=2.5.0
--macro keep('IntIterator')

View File

@@ -0,0 +1,7 @@
# @install: lix --silent download "gh://github.com/haxefoundation/hxnodejs#504066dc1ba5ad543afa5f6c3ea019f06136a82b" into hxnodejs/12.1.0/github/504066dc1ba5ad543afa5f6c3ea019f06136a82b
-cp ${HAXE_LIBCACHE}/hxnodejs/12.1.0/github/504066dc1ba5ad543afa5f6c3ea019f06136a82b/src
-D hxnodejs=12.1.0
--macro allowPackage('sys')
# should behave like other target defines and not be defined in macro context
--macro define('nodejs')
--macro _internal.SuppressDeprecated.run()

View File

@@ -0,0 +1,8 @@
# @install: lix --silent download "git:https://k7izh9.gitea.cloud/kiss-lang/kiss-vscode-api#4ecc740b0d2cfbc477cbc35079b1b63a4e6b684d" into kiss-vscode-api/0.0.0/git/4ecc740b0d2cfbc477cbc35079b1b63a4e6b684d
# @run: haxelib run-dir kiss-vscode-api "${HAXE_LIBCACHE}/kiss-vscode-api/0.0.0/git/4ecc740b0d2cfbc477cbc35079b1b63a4e6b684d"
-lib hxnodejs
-lib kiss
-lib re-flex
-lib vscode
-cp ${HAXE_LIBCACHE}/kiss-vscode-api/0.0.0/git/4ecc740b0d2cfbc477cbc35079b1b63a4e6b684d/src/
-D kiss-vscode-api=0.0.0

View File

@@ -0,0 +1,12 @@
# @install: lix --silent download "git:https://k7izh9.gitea.cloud/kiss-lang/kiss#4ed85110a76a2af0adc89a2a90120a81a41f1456" into kiss/0.0.1/git/4ed85110a76a2af0adc89a2a90120a81a41f1456
# @run: haxelib run-dir kiss "${HAXE_LIBCACHE}/kiss/0.0.1/git/4ed85110a76a2af0adc89a2a90120a81a41f1456"
-lib haxe-strings
-lib hscript
-lib tink_json
-lib tink_macro
-lib tink_syntaxhub
-lib uuid
-cp ${HAXE_LIBCACHE}/kiss/0.0.1/git/4ed85110a76a2af0adc89a2a90120a81a41f1456/src
-D kiss=0.0.1
-w -WUnusedPattern
--macro kiss.KissFrontend.use()

View File

@@ -0,0 +1,5 @@
# @install: lix --silent download "git:https://k7izh9.gitea.cloud/kiss-lang/re-flex#ac4ffbd4dfcd3ebdda03d920cdfcaf5ac0bd33e2" into re-flex/0.0.0/git/ac4ffbd4dfcd3ebdda03d920cdfcaf5ac0bd33e2
# @run: haxelib run-dir re-flex "${HAXE_LIBCACHE}/re-flex/0.0.0/git/ac4ffbd4dfcd3ebdda03d920cdfcaf5ac0bd33e2"
-lib kiss
-cp ${HAXE_LIBCACHE}/re-flex/0.0.0/git/ac4ffbd4dfcd3ebdda03d920cdfcaf5ac0bd33e2/src/
-D re-flex=0.0.0

View File

@@ -0,0 +1,3 @@
# @install: lix --silent download "haxelib:/tink_core#2.1.0" into tink_core/2.1.0/haxelib
-cp ${HAXE_LIBCACHE}/tink_core/2.1.0/haxelib/src
-D tink_core=2.1.0

View File

@@ -0,0 +1,4 @@
# @install: lix --silent download "haxelib:/tink_json#0.11.0" into tink_json/0.11.0/haxelib
-lib tink_typecrawler
-cp ${HAXE_LIBCACHE}/tink_json/0.11.0/haxelib/src
-D tink_json=0.11.0

View File

@@ -0,0 +1,4 @@
# @install: lix --silent download "git:https://k7izh9.gitea.cloud/kiss-lang/tink_macro#8b60a484b1141d1176b34ba3af9ac65b499079ff" into tink_macro/1.0.3/git/8b60a484b1141d1176b34ba3af9ac65b499079ff
-lib tink_core
-cp ${HAXE_LIBCACHE}/tink_macro/1.0.3/git/8b60a484b1141d1176b34ba3af9ac65b499079ff/src
-D tink_macro=1.0.3

View File

@@ -0,0 +1,3 @@
-D tink_priority=0.1.3
# @install: lix --silent download "gh://github.com/haxetink/tink_priority#ea736d31dc788aae703a2aa415c25d5b80d0e7d1" into tink_priority/0.1.3/github/ea736d31dc788aae703a2aa415c25d5b80d0e7d1
-cp ${HAXE_LIBCACHE}/tink_priority/0.1.3/github/ea736d31dc788aae703a2aa415c25d5b80d0e7d1/src

View File

@@ -0,0 +1,6 @@
# @install: lix --silent download "gh://github.com/haxetink/tink_syntaxhub#b6ea4966bbdee4d176ac8dd5d2d8ae3b362b2f86" into tink_syntaxhub/0.6.0/github/b6ea4966bbdee4d176ac8dd5d2d8ae3b362b2f86
-lib tink_macro
-lib tink_priority
-cp ${HAXE_LIBCACHE}/tink_syntaxhub/0.6.0/github/b6ea4966bbdee4d176ac8dd5d2d8ae3b362b2f86/src
-D tink_syntaxhub=0.6.0
--macro tink.SyntaxHub.use()

View File

@@ -0,0 +1,4 @@
# @install: lix --silent download "haxelib:/tink_typecrawler#0.7.0" into tink_typecrawler/0.7.0/haxelib
-lib tink_macro
-cp ${HAXE_LIBCACHE}/tink_typecrawler/0.7.0/haxelib/src
-D tink_typecrawler=0.7.0

View File

@@ -0,0 +1,5 @@
# @install: lix --silent download "haxelib:/utest#1.13.2" into utest/1.13.2/haxelib
-cp ${HAXE_LIBCACHE}/utest/1.13.2/haxelib/src
-D utest=1.13.2
--macro utest.utils.Macro.checkHaxe()
--macro utest.utils.Macro.importEnvSettings()

View File

@@ -0,0 +1,3 @@
# @install: lix --silent download "haxelib:/uuid#2.4.1" into uuid/2.4.1/haxelib
-cp ${HAXE_LIBCACHE}/uuid/2.4.1/haxelib/src
-D uuid=2.4.1

View File

@@ -0,0 +1,4 @@
# @install: lix --silent download "haxelib:/vscode#1.60.0" into vscode/1.60.0/haxelib
-lib hxnodejs
-cp ${HAXE_LIBCACHE}/vscode/1.60.0/haxelib/src
-D vscode=1.60.0

2572
hank-vscode/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

40
hank-vscode/package.json Normal file
View File

@@ -0,0 +1,40 @@
{
"main": "bin/extension.js",
"name": "hank-vscode",
"description": "hank_vscode",
"repository": {
"url": "",
"type:": "git"
},
"homepage": "",
"categories": [],
"extensionPack": [],
"dependencies": {
"jsdom": "^22.1.0"
},
"publisher": "kiss-lang",
"contributes": {
"keybindings": [
{
"command": "hank-vscode.testScript",
"mac": "Cmd+; Cmd+h",
"key": "Ctrl+; Ctrl+h"
}
],
"commands": [
{
"title": "hank-vscode: Test Hank script",
"command": "hank-vscode.testScript"
}
]
},
"engines": {
"vscode": "^1.4.0"
},
"devDependencies": {
"@vscode/vsce": "^2.15.0"
},
"version": "0.0.0",
"activationEvents": [],
"displayName": ""
}

10
hank-vscode/src/Main.hx Normal file
View File

@@ -0,0 +1,10 @@
import kiss.Prelude;
import kiss.List;
import hank.Story;
import vscode.*;
using StringTools;
@:build(kiss.Kiss.build())
class Main {}

53
hank-vscode/src/Main.kiss Normal file
View File

@@ -0,0 +1,53 @@
(loadFrom "kiss-vscode-api" "src/Util.kiss")
(loadFrom "kiss-vscode-api" "src/KissUtil.kiss")
@(:expose "activate")
(function activate [:ExtensionContext context]
(printThroughInfoMessage)
(awaitLetCatchThroughErrorMessage)
// Add your extension's commands here with (defCommand <...>):
// (defCommand context exampleCommand "An example command for your extension" "C-; C-1" [] (doSomething))
(defCommand context testScript "Test Hank script" "C-; C-h" []
(localVar &mut :Story story null)
(localFunction elementFor [:Story story :Dynamic document]
(let [:Dynamic d (document.createElement "div")]
(loop
(case (story.nextFrame)
((HasText t) (let [p (document.createElement "p")]
(set p.innerHTML t)
(d.appendChild p)))
((HasChoices choices _tags)
(doFor [idx c] (enumerate choices)
(+= d.innerHTML "<p><a onclick=\"
sendMessage('choose', ${idx})
\">${c}</a></p>"))
(return d))
(Finished (+= d.innerHTML "<p>THE END</p>") (return d))
(never null)))
null))
(kiss_vscode_api.QuickWebview.quickWebview activeTextEditor.document.fileName
->document {
(set story (Story.FromFile activeTextEditor.document.fileName))
(document.body.appendChild (elementFor story document))
}
null
null
// onMessage
->[document type data]
(case type
("choose"
(story.choose data)
(set document.body.innerHTML "")
(document.body.appendChild (elementFor story document)))
(never otherwise))))
// Add your extension's configuration here with (defConfiguration <...>):
// (defConfiguration
// :Bool configBool
// (object
// default false)
// :String configString
// (object
// default ""))
)

3
hank-vscode/test.sh Normal file
View File

@@ -0,0 +1,3 @@
#! /bin/bash
haxe build.hxml