Skip to content

Latest commit

 

History

History
150 lines (101 loc) · 3.71 KB

File metadata and controls

150 lines (101 loc) · 3.71 KB

Building and Installing the SWG STF Editor Extension

Prerequisites

  • Node.js (version 16 or higher)
  • npm (comes with Node.js)
  • Visual Studio Code

Step 1: Install Dependencies

Open a terminal in the extension directory and run:

cd "c:\Users\Joseph Ridder\Documents\SWG-Source\swg-stf-editor-extension"
npm install

This will install all required dependencies including TypeScript and VS Code extension types.

Step 2: Compile the Extension

Compile the TypeScript code to JavaScript:

npm run compile

Or to watch for changes and recompile automatically:

npm run watch

Step 3: Test the Extension

Option A: Run in Development Mode

  1. Open the extension folder in VS Code
  2. Press F5 to launch a new VS Code window with the extension loaded
  3. In the new window, open any .stf file to test the editor

Option B: Install Locally

Package and install the extension:

# Install the packaging tool
npm install -g @vscode/vsce

# Package the extension
vsce package

# Install the generated .vsix file
code --install-extension swg-stf-editor-1.0.0.vsix

Step 4: Publish to VS Code Marketplace

Create a Publisher Account

  1. Go to https://marketplace.visualstudio.com/
  2. Sign in with your Microsoft account
  3. Create a publisher profile

Update Package.json

Edit package.json and change the publisher field to your publisher name:

"publisher": "your-publisher-name",

Get a Personal Access Token

  1. Go to https://dev.azure.com/
  2. Create a Personal Access Token with "Marketplace (Manage)" permissions
  3. Save the token securely

Publish the Extension

# Login to your publisher account
vsce login your-publisher-name

# Publish the extension
vsce publish

Testing with Sample STF Files

You can test the extension with STF files from your SWG installation or development environment. Sample locations:

  • client-assets-master/string/en/*.stf
  • Any .stf files in your SWG data folders

Troubleshooting

"Cannot find module 'vscode'" error

Run npm install to install dependencies.

Extension doesn't activate

Check that:

  1. The extension is compiled (npm run compile)
  2. The .stf file has the correct extension
  3. Check the Output panel (View > Output) for error messages

Binary file corruption

If the extension produces corrupted STF files:

  1. Keep a backup of your original files
  2. Check the text format for syntax errors
  3. Ensure IDs and CRCs are valid integers

Development Tips

Debugging

  1. Set breakpoints in the TypeScript source files
  2. Press F5 to start debugging
  3. Open an STF file in the debug window
  4. Breakpoints will be hit in the main VS Code window

Making Changes

  1. Edit the TypeScript source files in src/
  2. Run npm run compile or use watch mode
  3. Reload the extension window (Ctrl+R in the debug window)

File Structure

swg-stf-editor-extension/
├── src/
│   ├── extension.ts          # Main entry point
│   ├── stfParser.ts           # Binary STF file parser/writer
│   ├── stfEditorProvider.ts   # Custom editor provider
│   └── stfFileSystem.ts       # File system integration
├── out/                        # Compiled JavaScript (generated)
├── package.json               # Extension manifest
├── tsconfig.json              # TypeScript configuration
└── README.md                  # User documentation

Additional Resources