VSCode Extension for Cerberus

Ferdi

Member
3rd Party Target Dev
Joined
Jun 21, 2017
I had a quick look at how to add a debugger for CX in VS Code very quickly. I glanced at https://code.visualstudio.com/api/extension-guides/debugger-extension but that article just uses a mock debugger. That mock debugger does not show how to create a CX debugger for VS Code.

But I did find this article: https://www.codemag.com/article/1809051/Writing-Your-Own-Debugger-and-Language-Extensions-with-Visual-Studio-Code (Part 3). It seems we need to pass the correct data in via TCP IP 127.0.0.1? I am guessing, the correct data is generated by the "transcc"? Looks like it is not easy to create a debugger.

Anyway, reference links:
Part 1: https://www.codemag.com/article/1607081
Part 2: https://www.codemag.com/article/1711081
Part 3: https://www.codemag.com/article/1809051/Writing-Your-Own-Debugger-and-Language-Extensions-with-Visual-Studio-Code
Github: https://github.com/vassilych
CSCS debugger GitHub: https://github.com/vassilych/cscs-debugger

@adamredwoods thanks for this! It is a really good extension.
 

adamredwoods

Member
3rd Party Tool Dev
Joined
Jun 23, 2017
Updated: 0.9.2
- Right-click context menu for build commands.
- Trans build errors now register in VSCode (red underline and can be highlighted under 'Problems') - this is just a first pass, let me know if you encounter problems.

Screen Shot 2019-11-14 at 2.45.06 PM.png


BTW-- I am using VSCodium for all this. Works the same as VSCode.
 
Last edited:

MikeHart

Administrator
Joined
Jun 19, 2017
Location
Germany
As adam seems not to be working on it anymore, this extention seems quite advanced and could be a good base for a cerberus version:

 

Holzchopf

Moderator
3rd Party Module Dev
Joined
Jul 31, 2017
Location
Bern, Switzerland
I'm testing Adam's Cerberus-VSCodeExtension now. And it works, which is good.

@adamredwoods you don't have a license included in your repo. Could you add one? (Preferably MIT but since it's your work, it's your decision. But no license at all is uncool ;) )
 

Holzchopf

Moderator
3rd Party Module Dev
Joined
Jul 31, 2017
Location
Bern, Switzerland
Ok. I've downloaded the two extensions. Hezkore's BlitzMax support is sophisticated and will help a lot in improving the CX extension, but it's imho way over the top. E.g. it comes with it's own doc builder. Providing the Cerberus X documentation in VS Code should be a goal, but cerainly is achievable by including the already existing html files in Cerberus' installation path.

Right now I'm trying to make my own extension - just for learning. I'm sure Adam's extension can be extended, but I have to find out how.

