Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
RobDangerous committed Mar 21, 2021
1 parent 15a30c9 commit 5c8743a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 14 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
### 21.3.7

* Make things work with vshaxe 2.23.0
* Update Kha

### 21.3.7

* Pimp macOS support
* Update Kha

Expand Down
25 changes: 13 additions & 12 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,18 @@ function compile(target, silent) {
});
}

let KhaHaxeInstallationProvider = {
activate: (provideInstallation) => {
provideInstallation({
haxeExecutable: path.join(findKha(), 'Tools', 'haxe', 'haxe' + sys()),
haxelibExecutable: null,
standardLibraryPath: path.join(findKha(), 'Tools', 'haxe', 'std')
});
},

deactivate: () => {}
}

let KhaDisplayArgumentsProvider = {
init: (api, activationChangedCallback) => {
this.api = api;
Expand Down Expand Up @@ -139,33 +151,22 @@ function sys() {
}
}

function updateHaxe(vshaxe) {
vshaxe.haxeExecutable.configuration.executable = path.join(findKha(), 'Tools', 'haxe', 'haxe' + sys());
vshaxe.haxeExecutable.configuration.isCommand = false;
vshaxe.haxeExecutable.configuration.env = {
'HAXE_STD_PATH': path.join(findKha(), 'Tools', 'haxe', 'std')
};
vshaxe.haxeExecutable._onDidChangeConfiguration.fire(vshaxe.haxeExecutable.configuration);
}

function configureVsHaxe(rootPath) {
let vshaxe = vscode.extensions.getExtension('nadako.vshaxe').exports;
KhaDisplayArgumentsProvider.init(vshaxe, (active) => {
if (!active) return;

const hxmlPath = path.join(rootPath, 'build', 'project-debug-html5.hxml');
if (fs.existsSync(hxmlPath)) {
updateHaxe(vshaxe);
updateHaxeArguments(rootPath, hxmlPath);
}
else {
compile('debug-html5', true).then(() => {
updateHaxe(vshaxe);
updateHaxeArguments(rootPath, hxmlPath);
});
}
});
updateHaxe(vshaxe);
vshaxe.registerHaxeInstallationProvider('Kha', KhaHaxeInstallationProvider);
vshaxe.registerDisplayArgumentsProvider('Kha', KhaDisplayArgumentsProvider);
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "kha",
"displayName": "Kha",
"description": "Kha support",
"version": "21.3.7",
"version": "21.3.8",
"publisher": "kodetech",
"engines": {
"vscode": "^1.31.0"
Expand Down

0 comments on commit 5c8743a

Please sign in to comment.