Failed vscode wip

This commit is contained in:
Idrees Hassan
2025-11-15 21:08:28 -05:00
parent 76e55a3caa
commit 2e3ff28706
14 changed files with 2935 additions and 5 deletions

12
.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,12 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceFolder}/dist/vscode"]
}
]
}

View File

@@ -15,11 +15,14 @@ const DIST_DIR = "./dist";
const BROWSER_MANIFEST = "./platform-specific/extension/manifest.json";
const OBSIDIAN_MANIFEST = "./platform-specific/obsidian/manifest.json";
const USERSCRIPT_HEADER = "./platform-specific/userscript/header.txt";
const VSCODE_PACKAGE = "./platform-specific/vscode/package.json";
const OBSIDIAN_WRAPPER = "./platform-specific/obsidian/wrapper.js";
const VSCODE_WRAPPER = "./platform-specific/vscode/extension.js";
const USERSCRIPT_DIR = DIST_DIR + "/userscript";
const EXTENSION_DIR = DIST_DIR + "/extension";
const OBSIDIAN_DIR = DIST_DIR + "/obsidian";
const VSCODE_DIR = DIST_DIR + "/vscode";
const STYLESHEET_PATH = SRC_DIR + "/stylesheet.css";
const APPLICATION_ENTRY = SRC_DIR + "/application.js";
@@ -183,4 +186,21 @@ let obsidianManifest = readFileSync(OBSIDIAN_MANIFEST, 'utf8');
obsidianManifest = obsidianManifest.replace(/"version":\s*".*"/, `"version": "${version}"`);
writeFileSync(OBSIDIAN_DIR + '/manifest.json', obsidianManifest);
// =============================================
// Build VSCode extension
// =============================================
mkdirSync(VSCODE_DIR, { recursive: true });
// Wrap birb.js with VSCode extension boilerplate
let vscodeExtension = readFileSync(VSCODE_WRAPPER, 'utf8').replace(VERSION_KEY, version).replace(CODE_KEY, birbJs);
// Create extension.js with extension code
writeFileSync(VSCODE_DIR + '/extension.js', vscodeExtension);
// Copy package.json
let vscodePackage = readFileSync(VSCODE_PACKAGE, 'utf8');
vscodePackage = vscodePackage.replace(VERSION_KEY, version);
writeFileSync(VSCODE_DIR + '/package.json', vscodePackage);
console.log(`Build complete: ${version}`);

2
dist/birb.js vendored
View File

@@ -6,7 +6,7 @@
RIGHT: 1,
};
let debugMode = location.hostname === "127.0.0.1";
let debugMode = window.location.hostname === "127.0.0.1";
/**
* @returns {boolean} Whether debug mode is enabled

BIN
dist/extension.zip vendored

Binary file not shown.

View File

@@ -6,7 +6,7 @@
RIGHT: 1,
};
let debugMode = location.hostname === "127.0.0.1";
let debugMode = window.location.hostname === "127.0.0.1";
/**
* @returns {boolean} Whether debug mode is enabled

View File

@@ -11,7 +11,7 @@ module.exports = class PocketBird extends Plugin {
RIGHT: 1,
};
let debugMode = location.hostname === "127.0.0.1";
let debugMode = window.location.hostname === "127.0.0.1";
/**
* @returns {boolean} Whether debug mode is enabled

View File

@@ -20,7 +20,7 @@
RIGHT: 1,
};
let debugMode = location.hostname === "127.0.0.1";
let debugMode = window.location.hostname === "127.0.0.1";
/**
* @returns {boolean} Whether debug mode is enabled

2834
dist/vscode/extension.js vendored Normal file

File diff suppressed because it is too large Load Diff

21
dist/vscode/package.json vendored Normal file
View File

@@ -0,0 +1,21 @@
{
"name": "pocket-bird",
"version": "2025.11.15",
"engines": {
"vscode": "^1.32.0"
},
"activationEvents": [
"onStartupFinished"
],
"main": "extension.js",
"contributes": {
"commands": [
{
"command": "pocket-bird.helloWorld",
"title": "Hello World",
"category": "Example"
}
]
}
}

View File

@@ -0,0 +1,16 @@
// The module 'vscode' contains the VS Code extensibility API
const vscode = require("vscode");
module.exports = {
activate,
deactivate,
};
function activate(context) {
console.log("Loading Pocket Bird...");
__CODE__
console.log("Pocket Bird loaded!");
}
function deactivate() {}

View File

@@ -0,0 +1,5 @@
#!/bin/bash
# my-vscode
export NODE_OPTIONS="--require /Users/idrees/Documents/Programs/JavaScript/Birb/platform-specific/vscode/patch.js"
"/Applications/Visual Studio Code.app/Contents/MacOS/Electron" \
"$@"

View File

@@ -0,0 +1,21 @@
{
"name": "pocket-bird",
"version": "__VERSION__",
"engines": {
"vscode": "^1.32.0"
},
"activationEvents": [
"onStartupFinished"
],
"main": "extension.js",
"contributes": {
"commands": [
{
"command": "pocket-bird.helloWorld",
"title": "Hello World",
"category": "Example"
}
]
}
}

View File

@@ -0,0 +1 @@
console.log("Birb patch for VSCode loaded.");

View File

@@ -3,7 +3,7 @@ export const Directions = {
RIGHT: 1,
};
let debugMode = location.hostname === "127.0.0.1";
let debugMode = window.location.hostname === "127.0.0.1";
/**
* @returns {boolean} Whether debug mode is enabled