Kode/Kha

Reuse ide completion server for faster builds

RblSb opened this issue · 3 comments

RblSb commented

I think we can read vshaxe.displayPort in Kha vscode extension and pass it to khamake binary as some argument.
Then, if build/project-target.hxml is not changed and completion target equals compilation target, use incremental compilation instead of basic compilation.
As example, using generated hxml task instead of khamake compiles basic Kha project in 0.01s instead of 1.7s for me in html5.

Also some hack to reproduce this if someone interested:

  • Compile with khamake for html5 first
  • Add this to .vscode/settings.json
"haxe.configurations": [
	["--cwd build", "project-html5.hxml"]
]
  • Add this task to .vscode/tasks.json
{
  "type": "haxe",
  "args": "active configuration",
  "group": {
    "kind": "build",
    "isDefault": true
  }
},
  • Change Completion provider from Kha to Haxe and build with this task.
  • If you also launch some live-reload server, you should get instant workflow for this target

Run khamake with the --watch argument?

RblSb commented

Thanks, there is v2 setup, tasks.json:

{
      "type": "shell",
      "command": "node ${command:kha.findKha}/make html5 --watch",
      "isBackground": false,
      "problemMatcher": {
        "pattern": [
          {
            "regexp": ".",
            "file": 1,
            "location": 2,
            "message": 3
          }
        ],
        "background": {
          "activeOnStart": true,
          "beginsPattern": "Haxe compilation...",
          "endsPattern": "Haxe compile end."
        }
      },
      "group": {
				"kind": "build",
				"isDefault": true
			},
      "label": "HTML5-watch"
    },

Lets keep this open and add some watched setups to vscode in future, i think.

RblSb commented
		{
			"name": "HTML5-watch",
			"request": "launch",
			"type": "pwa-node",
			"program": "${command:kha.findKha}/make",
			"args": [
				"html5",
				"--watch",
				"--server",
				"--port",
				"4200",
				"--livereload"
			],
			"killBehavior": "polite"
		},