Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
node-version: [18.x, 20.x, 22.x]
os: [windows-latest, macos-latest, ubuntu-latest]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

Expand Down
23 changes: 0 additions & 23 deletions jest.config.js

This file was deleted.

34,478 changes: 13,460 additions & 21,018 deletions package-lock.json

Large diffs are not rendered by default.

59 changes: 29 additions & 30 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
"version": "0.4.1",
"publisher": "satoren",
"engines": {
"vscode": "^1.52.0"
"vscode": "^1.80.0"
},
"categories": [
"Debuggers"
],
"dependencies": {
"lrdb-debuggable-lua": "^0.5.4",
"vscode-debugadapter": "^1.43.0",
"vscode-nls": "^5.0.0"
"@vscode/debugadapter": "^1.51.0",
"lrdb-debuggable-lua": "^0.7.0",
"vscode-nls": "^5.2.0"
},
"activationEvents": [
"onDebug"
Expand All @@ -29,40 +29,38 @@
"scripts": {
"vscode:prepublish": "tsc -p ./",
"compile": "tsc -watch -p ./",
"package": "vsce package",
"publish": "vsce publish",
"package": "@vscode/vsce package",
"publish": "@vscode/vsce publish",
"build": "tsc",
"jest": "jest",
"test": "run-s build jest",
"vitest": "vitest run",
"test": "run-s build vitest",
"lint:eslint": "eslint . --cache --ext ts",
"lint:prettier": "prettier . --check",
"lint": "run-s lint:eslint lint:prettier",
"fix": "run-s fix:eslint fix:prettier",
"fix:eslint": "yarn lint:eslint --fix",
"fix:prettier": "yarn lint:prettier --write"
"fix:eslint": "npm run lint:eslint -- --fix",
"fix:prettier": "npm run lint:prettier -- --write"
},
"devDependencies": {
"@semantic-release/changelog": "^6.0.0",
"@semantic-release/git": "^10.0.0",
"@types/node": "^14.16.0",
"@types/vscode": "^1.77.0",
"@typescript-eslint/eslint-plugin": "^4.33.0",
"@typescript-eslint/parser": "^4.33.0",
"eslint": "^7.15.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-jest": "^25.2.2",
"jest": "^26.6.3",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"@types/node": "^20.11.5",
"@types/vscode": "^1.80.0",
"@typescript-eslint/eslint-plugin": "^6.19.0",
"@typescript-eslint/parser": "^6.19.0",
"@vscode/debugadapter-testsupport": "^1.51.0",
"@vscode/debugprotocol": "^1.51.0",
"@vscode/vsce": "^2.22.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.4.1",
"semantic-release": "^20.0.2",
"prettier": "^3.2.4",
"semantic-release": "^23.0.0",
"semantic-release-vsce": "^5.5.3",
"ts-jest": "^26.4.4",
"ts-node": "^10.3.0",
"typescript": "^4.4.4",
"vsce": "^2.15.0",
"vscode-debugadapter-testsupport": "^1.49.0",
"vscode-debugprotocol": "^1.49.0",
"vscode-nls-dev": "^3.3.2",
"ts-node": "^10.9.2",
"typescript": "^5.3.3",
"vitest": "^3.1.1",
"vscode-nls-dev": "^4.0.4",
"vscode-test": "^1.6.1"
},
"icon": "images/icon.png",
Expand Down Expand Up @@ -222,5 +220,6 @@
}
]
]
}
},
"packageManager": "npm@10.2.3"
}
1 change: 0 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
'use strict'

import * as path from 'path'
import * as vscode from 'vscode'
Expand Down
33 changes: 17 additions & 16 deletions src/lrdbDebug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import {
Source,
Handles,
Breakpoint,
} from 'vscode-debugadapter'
import { DebugProtocol } from 'vscode-debugprotocol'
import { readFileSync, existsSync } from 'fs'
import { spawn, ChildProcess } from 'child_process'
import * as path from 'path'
} from '@vscode/debugadapter'
import type { DebugProtocol } from '@vscode/debugprotocol'
import { readFileSync, existsSync } from 'node:fs'
import { spawn, type ChildProcess } from 'node:child_process'
import * as path from 'node:path'
import { LuaWasm, LRDBAdapter, LRDBClient } from 'lrdb-debuggable-lua'