@Everyone: Have you used that extension? Any known issues? So far I came across:
- single-line comment-char (') is defined as auto-closing
- indentation rules not working properly (i.e. case-sensitive and not triggering on if...then)
- there seems to be no option for just "rebuild" (without opening a new tab)

The first things I'd like to tackle (apart from above mentioned issues) are:
- Webview for docs
- Auto-Capitalisation for CX language keywords
 

MikeHart

Administrator
Joined
Jun 19, 2017
Location
Germany
Regarding the docs, please talk to @Phil7 if he is making changes that could interfear with that. And i wouldn't see any harm done to provide extra stuff for VSCode out of MakeDocs.
 

Phil7

Administrator
CX Code Contributor
3rd Party Tool Dev
Joined
Jun 26, 2017
- single-line comment-char (') is defined as auto-closing
I guess these should be grave accents ( ` ) for character literals!? It's in "language-configuration.json" I think.
 

Holzchopf

Moderator
3rd Party Module Dev
Joined
Jul 31, 2017
Location
Bern, Switzerland
I guess these should be grave accents ( ` ) for character literals!? It's in "language-configuration.json" I think.
That's correct.

Further, I have the feeling that the reason for the separate doc parsing in Hezkore's extension stems from the restrictions that come with webviews =/ I cannot just point to PATHTOCERBERUS/docs/html/Home.html and everything's fine, because that would just be too perfect...
 

Holzchopf

Moderator
3rd Party Module Dev
Joined
Jul 31, 2017
Location
Bern, Switzerland
Well, displaying the generated html docs won't work (links are not working, images don't load. There are further security concerns mentioned from VS Code's side.)

From what I can see now, there are these options:
  • Either the extension re-parses the generated html docs (kinda sucks and will break once the doccer's output format changes),
  • or the extension does the doccing on its own (won't happen, because otherwise we would have two doccers to maintain)
  • or there just won't be any in-editor help provided.
  • Or we* adapt the doccer in a manner, so it also generates a manual.json or whatever that's then easy to parse by the extension and provide the in-editor help based on that. Since makedocs already is able to output a tree.txt, formatting that as json should be an easy task.

* I could do that. @Phil7 I heard you're working on the docs. This only includes the documentation itself, not makedocs, right?
 

Phil7

Administrator
CX Code Contributor
3rd Party Tool Dev
Joined
Jun 26, 2017
@Phil7 I heard you're working on the docs. This only includes the documentation itself, not makedocs, right?
I had some ideas about makedocs, like I wrote you some time ago, but my main focus is on content right now. So go ahead, I won't disturb you with this. At least not without asking ;)
 

Podge

New Member
Joined
Nov 10, 2019
This is very cool, great work mate. Is it possible to have a code tree, visible that lets you jump to methods and functions?
 

adamredwoods

Member
3rd Party Tool Dev
Joined
Jun 23, 2017
I couldn't think of a way to do auto-caps, I don't think modern IDEs change text as one types. It could be done on saving, which is how eslint works (as a parameter option).

The in-window docs can be done using a node-tree view. I'll see if I can look into this.

Feel free to make pull requests or log issues on github! :D
 

adamredwoods

Member
3rd Party Tool Dev
Joined
Jun 23, 2017
I should mention, it's possible to use the VSCodium (VSCode) debugger for html (compiled code):
Add the "Debugger for Chrome" extension, then just click on the debugger option and add a new entry (click on the gear) to your launch.json file:

Cerberus X:
{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "chrome",
            "request": "launch",
            "name": "Launch Chrome against localhost",
            "url": "http://localhost:65341/CerberusGame.html",
            "webRoot": "${workspaceFolder}"
        }
    ]
}
Click on the arrow (maybe select the above name in the dropdown). This will run in it's own window. You may have to compile once (yes, it's messy for now, but it works!).
Then PAUSE on the debugger and step through! Breakpoints seem to work, and typing in a variable to see it's value works! You may have to click on the new window to get the debugger to trigger (this could be improved).

Screen Shot 2020-07-03 at 4.02.24 PM.png
 
Last edited:

adamredwoods

Member
3rd Party Tool Dev
Joined
Jun 23, 2017
I'm very slow and will not check in every day. Just very busy with work, and housework, and family, and everything. If someone else wants to take over the extension, feel free, I'll help where I can! Or just make GitHub pulls and I'll update it.
 

Holzchopf

Moderator
3rd Party Module Dev
Joined
Jul 31, 2017
Location
Bern, Switzerland
Hi adam. I understand you're busy and you cannot spend every day on here. The reasons why I started working on a separate extension were:
1. I wanted to find out whether a vscode.Webview could be used to display the docs. I never worked on an extension before, so I needed a clean playground first. It now kinda turned into a separate extension. It's nowhere near the capabilities or functionality of yours - but it has a DocumentSymbolProvider (for the outline) and I got the doc displaying in a webview working
2. There's no proper LICENSE.md file. This is crucial to me. I have one workstation, which I use for my personal stuff and work stuff. Sometimes even the same accounts. I have a certain responsibility towards my company. And I (we) can't, ABSOLUTELY. CAN. NOT., risk anything by building a project on copyrighted source without license or a wrong/incorrect/bad license. Heck, I don't even touch GNU GPL sources. I hope you understand that and forgive me for not pushing my versions of indentation and auto-closing rules into your repo.

Oh and btw: You're already helping a lot! My "I don't want to build on certain source codes" doesn't mean I can't look into them as reference - and yours is by far easier to read to me than hezkore's BlitzMax extension. And yes, I know there's a VS Code Extension writing guide and reference page out there. But when you come across functions that aren't documented properly (no examples, or (and I shit you not) when the overload function just says "read the article of the base function" and the base function just says "read the article of the overload") or where the docs haven't been updated since the last breaking changes, you suddenly prefer reading someone's code over the official docs...
 
Top Bottom