PB language support for Visual Studio Code

Developed or developing a new product in PureBasic? Tell the world about it.
User avatar
Kiffi
Addict
Addict
Posts: 1353
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Re: PB language support for Visual Studio Code

Post by Kiffi »

eddy wrote:I published the Purebasic extension for VS Code. :D
Congratulations!

Install count + 1 :D
Hygge
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 »

eddy wrote:I published the Purebasic extension for VS Code. :D
I just installed it, too. Thanks for your great work!

I'm looking forward to using vscode as my PB IDE instead of the official one once the most important features like auto completion are fully implemented.

I just have one minor issue: Is the indention hard coded to "Tab Size: 3"? Because I can't find any settings for that. I used spaces instead of tabs in other languages and currently have the PB IDE configured to use 2 spaces for indention. How to configure vscode to use (2) spaces instead of tabs without having to configure that per file?
ImageImageImageImage
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 »

How to change Tab size
  • Press F1
  • Enter "settings"
  • Select Open Settings
  • Enter "tab size"
This will change Tab Size global setting.

Image
Last edited by eddy on Sun Dec 09, 2018 4:29 pm, edited 2 times in total.
Imagewin10 x64 5.72 | IDE | PB plugin | Tools | Sprite | JSON | visual tool
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 »

eddy wrote:How to change Tab size
  • Press F1
  • Enter "settings"
  • Select Open Settings
  • Enter "tab size"
I know that. I've already changed tabs to spaces for vscode and it's working fine for other files. But once I open a file containing PB code, the tab size is set to 3 for that file. I have to manually change it per file every time.
ImageImageImageImage
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 »

Programie wrote:
eddy wrote:How to change Tab size
  • Press F1
  • Enter "settings"
  • Select Open Settings
  • Enter "tab size"
I know that. I've already changed tabs to spaces for vscode and it's working fine for other files. But once I open a file containing PB code, the tab size is set to 3 for that file. I have to manually change it per file every time.
I declared some custom parameters for Purebasic. You can change PureBasic Tab Size setting as follows :

Image
Imagewin10 x64 5.72 | IDE | PB plugin | Tools | Sprite | JSON | visual tool
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 »

Oh yes, I just found them, too. Weird, there is not category "PureBasic", just "PureBasic configuration" bellow "Extensions" which only allows me to change a few other settings. Maybe that's caused because the name is surrounded by brackets? It's named "[purebasic]" instead of "purebasic".
ImageImageImageImage
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 »

In this case, I wonder if it's a good idea to have PureBasic Tab Size setting ?
:?
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 »

Do you think there is a way to install it in Visual Studio Code on OSX?
macOS Catalina 10.15.7
User avatar
IceBite
New User
New User
Posts: 3
Joined: Tue Apr 10, 2018 8:18 am
Location: Essen

Re: PB language support for Visual Studio Code

Post by IceBite »

Ty for the great work,

i just have one question, how do i compile/run/debug in visual studio code or am i only able to edit the code in vsc and compile it in purebasic itself ?

greetings Fabian
User avatar
GG
Enthusiast
Enthusiast
Posts: 256
Joined: Tue Jul 26, 2005 12:02 pm
Location: Lieusaint (77), France

Re: PB language support for Visual Studio Code

Post by GG »

Hi all,

Is it possible to configure inside VS Code to be able to call PB Compiler directly from Visual Code ?
Purebasic 6.04 64 bits - Windows 11 Pro 64 bits 23H2
User avatar
NicTheQuick
Addict
Addict
Posts: 1223
Joined: Sun Jun 22, 2003 7:43 pm
Location: Germany, Saarbrücken
Contact:

Re: PB language support for Visual Studio Code

Post by NicTheQuick »

I am always using real tabs instead of spaces, is this also possible? I have to check out your extension tomorrow.
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
Everything
Enthusiast
Enthusiast
Posts: 224
Joined: Sat Jul 07, 2018 6:50 pm

Re: PB language support for Visual Studio Code

Post by Everything »

I like VSCode, for cpp and c# it's the best choice but with PB syntax I expected to see usual code styling (bold\highlighted keywords similar to PB IDE).
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 »

GG wrote:Is it possible to configure inside VS Code to be able to call PB Compiler directly from Visual Code ?
I'm using Tasks of vscode for that.

tasks.json of one of my projects (stored in .vscode/tasks.json inside the project folder):

Code: Select all

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Compile (test)",
            "type": "shell",
            "command": "${PUREBASIC_HOME}/compilers/pbcompiler --executable src/purebasic_compilation0.out --debugger --constant PB_Editor_CreateExecutable=0 src/gui.pb",
            "group": {
                "kind": "test"
            }
        },
        {
            "label": "Compile (build)",
            "type": "shell",
            "command": "${PUREBASIC_HOME}/compilers/pbcompiler --executable keyboard-mapper --constant PB_Editor_CreateExecutable=1 src/gui.pb",
            "group": {
                "kind": "build",
                "isDefault": true
            }
        },
        {
            "label": "Run",
            "type": "shell",
            "command": "src/purebasic_compilation0.out",
            "dependsOn": [
                "Compile (test)"
            ],
            "group": {
                "kind": "test",
                "isDefault": true
            }
        }
    ]
}
ImageImageImageImage
User avatar
GG
Enthusiast
Enthusiast
Posts: 256
Joined: Tue Jul 26, 2005 12:02 pm
Location: Lieusaint (77), France

Re: PB language support for Visual Studio Code

Post by GG »

Thanks a lot Programie !
Adapted for my needs under Windows from your example; it works well :

Code: Select all

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Compile (test)",
            "type": "shell",
            "command": "d:\\Applications\\PureBasic\\compilers\\pbcompiler /exe gencalend.exe /debugger /constant PB_Editor_CreateExecutable=0 /constant PB_Editor_CompileCount=1 gencalend.pb",
            "group": {
                "kind": "build",
                "isDefault": true
            }
        },
        {
            "label": "Compile (build)",
            "type": "shell",
            "command": "d:\\Applications\\PureBasic\\compilers\\pbcompiler /exe gencalend.exe /constant PB_Editor_CreateExecutable=1 /constant PB_Editor_CompileCount=1 gencalend.pb",
            "group": "build"
        },
        {
            "label": "Run",
            "type": "shell",
            "command": "gencalend.exe",
            "dependsOn": [
                "Compile (test)"
            ],
            "group": {
                "kind": "test",
                "isDefault": true
            }
        }
    ]
}
Purebasic 6.04 64 bits - Windows 11 Pro 64 bits 23H2
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,

Thanks GG and Programie, I'll use your code to add "Create PB project" command :D

I've done no progress for my other tasks ... lack of time or motivation :oops:

I'm searching an example coded in typescript :
- to implement autocompletion
- to retrieve PB keywords by using a compiler command line
Imagewin10 x64 5.72 | IDE | PB plugin | Tools | Sprite | JSON | visual tool
Post Reply