Visual Studio Code RAM Calculator + Extra

Hello, i am leaving here the Visual Studio Code Dynamic RAM calculation extension for typescript/pure javascript compatible (derivatives like flowscript not tested but should work) i was working on.

Features:

  • Dynamic RAM Calculation (Shows in the status bar)

  • Import RAM Usage

  • RAM breakdown of functions used

  • Can calculate the RAM for all Bitburner API

  • Automatic generation of .ns files with all imports with .ns extension (opt-in)

Download: http://www.mediafire.com/file/j9k5djdmot8hyek/netscript2-memory-counter-1.0.7.vsix/file

Release Notes:

  • 1.0.7 17/05/2019

    • Improved 10x code analysis times by using a dedicaded parser
    • Fixed some more problems with imports that contain directories (ej: lib\script)
    • Updated to Bitburner v0.47.0
    • Removed Netscript2Mem.insideBitNode4 configuration as the singularity functions now don't have distinction between BitNodes
  • 1.0.6 11/05/2019

    • Fix: Overloads of a function were counting the ram eg: scp
    • Fix: Use same type of quotes when generating .ns files instead of assuming "
    • Changed back to integer costs of functions internally to prevent possible errors with floats due to decimal costs
    • Changed code analysis from exponential recursive to iterative recursive to prevent possible stack overflows in very nested code and improve performance (3ms -> 1ms), code parsing times remain the same.
  • 1.0.5 03/05/2019

    • Added .ns to default extensions to parse through.
    • Fixed problem with decimal cost functions reporting incorrect RAM usage
  • 1.0.4 03/05/2019

    • Fixed hacknet.spendHashes() function
    • Modified .ns file creation to pure node solution because visual studio code was sloopy on saving files and sometimes leaved saved .ns files inside the editor. (Because it doesn't have any real file save/close API outside of some hackish workarounds)
    • Added Extension logo image
  • 1.0.3 29/04/2019 - Fixed some problems with imports that contain directories (ej: lib\script.js)

  • 1.0.2 25/04/2019 - Added window and document variable cost

  • 1.0.1 25/04/2019 - Fixed duplicate cost of most functions

Installation instruction:

  • Copy the extension file to the root of your project/workspace

  • Inside VS Code Terminal type: code --install-extension netscript2-memory-counter-1.0.7.vsix

  • Restart VS Code or Reload Window through the command palette.

Notes:

  • You can open the new terminal with: Terminal -> New Terminal

  • If you already have terminal open, verify that is on "cmd" and not on any other running task.


Typescript definition file with jsdoc comments: Updated 17/05/2019

https://www.mediafire.com/file/sr7wlonxe1d64dg/Bitburner.t.ts/file

Usage Typescript Netscript2:

import {BitBurner as NS} from "Bitburner";
export async function main (ns: NS) {
}

Credits:

https://github.com/Alxandr/bitburner

For having a Barebones (Actually updated at it's time, definition file for Typescript)



Extras:

Ace Monokai dark theme, some colors are exactly the same, some were slightly modified.

Download: https://www.mediafire.com/file/rb5m52f5uijp1mo/netscript2-theme-1.0.0.vsix/file

Installation instruction: See above.

Use:

After the installation inside: File -> Preferences -> Settings -> Workbench: Color Theme, select Netscript 2.0


Netscript2 Textmate grammar extension

Features:

  • Allows to customize negative "-" color inside negative numbers. (Already has a rule for that in the theme above)

Known Issues:

  • Catches "-" inside comments.

Download: https://www.mediafire.com/file/766hep23h2cmamr/netscript2-grammar-1.0.0.vsix/file

Installation instruction: See above.



Extras2:

If you want your ns variable to be highlighted then install TODO highlight.

Link: https://marketplace.visualstudio.com/items?itemName=wayou.vscode-todo-highlight

With these configuration parameters:

  • "search.usePCRE2": true, //Allow usage of more complex regex, like back references.

  • "todohighlight.keywordsPattern": "(?<=\s|\()ns(?=\.)", //May sometimes catch ns inside comments but otherwise should color it correctly in 99% of the times.

  • "todohighlight.defaultStyle": {"backgroundColor": "#0000", "color": "#7FFF00"}, //Green color with no background color.


Local http fileserver (WARNING THE FILESERVER IS PUBLIC) with CORS so that you can wget your local files from the game. //I dont remember where i got it but it was a long search.

Link: https://www.mediafire.com/file/8m71bjm7b9bczgr/webserver.js/file

Use:

Inside package.js add:

"scripts": {
    "webserver": "node [SCRIPT DIRECTORY]webserver.js -p [PORT NUMBER] -d [DIRECTORY TO SHARE] --enable_cors"
},

inside .vscode/tasks.json

"tasks": [
    {
        "label": "webserver",
        "type": "npm",
        "script": "webserver",
        problemMatcher": []
    }
]

Then just run the webserver task.

Terminal -> Run Task

Access with localhost:[PORT NUMBER]/[FILE]

Access with localhost:[PORT NUMBER]/[DIRECTORY]/[FILE]

Etc.

Posted Apr 25, 2019, 4:03 AM UTC · edited

128
Loading comments…