Hi All,
Recently we are investigating that how to implement BASIC compilation in VS Code extension. I want to share our ideas, and we are very appreciate if you can provide suggestions and ideas.
(The following content is just our initial ideas and design prototypes.)
The main use of compilation is to find out the errors or warnings after code change. User can choose to sync the source code to U2 server or not. If yes, source code and objective code on sever would be overwritten after compilation.
Before using compilation, user needs connect to a U2 server. And we will provide 2 methods to compile BASIC programs.
1. Compile BASIC programs through VS Code task. User can run VS Code default build task to start compilation. We can provide a target files list in the task configuration file, so that multiple BASIC program files in current account folder could be built together.
2. Compile modified BASIC programs.User can right click a file in the editor to display context menu and select "Test compile BASIC program".
Then user can select modified files for compilation.
Restriction:1. Must connect to a U2 server for compilation, because we need the BASIC compiler on server.
2. For complex BASIC program INCLUDE structure, we may not handle it well. If a BASIC program INCLUDEs some other files, user need make sure the included files can be found on U2 server.
3. Compilation arguments are not supported yet.
If you have any ideas and special requirements for compilation, please share with us.
Thanks!
------------------------------
Yunpu Zhao
Software Engineer
Rocket Software
Dalian China
------------------------------
hello,
Thank you to share your project before implement it.
Actually, I do it via terminal and keyshortcut to execute the BASIC program on the current osdirectory - osfile .
{"key": "ctrl+shift+t",
"command": "workbench.action.terminal.sendSequence",
"args": {"text": "uv 'BASIC ${relativeFileDirname} ${fileBasename}'\\u000D" }
}
It works because :
1/
source are synced to the server via :1.a/ I edit the basic code directly on the server (working on the server on RDP session or use vscode RemoteSSH Editing)
1.b/ openSSH run on the server and vscodeExtension 'SFTP' sync the basic source at save event.
2/
my vscodeTerminal location is on the server account's path via :2.a/ I use a powershell session into a vscode Terminal (locally or via remote session)
2.b/ I use a ssh session added at vscodeTerminal
"terminal.integrated.profiles.windows": {
"ssh Server": {
"args": ["user@server"],
"path": "C:\\\\Windows\\\\System32\\\\OpenSSH\\\\ssh.exe"
}
}
So, the first problem is syncing the source code AND his dependancies (INCLUDES).
To achieve it, rmv is already connected on the server via uoj session. I suggest to add .rmv/config/db.mvbasic/sync where we can define a subr (to be defined by user) to call to update the source file
saveToU2(result, file, id, source, options) - the
saveToU2 subroutine update the source file and return a ack/nack with error.
If saveToU2() not defined, rmv write directly on source file.
Then, to perform the compile I suggest to add .rmv/config/db.mvbasic/compile where we can define the VERB and OPTIONS to execute by the task. By default, the VERB'll be "BASIC" .
So, Using a vscodeTask is the best method - we can amend/copi it. Later, we can link the execution to a shortcut.
Then, I suggest to have a 3 types of task
1/ SaveToU2() as a task to save without compile, to handle INCLUDE items updates.
2/ in-place compile of source code to have the new code run'able.
3/ test-compile of the source code under a 'candidate'name to not put it run'able but only to capture the result of the compile and delete the objective code after execution.
It is important you implement 'problemMatcher' to retrieve the result of the BASIC execution into Problems view.
just some ideas.
------------------------------
Manu Fernandes
------------------------------
hello,
Thank you to share your project before implement it.
Actually, I do it via terminal and keyshortcut to execute the BASIC program on the current osdirectory - osfile .
{"key": "ctrl+shift+t",
"command": "workbench.action.terminal.sendSequence",
"args": {"text": "uv 'BASIC ${relativeFileDirname} ${fileBasename}'\\u000D" }
}
It works because :
1/
source are synced to the server via :1.a/ I edit the basic code directly on the server (working on the server on RDP session or use vscode RemoteSSH Editing)
1.b/ openSSH run on the server and vscodeExtension 'SFTP' sync the basic source at save event.
2/
my vscodeTerminal location is on the server account's path via :2.a/ I use a powershell session into a vscode Terminal (locally or via remote session)
2.b/ I use a ssh session added at vscodeTerminal
"terminal.integrated.profiles.windows": {
"ssh Server": {
"args": ["user@server"],
"path": "C:\\\\Windows\\\\System32\\\\OpenSSH\\\\ssh.exe"
}
}
So, the first problem is syncing the source code AND his dependancies (INCLUDES).
To achieve it, rmv is already connected on the server via uoj session. I suggest to add .rmv/config/db.mvbasic/sync where we can define a subr (to be defined by user) to call to update the source file
saveToU2(result, file, id, source, options) - the
saveToU2 subroutine update the source file and return a ack/nack with error.
If saveToU2() not defined, rmv write directly on source file.
Then, to perform the compile I suggest to add .rmv/config/db.mvbasic/compile where we can define the VERB and OPTIONS to execute by the task. By default, the VERB'll be "BASIC" .
So, Using a vscodeTask is the best method - we can amend/copi it. Later, we can link the execution to a shortcut.
Then, I suggest to have a 3 types of task
1/ SaveToU2() as a task to save without compile, to handle INCLUDE items updates.
2/ in-place compile of source code to have the new code run'able.
3/ test-compile of the source code under a 'candidate'name to not put it run'able but only to capture the result of the compile and delete the objective code after execution.
It is important you implement 'problemMatcher' to retrieve the result of the BASIC execution into Problems view.
just some ideas.
------------------------------
Manu Fernandes
------------------------------
Hi Manu,
Thanks for your suggestions and sharing! Your suggestions are very helpful to us.
------------------------------
Yunpu Zhao
Software Engineer
Rocket Software
Dalian China
------------------------------