basic non-intrusive stretch reminder in vscode. close #81
This commit is contained in:
3
projects/smart-stretch-reminder/.gitignore
vendored
Normal file
3
projects/smart-stretch-reminder/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
bin/
|
||||
*.vsix
|
||||
node_modules/
|
6
projects/smart-stretch-reminder/.vscodeignore
Normal file
6
projects/smart-stretch-reminder/.vscodeignore
Normal file
@@ -0,0 +1,6 @@
|
||||
.vscode
|
||||
bin/*.map
|
||||
src
|
||||
build.hxml
|
||||
haxelib.json
|
||||
test.sh
|
10
projects/smart-stretch-reminder/README.md
Normal file
10
projects/smart-stretch-reminder/README.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# your-extension README
|
||||
An extension made with kiss: https://github.com/NQNStudios/kisslang
|
||||
|
||||
## Features
|
||||
|
||||
## Extension Settings
|
||||
|
||||
## Known Issues
|
||||
|
||||
## Release Notes
|
10
projects/smart-stretch-reminder/build.hxml
Normal file
10
projects/smart-stretch-reminder/build.hxml
Normal file
@@ -0,0 +1,10 @@
|
||||
-lib kiss-vscode-api
|
||||
-lib kiss
|
||||
-cp src
|
||||
-js bin/extension.js
|
||||
-dce full
|
||||
-D analyzer-optimize
|
||||
-D js-es=6
|
||||
-debug
|
||||
Main
|
||||
-cmd npx vsce package
|
2125
projects/smart-stretch-reminder/package-lock.json
generated
Normal file
2125
projects/smart-stretch-reminder/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
45
projects/smart-stretch-reminder/package.json
Normal file
45
projects/smart-stretch-reminder/package.json
Normal file
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"main": "bin/extension.js",
|
||||
"name": "smart-stretch-reminder",
|
||||
"description": "",
|
||||
"repository": {
|
||||
"url": "",
|
||||
"type:": "git"
|
||||
},
|
||||
"homepage": "",
|
||||
"categories": [],
|
||||
"extensionPack": [],
|
||||
"publisher": "",
|
||||
"contributes": {
|
||||
"configuration": {
|
||||
"title": "smart-stretch-reminder",
|
||||
"properties": {
|
||||
"smart-stretch-reminder.secondsAfterLastEdit": {
|
||||
"type": "number",
|
||||
"default": 5,
|
||||
"minimum": 0
|
||||
},
|
||||
"smart-stretch-reminder.stretchMessage": {
|
||||
"type": "string",
|
||||
"default": "Now might be a good time to stretch!"
|
||||
},
|
||||
"smart-stretch-reminder.minutesBetweenStretching": {
|
||||
"type": "number",
|
||||
"default": 20,
|
||||
"minimum": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"engines": {
|
||||
"vscode": "^1.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"vsce": "^2.15.0"
|
||||
},
|
||||
"version": "0.0.0",
|
||||
"activationEvents": [
|
||||
"onStartupFinished"
|
||||
],
|
||||
"displayName": ""
|
||||
}
|
11
projects/smart-stretch-reminder/src/Main.hx
Normal file
11
projects/smart-stretch-reminder/src/Main.hx
Normal file
@@ -0,0 +1,11 @@
|
||||
import kiss.Prelude;
|
||||
import kiss.List;
|
||||
|
||||
import vscode.*;
|
||||
|
||||
import haxe.Timer;
|
||||
|
||||
using StringTools;
|
||||
|
||||
@:build(kiss.Kiss.build())
|
||||
class Main {}
|
41
projects/smart-stretch-reminder/src/Main.kiss
Normal file
41
projects/smart-stretch-reminder/src/Main.kiss
Normal file
@@ -0,0 +1,41 @@
|
||||
(loadFrom "kiss-vscode-api" "src/Util.kiss")
|
||||
(loadFrom "kiss-vscode-api" "src/KissUtil.kiss")
|
||||
|
||||
@(:expose "activate")
|
||||
(function activate [:ExtensionContext context]
|
||||
(printThroughInfoMessage)
|
||||
|
||||
(defConfiguration
|
||||
:Float secondsAfterLastEdit
|
||||
(object
|
||||
default 5
|
||||
minimum 0)
|
||||
:Float minutesBetweenStretching
|
||||
(object
|
||||
default 20
|
||||
minimum 0)
|
||||
:String stretchMessage
|
||||
(object
|
||||
default "Now might be a good time to stretch!"))
|
||||
|
||||
(var &mut :Float lastCheck)
|
||||
(var &mut :Float secSpentTyping 0)
|
||||
(var &mut :Timer timer)
|
||||
(Vscode.workspace.onDidChangeTextDocument ->_
|
||||
{
|
||||
(when lastCheck
|
||||
(+= secSpentTyping (- (Timer.stamp) lastCheck)))
|
||||
(set lastCheck (Timer.stamp))
|
||||
(when timer
|
||||
(timer.stop))
|
||||
(set timer
|
||||
(Timer.delay
|
||||
->{
|
||||
(+= secSpentTyping secondsAfterLastEdit)
|
||||
(set lastCheck null)
|
||||
(when (>= secSpentTyping (* 60 minutesBetweenStretching))
|
||||
(set secSpentTyping 0)
|
||||
(infoMessage stretchMessage (object modal true)))
|
||||
}
|
||||
(* 1000 secondsAfterLastEdit)))
|
||||
}))
|
3
projects/smart-stretch-reminder/test.sh
Normal file
3
projects/smart-stretch-reminder/test.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
#! /bin/bash
|
||||
|
||||
haxe build.hxml
|
Reference in New Issue
Block a user