export interface LaunchRequestArguments
Expand Down Expand Up @@ -113,12 +113,12 @@ export class LuaDebugSession extends DebugSession {
// args: DebugProtocol.InitializeRequestArguments
): void {
if (this._debug_server_process) {
this._debug_server_process.kill()
delete this._debug_server_process
this._debug_server_process.kill("SIGABRT")
this._debug_server_process = undefined
}
if (this._debug_client) {
this._debug_client.end()
delete this._debug_client
this._debug_client = undefined
}
if (response.body) {
// This debug adapter implements the configurationDoneRequest.
Expand Down Expand Up @@ -311,10 +311,11 @@ export class LuaDebugSession extends DebugSession {
break
}
}
const bp = <DebugProtocol.Breakpoint>(
new Breakpoint(verified, this.convertDebuggerLineToClient(l))
const bp = new Breakpoint(
verified,
this.convertDebuggerLineToClient(l)
)
bp.id = this._breakPointID++
bp.setId(this._breakPointID++)
breakpoints.push(bp)
if (verified && this._debug_client) {
const sendbreakpoint = {
Expand Down Expand Up @@ -509,7 +510,7 @@ export class LuaDebugSession extends DebugSession {
}
}
const variables: DebugProtocol.Variable[] = []
if (variablesData instanceof Array) {
if (Array.isArray(variablesData)) {
variablesData.forEach((v,i) => {
const typename = typeof v
const k = i + 1
Expand Down Expand Up @@ -596,12 +597,12 @@ export class LuaDebugSession extends DebugSession {
// args: DebugProtocol.DisconnectArguments
): void {
if (this._debug_server_process) {
this._debug_server_process.kill()
delete this._debug_server_process
this._debug_server_process.kill("SIGABRT")
this._debug_server_process = undefined
}
if (this._debug_client) {
this._debug_client.end()
delete this._debug_client
this._debug_client = undefined
}
this.sendResponse(response)
}
Expand All @@ -619,7 +620,7 @@ export class LuaDebugSession extends DebugSession {
const chunk = args.expression
const requestParam = { stack_no: args.frameId, chunk: chunk, depth: 0 }
this._debug_client.eval(requestParam).then((res) => {
if (res.result instanceof Array) {
if (Array.isArray(res.result)) {
const ret = res.result.map(v => stringify(v)).join(' ')
let varRef = 0
if (res.result.length == 1) {
Expand Down
1 change: 0 additions & 1 deletion src/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/

'use strict'

import * as nls from 'vscode-nls'

Expand Down
2 changes: 1 addition & 1 deletion test/__snapshots__/debugadapter.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`Lua Debug Adapter local check local_values 1`] = `
Object {
Expand Down
32 changes: 13 additions & 19 deletions test/debugadapter.test.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
//
// Note: This example test is leveraging the Mocha test framework.
// Please refer to their documentation on https://mochajs.org/ for help.
//

/// <reference types="vitest" />
// The module 'assert' provides assertion methods from node
import * as path from 'path'
import * as path from 'node:path'

// You can import and use all API from the 'vscode' module
// as well as import your extension to test it
import { DebugClient } from 'vscode-debugadapter-testsupport'
//import { DebugProtocol } from 'vscode-debugprotocol'
import { DebugClient } from '@vscode/debugadapter-testsupport'
//import { DebugProtocol } from '@vscode/debugprotocol'

function sequenceVariablesRequest(
dc: DebugClient,
Expand Down Expand Up @@ -44,10 +40,10 @@ function sequenceVariablesRequest(
})
}

// Defines a Mocha test describe to group tests of similar kind together
describe('Lua Debug Adapter', () => {
const DEBUG_ADAPTER = './out/debugAdapter.js'
const PROJECT_ROOT = path.join(__dirname, '../')
// Defines a Vitest test describe to group tests of similar kind together
describe.skip('Lua Debug Adapter', () => {
const DEBUG_ADAPTER =path.join(import.meta.dirname, '../', './out/debugAdapter.js')
const PROJECT_ROOT = path.join(import.meta.dirname, '../')
const DATA_ROOT = path.join(PROJECT_ROOT, 'test/lua/')

let dc: DebugClient
Expand Down Expand Up @@ -100,13 +96,11 @@ describe('Lua Debug Adapter', () => {
test('should stop on entry', async () => {
const PROGRAM = path.join(DATA_ROOT, 'loop_test.lua')
const ENTRY_LINE = 1
const response = Promise.all([
dc.launch({ program: PROGRAM, stopOnEntry: true }),
dc.configurationSequence(),
dc.waitForEvent('stopped'),
dc.assertStoppedLocation('entry', { line: ENTRY_LINE }),
])
await expect(response).resolves.toHaveLength(4)
return Promise.all([
dc.configurationSequence(),
dc.launch({ program: PROGRAM, stopOnEntry: true }),
dc.assertStoppedLocation('entry', { line: ENTRY_LINE }),
]);
})
})

Expand Down
26 changes: 26 additions & 0 deletions vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { defineConfig } from 'vitest/config';
import path from 'path';

export default defineConfig({
test: {
globals: true,
environment: 'node',
include: ['**/__tests__/**/?(*.)+(spec|test).+(ts|tsx|js)', '**/?(*.)+(spec|test).+(ts|tsx|js)'],
exclude: ['**/dist/**/*', '**/out/**/*', '**/node_modules/'],
coverage: {
include: [
'**/src/**/*.{js,jsx,ts,tsx}',
],
exclude: [
'**/node_modules/',
'**/__tests__/**',
'**/__mocks__/**',
'**/examples/**',
'**/examples-*/**',
],
},
alias: {
'~': path.resolve(__dirname, './')
},
},
});