stkb / Rewrap

Rewrap extension for VSCode and Visual Studio
https://marketplace.visualstudio.com/items/stkb.rewrap
Other
499 stars 58 forks source link

Add Zig support #389

Open MadLittleMods opened 8 months ago

MadLittleMods commented 8 months ago

Add Zig support, https://ziglang.org/documentation/0.11.0/#Comments

Fix https://github.com/stkb/Rewrap/issues/388

Tests pass and tested the extension in VSCode :white_check_mark:

Dev notes

Setup

Using Node.js v18.16.0

Install depdencies

$ npm install

Make sure dotnet is installed (see section below for more details)

Testing

$ node .config/do.mjs test

Building

$ node .config/do.mjs package
Core build complete. Running tests:...
Passed: 473; Failed: 0; Errored: 0
Creating VSIX...
 WARNING  Using '*' activation is usually a bad idea as it impacts performance.
VSIX file created at .obj/Rewrap-VSCode.vsix

Install the extension in VSCode (this will just overwrite whatever version of Rewrap you already have installed):

$ code --install-extension .obj/Rewrap-VSCode.vsix
Installing extensions...
(node:310226) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `code --trace-deprecation ...` to show where the warning was created)
Extension 'Rewrap-VSCode.vsix' was successfully installed.

Other build commands for reference:

$ node .config/do.mjs build
$ node .config/do.mjs build vscode

Installing dotnet dependency

  1. Download and install the .NET Core SDK for your platform (tested with .NET 6). For me this looked like the following:
    $ cd ~/Downloads/
    $ wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh
    $ chmod +x ./dotnet-install.sh
    $ ./dotnet-install.sh
    dotnet-install: Attempting to download using aka.ms link https://dotnetcli.azureedge.net/dotnet/Sdk/6.0.415/dotnet-sdk-6.0.415-linux-x64.tar.gz
    dotnet-install: Remote file https://dotnetcli.azureedge.net/dotnet/Sdk/6.0.415/dotnet-sdk-6.0.415-linux-x64.tar.gz size is 186298830 bytes.
    dotnet-install: Extracting zip from https://dotnetcli.azureedge.net/dotnet/Sdk/6.0.415/dotnet-sdk-6.0.415-linux-x64.tar.gz
    dotnet-install: Downloaded file size is 186298830 bytes.
    dotnet-install: The remote and local file sizes are equal.
    dotnet-install: Installed version is 6.0.415
    dotnet-install: Adding to current process PATH: `/home/eric/.dotnet`. Note: This change will be visible only when sourcing script.
    dotnet-install: Note that the script does not resolve dependencies during installation.
    dotnet-install: To check the list of dependencies, go to https://learn.microsoft.com/dotnet/core/install, select your operating system and check the "Dependencies" section.
    dotnet-install: Installation finished successfully.
  2. Update your $PATH environment variable so you can access dotnet from the CLI: .bashrc
    # For .NET dotnet, C# (csharp)
    # https://learn.microsoft.com/en-us/dotnet/core/install/linux-scripted-manual#set-environment-variables-system-wide
    export DOTNET_ROOT=~/.dotnet
    # export MSBuildSDKsPath=$DOTNET_ROOT/sdk/$(${DOTNET_ROOT}/dotnet --version)/Sdks
    export PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools