Skip to content

Commit

Permalink
chore: more cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
xhayper committed Oct 29, 2022
1 parent 20573e3 commit 2d21522
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 52 deletions.
28 changes: 15 additions & 13 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,19 @@
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
"sourceMaps": true,
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
"preLaunchTask": "npm: watch"
}
]
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/dist/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
}
]
}
12 changes: 10 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
// Place your settings in this file to overwrite default and user settings.
{
"typescript.tsdk": "./node_modules/typescript/lib",
"task.allowAutomaticTasks": "on",
"typescript.tsc.autoDetect": "off",
"eslint.enable": true,
"prettier.enable": true
"prettier.enable": true,
"files.exclude": {
"out": false,
"dist": false
},
"search.exclude": {
"out": true,
"dist": true
}
}
17 changes: 3 additions & 14 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,17 @@
"tasks": [
{
"type": "npm",
"label": "npm: watch",
"script": "watch",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": ["$tsup-watch", "$tsup-tsc-watch"],
"isBackground": true,
"presentation": {
"reveal": "never",
"group": "watchers"
},
"runOptions": {
"runOn": "folderOpen"
"group": {
"kind": "build",
"isDefault": true
}
},
{
"type": "npm",
"label": "npm: build",
"script": "build",
"group": "build",
"problemMatcher": ["$tsup", "$tsup-tsc"]
}
]
}
12 changes: 5 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,23 @@
"onStartupFinished"
],
"scripts": {
"vscode:prepublish": "yarn build",
"build": "tsup",
"vscode:prepublish": "yarn run package",
"package": "tsup",
"watch": "tsup --watch",
"lint": "eslint src"
},
"devDependencies": {
"@types/git-url-parse": "^9.0.1",
"@types/node": "16.x",
"@types/vscode": "^1.57.0",
"@types/vscode": "1.57.0",
"@typescript-eslint/eslint-plugin": "^5.41.0",
"@typescript-eslint/parser": "^5.41.0",
"@xhayper/discord-rpc": "^1.0.13",
"eslint": "^8.26.0",
"eslint-config-prettier": "^8.5.0",
"filesize": "^10.0.5",
"git-url-parse": "^13.1.0",
"prettier": "^2.7.1",
"source-map-support": "^0.5.21",
"tsup": "^6.3.0",
"typescript": "^4.8.4"
Expand Down Expand Up @@ -728,8 +729,5 @@
}
]
},
"packageManager": "[email protected]",
"dependencies": {
"prettier": "^2.7.1"
}
"packageManager": "[email protected]"
}
10 changes: 7 additions & 3 deletions src/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ export class RPCController {

private idleTimeout: NodeJS.Timer | undefined;
private iconTimeout: NodeJS.Timer | undefined;
private activityThrottle = throttle(() => void this.sendActivity(), 2000, true);
private activityThrottle = throttle(
(isViewing?: boolean, isIdling?: boolean) => this.sendActivity(isViewing, isIdling),
2000,
true
);

constructor(clientId: string, debug = false) {
this.client = new Client({ clientId });
Expand Down Expand Up @@ -91,11 +95,11 @@ export class RPCController {
const fileSwitch = window.onDidChangeActiveTextEditor(() => sendActivity(true));
const fileEdit = workspace.onDidChangeTextDocument((e) => {
if (e.document !== dataClass.editor?.document) return;
this.activityThrottle.callable();
void this.activityThrottle.callable();
});
const fileSelectionChanged = window.onDidChangeTextEditorSelection((e) => {
if (e.textEditor !== dataClass.editor) return;
this.activityThrottle.callable();
void this.activityThrottle.callable();
});
const debugStart = debug.onDidStartDebugSession(() => sendActivity());
const debugEnd = debug.onDidTerminateDebugSession(() => sendActivity());
Expand Down
26 changes: 13 additions & 13 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ __metadata:
linkType: hard

"@humanwhocodes/config-array@npm:^0.11.6":
version: 0.11.6
resolution: "@humanwhocodes/config-array@npm:0.11.6"
version: 0.11.7
resolution: "@humanwhocodes/config-array@npm:0.11.7"
dependencies:
"@humanwhocodes/object-schema": ^1.2.1
debug: ^4.1.1
minimatch: ^3.0.4
checksum: 2fb7288638968dfeec27f06aef52f043726edd126ac47f24b54256902fdb35b3bf9863d4a4caf0423dccca5dd1354ca5899f3ac047b56774641ca0c4cbedb104
minimatch: ^3.0.5
checksum: cf506dc45d9488af7fbf108ea6ac2151ba1a25e6d2b94b9b4fc36d2c1e4099b89ff560296dbfa13947e44604d4ca4a90d97a4fb167370bf8dd01a6ca2b6d83ac
languageName: node
linkType: hard

Expand Down Expand Up @@ -150,10 +150,10 @@ __metadata:
languageName: node
linkType: hard

"@types/vscode@npm:^1.57.0":
version: 1.72.0
resolution: "@types/vscode@npm:1.72.0"
checksum: 590ec21d01d737176f231fde1cafae31e9774891cc3c89cc7167167c0d88a91547c5a9f2103f4e778804f4f55724e9e1d2e3499448e8cea0d33786a1c728e4b6
"@types/vscode@npm:1.57.0":
version: 1.57.0
resolution: "@types/vscode@npm:1.57.0"
checksum: 1393f0c7302562638ddae31a305680935e50b17cfb922eff4f83aeb06e3cc6e196d92224e32781c9c78e5dc342cc9878da18d01066a76739b99fed4658bb2daf
languageName: node
linkType: hard

Expand Down Expand Up @@ -695,9 +695,9 @@ __metadata:
linkType: hard

"discord-api-types@npm:^0.37.14":
version: 0.37.14
resolution: "discord-api-types@npm:0.37.14"
checksum: 8f45f202e66acfd7b25624c8f4d225b363d9d8991d766959bcf246761548b99e21c12d9f7eafe00903913af66058595e5e56329dfb219eab8bb75a84f6413983
version: 0.37.15
resolution: "discord-api-types@npm:0.37.15"
checksum: c54d2feeb8074509bdda430fb8ec0f6ff315512e7327d47399e0e7a78bbd0a6f0f0dcfc4b5e39825eb6141a13f33efa942711af89c9a5936a721cfc1e1d69d19
languageName: node
linkType: hard

Expand Down Expand Up @@ -1810,7 +1810,7 @@ __metadata:
languageName: node
linkType: hard

"minimatch@npm:^3.0.4, minimatch@npm:^3.1.1, minimatch@npm:^3.1.2":
"minimatch@npm:^3.0.4, minimatch@npm:^3.0.5, minimatch@npm:^3.1.1, minimatch@npm:^3.1.2":
version: 3.1.2
resolution: "minimatch@npm:3.1.2"
dependencies:
Expand Down Expand Up @@ -2705,7 +2705,7 @@ __metadata:
dependencies:
"@types/git-url-parse": ^9.0.1
"@types/node": 16.x
"@types/vscode": ^1.57.0
"@types/vscode": 1.57.0
"@typescript-eslint/eslint-plugin": ^5.41.0
"@typescript-eslint/parser": ^5.41.0
"@xhayper/discord-rpc": ^1.0.13
Expand Down

0 comments on commit 2d21522

Please sign in to comment.