Skip to content

Commit 532edf4

Browse files
committed
vscode-extension: strict and erasable typescript
1 parent dafe2d1 commit 532edf4

File tree

8 files changed

+1440
-758
lines changed

8 files changed

+1440
-758
lines changed

vscode-extension/package-lock.json

Lines changed: 1343 additions & 685 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vscode-extension/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@
3636
"vscode": "^1.82.0"
3737
},
3838
"devDependencies": {
39-
"@types/node": "^18.19.48",
39+
"@types/node": "^18.19.79",
4040
"@types/vscode": "^1.82.0",
41-
"@vscode/vsce": "^3.0.0",
41+
"@vscode/vsce": "^3.2.2",
4242
"json5": "^2.2.3",
43-
"ts-loader": "^9.5.1",
44-
"typescript": "^5.5.4",
45-
"webpack": "^5.94.0",
46-
"webpack-cli": "^5.1.4"
43+
"ts-loader": "^9.5.2",
44+
"typescript": "^5.8.2",
45+
"webpack": "^5.98.0",
46+
"webpack-cli": "^6.0.1"
4747
},
4848
"activationEvents": [
4949
"onDebugInitialConfigurations",
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
declare module "json5/dist/index.mjs";

vscode-extension/src/main/ts/extension.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import SWFDebugConfigurationProvider from "./utils/SWFDebugConfigurationProvider
1919
import SWFDebugAdapterDescriptorFactory from "./utils/SWFDebugAdapterDescriptorFactory";
2020
import * as vscode from "vscode";
2121

22-
let savedContext: vscode.ExtensionContext = null;
22+
let savedContext: vscode.ExtensionContext | null | undefined = null;
2323

2424
export function activate(context: vscode.ExtensionContext) {
2525
savedContext = context;
@@ -42,7 +42,7 @@ export function activate(context: vscode.ExtensionContext) {
4242
context.subscriptions.push(
4343
vscode.debug.registerDebugAdapterDescriptorFactory(
4444
"swf",
45-
new SWFDebugAdapterDescriptorFactory(savedContext, debugPathsCallback)
45+
new SWFDebugAdapterDescriptorFactory(context, debugPathsCallback)
4646
)
4747
);
4848
}
@@ -51,7 +51,10 @@ export function deactivate() {
5151
savedContext = null;
5252
}
5353

54-
function debugPathsCallback() {
54+
function debugPathsCallback(): {
55+
javaPath: string | null | undefined;
56+
sdkPath?: string | null | undefined;
57+
} {
5558
let sdkPath = undefined;
5659
let as3mxmlExtension = vscode.extensions.getExtension(
5760
"bowlerhatllc.vscode-as3mxml"
@@ -64,6 +67,9 @@ function debugPathsCallback() {
6467
.getConfiguration("as3mxml")
6568
.get("java.path") as string;
6669
let javaPath = findJava(javaPathSetting, (foundJavaPath) => {
70+
if (!savedContext) {
71+
return false;
72+
}
6773
return validateJava(savedContext.extensionPath, foundJavaPath);
6874
});
6975

vscode-extension/src/main/ts/utils/SWFDebugAdapterDescriptorFactory.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,23 @@ import * as vscode from "vscode";
1818
import getJavaClassPathDelimiter from "../utils/getJavaClassPathDelimiter";
1919

2020
export type SWFDebugAdapterPathsCallback = () => {
21-
javaPath: string;
22-
sdkPath?: string;
21+
javaPath: string | null | undefined;
22+
sdkPath?: string | null | undefined;
2323
};
2424

2525
export default class SWFDebugAdapterDescriptorFactory
2626
implements vscode.DebugAdapterDescriptorFactory
2727
{
2828
constructor(
29-
public extensionContext: vscode.ExtensionContext,
30-
public pathsCallback: SWFDebugAdapterPathsCallback
31-
) {}
29+
extensionContext: vscode.ExtensionContext,
30+
pathsCallback: SWFDebugAdapterPathsCallback
31+
) {
32+
this.extensionContext = extensionContext;
33+
this.pathsCallback = pathsCallback;
34+
}
35+
36+
extensionContext: vscode.ExtensionContext;
37+
pathsCallback: SWFDebugAdapterPathsCallback;
3238

3339
createDebugAdapterDescriptor(
3440
session: vscode.DebugSession,

0 commit comments

Comments
 (0)