Skip to content

Commit

Permalink
Put Arguments and Util together
Browse files Browse the repository at this point in the history
  • Loading branch information
yuxiaomao committed Mar 28, 2024
1 parent 513af49 commit 63227c9
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 18 deletions.
15 changes: 0 additions & 15 deletions src/Arguments.hx

This file was deleted.

1 change: 1 addition & 0 deletions src/Extension.hx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import js.lib.Promise;
import vscode.*;
import Utils;

class Extension {
@:expose("activate")
Expand Down
5 changes: 3 additions & 2 deletions src/HLAdapter.hx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import haxe.CallStack;
import Utils;

import vscode.debugProtocol.DebugProtocol;
import vscode.debugAdapter.DebugSession;
Expand Down Expand Up @@ -1066,11 +1067,11 @@ class HLAdapter extends DebugSession {
// Communicate with Extension

#if vscode
public function formatInt( args:Util.VariableContextCommandArg ) {
public function formatInt( args:VariableContextCommandArg ) {
var i = Std.parseInt(args.variable.value);
if (i == null)
return;
Vscode.window.showInformationMessage(args.variable.name + "(" + i + ") = 0x" + Util.toString(i,16) + " = 0b" + Util.toString(i,2));
Vscode.window.showInformationMessage(args.variable.name + "(" + i + ") = 0x" + Utils.toString(i,16) + " = 0b" + Utils.toString(i,2));
}
#end

Expand Down
17 changes: 16 additions & 1 deletion src/Util.hx → src/Utils.hx
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
typedef Arguments = {
cwd:String,
classPaths:Array<String>,
?hl:String,
?env:haxe.DynamicAccess<String>,
?program:String,
?args:Array<String>,
?argsFile:String,
?port:Int,
?hotReload:Bool,
?profileSamples:Int,
?allowEval:Bool
}

typedef Container = {
var name : String;
var variablesReference : Int;
Expand All @@ -11,11 +25,12 @@ typedef VariableContextCommandArg = {
var variable : vscode.debugProtocol.DebugProtocol.Variable;
}

class Util {
class Utils {

inline public static function toString(value:Int, base:Int):String {
#if js
return untyped value.toString(base);
#end
}

}

0 comments on commit 63227c9

Please sign in to comment.