PB language support for Visual Studio Code

Developed or developing a new product in PureBasic? Tell the world about it.
User avatar
eddy
Addict
Addict
Posts: 1479
Joined: Mon May 26, 2003 3:07 pm
Location: Nantes

Re: PB language support for Visual Studio Code

Post by eddy »

Hi,
I'm working on the following features:
  • code explorer (outline panel on the left)
  • code validation
Update v0.1.2
Image
Imagewin10 x64 5.72 | IDE | PB plugin | Tools | Sprite | JSON | visual tool
Wolfram
Enthusiast
Enthusiast
Posts: 567
Joined: Thu May 30, 2013 4:39 pm

Re: PB language support for Visual Studio Code

Post by Wolfram »

Hi,

I'm using this code to compile on OSX. The Compile works, but the Run not.
What is wrong?

Code: Select all

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Compile (test)",
            "type": "shell",
            "command": "${PUREBASIC_HOME}/compilers/pbcompiler -e myTestApp.app -d -o PB_Editor_CreateExecutable=1 Test_PB.pb",
            "group": {
                "kind": "build",
                "isDefault": true
            }
        },
        {
            "label": "Compile (build)",
            "type": "shell",
            "command": "${PUREBASIC_HOME}/compilers/pbcompiler -e myTestApp.app -o PB_Editor_CreateExecutable=1 Test_PB.pb",
            "group": "build",

            
        },
        {
            "label": "Run",
            "type": "shell",
            "command": "~/Desktop/myTestApp",
            "dependsOn": [
                "Compile (test)"
            ],
            "group": {
                "kind": "test",
                "isDefault": true
            }
        }
    ]
}
macOS Catalina 10.15.7
User avatar
Programie
User
User
Posts: 25
Joined: Thu Aug 09, 2007 11:26 am
Location: Gernsbach (Germany)
Contact:

Re: PB language support for Visual Studio Code

Post by Programie »

Wolfram wrote:Hi,

I'm using this code to compile on OSX. The Compile works, but the Run not.
What is wrong?
AFAIK, the "group" must be a hash containing a "kind" property (just like you already configured for the "Compile (test)" task).
ImageImageImageImage
Wolfram
Enthusiast
Enthusiast
Posts: 567
Joined: Thu May 30, 2013 4:39 pm

Re: PB language support for Visual Studio Code

Post by Wolfram »

I try this but it runs only if I use "Run Task... / Run". It will not start if I use "Run Task... / Compile (test)".
Also I get no debugger output.

Code: Select all

{
            "label": "Run",
            "type": "shell",
            "command": "open 'myTestApp.app'",
            "dependsOn": [
                "Compile (test)"
            ],
            "group": {
                "kind": "test",
                "isDefault": true
            },
            "problemMatcher": []
        }
macOS Catalina 10.15.7
User avatar
chi
Addict
Addict
Posts: 1028
Joined: Sat May 05, 2007 5:31 pm
Location: Linz, Austria

Re: PB language support for Visual Studio Code

Post by chi »

Maybe useful for some MS haters :wink: Eclipse Theia review
Et cetera is my worst enemy
Wolfram
Enthusiast
Enthusiast
Posts: 567
Joined: Thu May 30, 2013 4:39 pm

Re: PB language support for Visual Studio Code

Post by Wolfram »

Here is a working solution vor OSX

Code: Select all

