Love to stay open on error and give output to the VSCode output(or: How to set up Love for VScode)

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
matjojo
Prole
Posts: 8
Joined: Sat Dec 24, 2016 9:43 am
Location: The Netherlands

Love to stay open on error and give output to the VSCode output(or: How to set up Love for VScode)

Post by matjojo »

I've been trying to set up Love again for VScode on my new computer. I used to use this tasks.json file:

Code: Select all

// Available variables which can be used inside of strings.
// ${workspaceRoot}: the root folder of the team
//snip

{
    // The command is the path to your love install exe.
    "command": "C:\\Program Files\\LOVE\\love.exe",
 
    // The command is a shell script
    "type": "shell",
 
    // args are appended onto the command run, just like a batch file
	"args": ["${workspaceRoot}"],
	
    "version": "2.0.0",
    "group": {
        "kind": "build",
        "isDefault": true
    }
}
This used to work completely, Lua would pass on the console output to the tasks console in VScode, and it would stay open after it had crashed.
On my new install output is not pushed to the vscode tasks console, and Love closes immideately, there is no way for me to see the error that has occured, since there is no recollection of the error anywhere. I've thought of using a permanent commandline that I use to execute my love install, but that just takes a lot of time, alt tabbing to the commandline and executing. Plus I know that this has worked before, so I should be able to fix it.

As a secondary question, is there a vscode plugin for API intellisense? The only plugins I've seen where very rudimentory, and didn't seem to work well. (most of them promised the above usabillity but didn't work.)

Quick ninja edit: I had and thus have LUA set up to buffer as little as possible using

Code: Select all

io.stdout:setvbuf("no")
This should not be the problem, since once again this used to work, but it doesn't anymore.
User avatar
keharriso
Citizen
Posts: 98
Joined: Fri Nov 16, 2012 9:34 pm

Re: Love to stay open on error and give output to the VSCode output(or: How to set up Love for VScode)

Post by keharriso »

Does messing with love.errorhandler or

Code: Select all

t.console = true
in conf.lua do anything? I don't actually use VSCode, so that's the extent of my ability to help here.
LÖVE-Nuklear - a lightweight immediate mode GUI for LÖVE games
matjojo
Prole
Posts: 8
Joined: Sat Dec 24, 2016 9:43 am
Location: The Netherlands

Re: Love to stay open on error and give output to the VSCode output(or: How to set up Love for VScode)

Post by matjojo »

I fixed the problem of not getting the output in vscode this way:

In conf I need to do `conf.console = true`

my tasks.json now looks like this:

Code: Select all

// --Available variables which can be used inside of strings.
// --${workspaceRoot}: the root folder of the team
// --${file}: the current opened file
// --${fileBasename}: the current opened file's basename
// --${fileDirname}: the current opened file's dirname
// --${fileExtname}: the current opened file's extension
// --${cwd}: the current working directory of the spawned process
{    
    "version": "2.0.0",
    "tasks": [
        {
            "label": "LOVE",
            // The command is the path to your love install exe.
            "command": "C:\\Program Files\\LOVE\\love.exe",
            // args are appended onto the command run, just like a batch file
            "args": ["${workspaceRoot}"],        
        
            // The command is a shell script, and not just a normal command
            "type": "process",
        
            "presentation": {
                "echo": true,
                "reveal": "always",
                "focus": true,
                "panel": "shared",
                "showReuseMessage": true,
                "clear": false
            },
            

            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}
The key was in the execution method. Since Love does not return outputs to the calling console, but spawns it's own console window, you need to set the type to "process", this makes sure that VScode searches for a spawned console and grabs that one as the output to show.

The other problem still stays, I installed "bschulte.love" as API extension, but the extensions only works sometimes, and doesn't do a good job of appearing when I need it. I have no idea how to fix this. I will try other intellisense plugins later.

The windows, both console and love.window, still close directly on an error. This is with the console output cloning not a direct problem, but still not ideal.

Is there some setting I could use that would allow love to print to a console if called from one, and otherwise not do that? That would allow the tasks integration to be a bit easier.
Post Reply

Who is online

Users browsing this forum: No registered users and 94 guests