Post by bware on Sept 11, 2024 22:28:03 GMT
Anybody uses Visual Studio Code with LB?
Nov 30, 2023 at 7:11pm QuotelikePost OptionsPost by tsh73 on Nov 30, 2023 at 7:11pm
So I guess the answer is - no.
Ok.
A few things I found (until I completely forgot them):
1. On slow computer it is, well, SLOW
If I have a program in LB, I press Shift F5, see compile progress bar, program runs
feels INSTANTLY
Now I have program in Notepad++ with NppExec plugin with command along (check your actual paths)
npp_console off
npp_save
"C:\Program Files\Liberty BASIC v4.5.1\liberty.exe" -r -a $(FULL_CURRENT_PATH) -r -a $(FULL_CURRENT_PATH)
I press Ctrl F6 - I see Liberty basic opens INSTANTLY - see compile progress bar, program runs
same negligible time (less then a second).
But then I press hotkey I configured in Visual Studio code...
I see in Process Explorer 9 (9!) instances of Code.exe
One of them starts
. winpty-agent.exe
It starts
.. powershell.exe
and finally it starts
... liberty.exe
And until Liberty pops up, nothing happens for 2-3 second.
(well, may be not THAT long. But not instant, no way).
Just copied VSC folder to more or less recent computer (Core I3, 8Gb)
What could I say? It works, indeed, INSTANTLY.
2. To make VS Code run program, you create tasks
Here is mine tasks.json.
It is a file in your ".vscode" folder in your project folder
It defines tow tasks, "LB run" and "LB debug"
which you can run via menu Terminal \ Run Task
And exact format of command line cost me some blood.
{
// See go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "LB run",
"type": "shell",
"command": "&'C:\\Program Files\\Liberty BASIC v4.5.1\\liberty.exe'" //' -r -a ${file}"
, "args": [
"-r",
"-a",
"${file}",
]
,"presentation": {
"reveal": "never"
}
//, "isTestCommand": true //CtrlShiftT //does not work
, "group": {
"kind": "test",
"isDefault": true //reset to //Shift F5
}
},
{
"label": "LB debug",
"type": "shell",
"command": "&'C:\\Program Files\\Liberty BASIC v4.5.1\\liberty.exe'" //' -d ${file}"
, "args": [
"-d",
"${file}",
]
,"presentation": {
"reveal": "never"
}
//, "isBuildCommand": true //CtrlShiftB. Said deprecated
, "group": {
"kind": "build",
"isDefault": true //CtrlShiftB.
}
}
]
}
3. You can create hotkey for a task.
Part of keybindings.json:
(interesting is this file is global, while tasks are local for a folder)
{
"key": "alt+F5",
"command": "workbench.action.tasks.runTask", //shows task list, needs ENTER
"args" :"name_of_your_task"
},
But then activated, it shows you name of a task and waits for ENTER
4. BUT there is TWO tasks that did not ask for ENTER.
It is BUILD (default Ctrl Shift B)
so I made ny second task build task
, "group": {
"kind": "build",
"isDefault": true //CtrlShiftB.
}
and now on Ctrl Shift B I have BASIC in debug mode
Second is TEST
, "group": {
"kind": "test",
"isDefault": true //reset to //Shift F5
}
Google says it used to work on Ctrl Shift T but now it is unassigned.
So I went to File\Preferences\Keyboard shortcuts, typed "test" in a search string, and redefined "Tasks: Run Test Task" to Shift F5
And it does work, my current program runs.
and looks like this in keybindings.json:
{
"key": "shift+F5",
"command": "workbench.action.tasks.test" //calls jbr skipping task list
},
5. There is a file compare in VSCode
suppose you want to compare two version of file, say file1 and file2, in your project folder
You open Explorer (part that shows your folder *inside* VSCode), right click first file, "select to compare", right click second one, "compare with selected"
It really might be obvious, but I had to google it now to recall how
6. You can open same file in separate view.
There is "split editor button" right top of editor., it is labeled Ctrl+\, works for me
7. Ctrl+/ works for comment/uncomment
(probably VSCode got right way to comment/uncomment from LibertyBASIC extension)
8. If you click on (...) just right of a filename on a editor title, you will get list of labels/functions/subs
This is from LibertyBASIC extension I pretty sure (I peeked inside files a bit)
9. From what I have read, to get intellisence hints you need language server for this very language.
Making such thing sounds pretty daunting so far.
I tried changing language to VB, it offer me some snippets ("for") but really nothing I would like.
Nov 30, 2023 at 7:11pm QuotelikePost OptionsPost by tsh73 on Nov 30, 2023 at 7:11pm
So I guess the answer is - no.
Ok.
A few things I found (until I completely forgot them):
1. On slow computer it is, well, SLOW
If I have a program in LB, I press Shift F5, see compile progress bar, program runs
feels INSTANTLY
Now I have program in Notepad++ with NppExec plugin with command along (check your actual paths)
npp_console off
npp_save
"C:\Program Files\Liberty BASIC v4.5.1\liberty.exe" -r -a $(FULL_CURRENT_PATH) -r -a $(FULL_CURRENT_PATH)
I press Ctrl F6 - I see Liberty basic opens INSTANTLY - see compile progress bar, program runs
same negligible time (less then a second).
But then I press hotkey I configured in Visual Studio code...
I see in Process Explorer 9 (9!) instances of Code.exe
One of them starts
. winpty-agent.exe
It starts
.. powershell.exe
and finally it starts
... liberty.exe
And until Liberty pops up, nothing happens for 2-3 second.
(well, may be not THAT long. But not instant, no way).
Just copied VSC folder to more or less recent computer (Core I3, 8Gb)
What could I say? It works, indeed, INSTANTLY.
2. To make VS Code run program, you create tasks
Here is mine tasks.json.
It is a file in your ".vscode" folder in your project folder
It defines tow tasks, "LB run" and "LB debug"
which you can run via menu Terminal \ Run Task
And exact format of command line cost me some blood.
{
// See go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "LB run",
"type": "shell",
"command": "&'C:\\Program Files\\Liberty BASIC v4.5.1\\liberty.exe'" //' -r -a ${file}"
, "args": [
"-r",
"-a",
"${file}",
]
,"presentation": {
"reveal": "never"
}
//, "isTestCommand": true //CtrlShiftT //does not work
, "group": {
"kind": "test",
"isDefault": true //reset to //Shift F5
}
},
{
"label": "LB debug",
"type": "shell",
"command": "&'C:\\Program Files\\Liberty BASIC v4.5.1\\liberty.exe'" //' -d ${file}"
, "args": [
"-d",
"${file}",
]
,"presentation": {
"reveal": "never"
}
//, "isBuildCommand": true //CtrlShiftB. Said deprecated
, "group": {
"kind": "build",
"isDefault": true //CtrlShiftB.
}
}
]
}
3. You can create hotkey for a task.
Part of keybindings.json:
(interesting is this file is global, while tasks are local for a folder)
{
"key": "alt+F5",
"command": "workbench.action.tasks.runTask", //shows task list, needs ENTER
"args" :"name_of_your_task"
},
But then activated, it shows you name of a task and waits for ENTER
4. BUT there is TWO tasks that did not ask for ENTER.
It is BUILD (default Ctrl Shift B)
so I made ny second task build task
, "group": {
"kind": "build",
"isDefault": true //CtrlShiftB.
}
and now on Ctrl Shift B I have BASIC in debug mode
Second is TEST
, "group": {
"kind": "test",
"isDefault": true //reset to //Shift F5
}
Google says it used to work on Ctrl Shift T but now it is unassigned.
So I went to File\Preferences\Keyboard shortcuts, typed "test" in a search string, and redefined "Tasks: Run Test Task" to Shift F5
And it does work, my current program runs.
and looks like this in keybindings.json:
{
"key": "shift+F5",
"command": "workbench.action.tasks.test" //calls jbr skipping task list
},
5. There is a file compare in VSCode
suppose you want to compare two version of file, say file1 and file2, in your project folder
You open Explorer (part that shows your folder *inside* VSCode), right click first file, "select to compare", right click second one, "compare with selected"
It really might be obvious, but I had to google it now to recall how
6. You can open same file in separate view.
There is "split editor button" right top of editor., it is labeled Ctrl+\, works for me
7. Ctrl+/ works for comment/uncomment
(probably VSCode got right way to comment/uncomment from LibertyBASIC extension)
8. If you click on (...) just right of a filename on a editor title, you will get list of labels/functions/subs
This is from LibertyBASIC extension I pretty sure (I peeked inside files a bit)
9. From what I have read, to get intellisence hints you need language server for this very language.
Making such thing sounds pretty daunting so far.
I tried changing language to VB, it offer me some snippets ("for") but really nothing I would like.