{
    "version": "2.0.0",

    "options": {
        "env": {
            "mainFile" : "myMainFile.pb",
            "appName" : "myAppName",

            "PUREBASIC_HOME": "/Applications/PureBasic_562_x64.app/Contents/Resources",
            }
            },

    "tasks": [
        {
            "label": "Compile (test)",
            "type": "shell",
            "command": "pbcompiler -e ${appName}.app -d -t -f -ibp -o PB_Editor_CreateExecutable=1 ${mainFile}",
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "problemMatcher": [
                "$eslint-compact"
            ]
        },
        {
            "label": "Compile (build)",
            "type": "shell",
            "command": "pbcompiler -e ${appName}.app -t -f -o PB_Editor_CreateExecutable=1 ${mainFile}",
            "group": "build",
            "problemMatcher": []
        },
        {
            "label": "Run",
            "type": "shell",
            "command": "${appName}.app/Contents/MacOS/${appName}",
            "dependsOn": [
                "Compile (test)"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "problemMatcher": []
        }
    ]
}
macOS Catalina 10.15.7
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

Re: PB language support for Visual Studio Code

Post by BarryG »

So how do we compile our PureBasic apps with this? I press F5 and get prompted to select an environment, which Eddy's is already installed (both). Confused.
Wolfram
Enthusiast
Enthusiast
Posts: 567
Joined: Thu May 30, 2013 4:39 pm

Re: PB language support for Visual Studio Code

Post by Wolfram »

BarryG wrote:So how do we compile our PureBasic apps with this? I press F5 and get prompted to select an environment, which Eddy's is already installed (both). Confused.
This is an example of the tasks.json file for OSX.
It seams you are on Windows.
macOS Catalina 10.15.7
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

Re: PB language support for Visual Studio Code

Post by BarryG »

Wolfram wrote:This is an example of the tasks.json file for OSX.
It seams you are on Windows.
I still don't get it. The screenshots are of Windows apps. What is the point of this entire thread? Is it for compiling PureBasic code in Visual Studio Code or not? That's how it appears.
Wolfram
Enthusiast
Enthusiast
Posts: 567
Joined: Thu May 30, 2013 4:39 pm

Re: PB language support for Visual Studio Code

Post by Wolfram »

BarryG wrote:
Wolfram wrote:This is an example of the tasks.json file for OSX.
It seams you are on Windows.
I still don't get it. The screenshots are of Windows apps. What is the point of this entire thread? Is it for compiling PureBasic code in Visual Studio Code or not? That's how it appears.
Visual Studio Code is cross platform and Eddy wrote an plugin for it to be able to write PB code with it.
You can download the plugins over the plugin manager of Visual Studio Code.
To be able to compile the code on macOS too you need to modify the tasks.json.
macOS Catalina 10.15.7
swhite
Enthusiast
Enthusiast
Posts: 726
Joined: Thu May 21, 2009 6:56 pm

Re: PB language support for Visual Studio Code

Post by swhite »

Hi

I installed Visual Studio Code on my Linux PC and then added this extension but when I open a PB file there is no syntax colouring etc. Is it suppose to work in VS Code under Linux?

Thanks,
Simon
Simon White
dCipher Computing
User avatar
jacdelad
Addict
Addict
Posts: 1431
Joined: Wed Feb 03, 2021 12:46 pm
Location: Planet Riesa
Contact:

Re: PB language support for Visual Studio Code

Post by jacdelad »

For my work I have to learn C# now ( :x ) and use Visual Studio Code. I found this extension and became curious. Installing was easy, but I get several errors:
c:\Users\jacde\.vscode\extensions\eddy-r.purebasic-extension-0.1.6\server\out\index.js:33
services_1.Client.connection.workspace.getWorkspaceFolders().then(folders => folders.forEach(folder => {
^

TypeError: Cannot read properties of null (reading 'forEach')
at c:\Users\jacde\.vscode\extensions\eddy-r.purebasic-extension-0.1.6\server\out\index.js:33:94
[Info - 11:18:53] Connection to server got closed. Server will restart.
c:\Users\jacde\.vscode\extensions\eddy-r.purebasic-extension-0.1.6\server\out\index.js:33
services_1.Client.connection.workspace.getWorkspaceFolders().then(folders => folders.forEach(folder => {
^

TypeError: Cannot read properties of null (reading 'forEach')
at c:\Users\jacde\.vscode\extensions\eddy-r.purebasic-extension-0.1.6\server\out\index.js:33:94
[Info - 11:18:54] Connection to server got closed. Server will restart.
c:\Users\jacde\.vscode\extensions\eddy-r.purebasic-extension-0.1.6\server\out\index.js:33
services_1.Client.connection.workspace.getWorkspaceFolders().then(folders => folders.forEach(folder => {
^

TypeError: Cannot read properties of null (reading 'forEach')
at c:\Users\jacde\.vscode\extensions\eddy-r.purebasic-extension-0.1.6\server\out\index.js:33:94
[Info - 11:18:54] Connection to server got closed. Server will restart.
c:\Users\jacde\.vscode\extensions\eddy-r.purebasic-extension-0.1.6\server\out\index.js:33
services_1.Client.connection.workspace.getWorkspaceFolders().then(folders => folders.forEach(folder => {
^

TypeError: Cannot read properties of null (reading 'forEach')
at c:\Users\jacde\.vscode\extensions\eddy-r.purebasic-extension-0.1.6\server\out\index.js:33:94
[Info - 11:18:54] Connection to server got closed. Server will restart.
c:\Users\jacde\.vscode\extensions\eddy-r.purebasic-extension-0.1.6\server\out\index.js:33
services_1.Client.connection.workspace.getWorkspaceFolders().then(folders => folders.forEach(folder => {
^

TypeError: Cannot read properties of null (reading 'forEach')
at c:\Users\jacde\.vscode\extensions\eddy-r.purebasic-extension-0.1.6\server\out\index.js:33:94
[Error - 11:18:54] Connection to server got closed. Server will not be restarted.
...which may be a problem on my side.

My question is: Is this project still under maintenance or given up?
PureBasic 6.04/XProfan X4a/Embarcadero RAD Studio 11/Perl 5.2/Python 3.10
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
Torp
User
User
Posts: 82
Joined: Fri Apr 01, 2005 11:29 am

Re: PB language support for Visual Studio Code

Post by Torp »

It's really a shame that the project is at a standstill.
I saw that there was a Github on the project and I tried to understand how it worked to try to improve it, but in fact I understand nothing... :( :)
real
User
User
Posts: 49
Joined: Fri Oct 08, 2004 5:17 am

Re: PB language support for Visual Studio Code

Post by real »

Hi,

I installed "PureBasic Language" and "PureBasic Extension". Looks nice, but if I try to run my code w/o debugging VSCode says:
"You don't have an extension for debugging purebasic. Should we find a purebasic extension in the Marketplace?"

Maybe I missed something. Could anybody help, please? I'm new to VSCode.

Thanks
René
Windows 7 x64, PureBasic 4.31 & 4.40b4 x86
User avatar
Inner
PureBasic Expert
PureBasic Expert
Posts: 714
Joined: Fri Apr 25, 2003 4:47 pm
Location: New Zealand

Re: PB language support for Visual Studio Code

Post by Inner »

First sorry for nercoing an old thread..
Torp wrote: Tue Mar 28, 2023 11:19 am It's really a shame that the project is at a standstill.
I saw that there was a Github on the project and I tried to understand how it worked to try to improve it, but in fact I understand nothing... :( :)
You're not really missing much to be honest, the process sounds like fun but it's actually counter productive. eg.

Lets use a new editor.

hours later, of trying to get back to what you already had with Pure Basic IDE and failing because MS Visual Code is really a pile of junk and a incomprehensible nightmare that simply doesn't act like an IDE should, you end up back at PB IDE which is far superior if you ask me, visual studio 2022 on the other hand now that's pretty decent but not fit for task however that being compiling Pure Basic code.
Post Reply