Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix extension compatibility with VSCode 1.94 for Mac #410

Merged
merged 37 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
5dfecb8
ubuntu test
Katsute Sep 12, 2024
0fc7b2a
w
Katsute Sep 12, 2024
43301f9
Update test-ubuntu.yml
Katsute Sep 12, 2024
1acac77
push1
Katsute Sep 12, 2024
152d52e
push2
Katsute Sep 12, 2024
34d7f60
Update test-ubuntu.yml
Katsute Sep 12, 2024
9691e30
push4
Katsute Sep 12, 2024
e7848ac
cleanup
Katsute Sep 12, 2024
980ca16
unused
Katsute Sep 12, 2024
66436ab
Update extension.ts
Katsute Sep 12, 2024
f21d436
retest
Katsute Sep 13, 2024
fc13e83
Update test.vsix
Katsute Sep 13, 2024
bbeace7
Update test-ubuntu.yml
Katsute Sep 13, 2024
0b53728
Update test-ubuntu.yml
Katsute Sep 13, 2024
d3c53da
Update test-ubuntu.yml
Katsute Sep 13, 2024
2931aba
Update test-ubuntu.yml
Katsute Sep 13, 2024
047b028
Update test-ubuntu.yml
Katsute Sep 13, 2024
b6b53f8
Update test.vsix
Katsute Sep 13, 2024
dade563
retest
Katsute Sep 13, 2024
f9f8058
retest
Katsute Sep 13, 2024
1cd89d1
Update test.vsix
Katsute Sep 13, 2024
4dd7f25
Update test-ubuntu.yml
Katsute Sep 13, 2024
a551086
Update test-ubuntu.yml
Katsute Sep 13, 2024
bb50a6c
retest5
Katsute Sep 13, 2024
39480b4
test ubuntu
Katsute Sep 13, 2024
acb751f
retest
Katsute Sep 13, 2024
ad8ac07
wtf
Katsute Sep 13, 2024
c06057c
Update test-ubuntu.yml
Katsute Sep 13, 2024
8f5f7f2
test on mac
Katsute Sep 13, 2024
b8bef12
Update test-macos.yml
Katsute Sep 13, 2024
2c82a29
retry mac
Katsute Sep 13, 2024
794f984
typo, final mac test!
Katsute Sep 13, 2024
cff982d
retest on mac
Katsute Sep 13, 2024
01fc52a
retest!
Katsute Sep 13, 2024
427dedc
unpush
Katsute Sep 13, 2024
e00b4c9
confirm tests
Katsute Sep 13, 2024
1fb2020
reset
Katsute Sep 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/test-macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Test MacOS

on: [workflow_dispatch]

jobs:
test-macos:
name: Test MacOS
runs-on: macos-latest
timeout-minutes: 5

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Dependencies
shell: bash
run: |-
brew update
brew install --cask visual-studio-code

- name: Install VSIX extension
shell: bash
run: |-
/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code --install-extension test/test.vsix
sleep 5

- name: Launch VS Code
shell: bash
run: |-
/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code --verbose &
sleep 20

- name: Print Output
shell: bash
run: |-
ls $TMPDIR
sleep 1
echo ======
sleep 1
cat $(echo $TMPDIR)test.txt
48 changes: 48 additions & 0 deletions .github/workflows/test-ubuntu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Test Ubuntu

on: [workflow_dispatch]

jobs:
test-ubuntu:
name: Test Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Dependencies
shell: bash
run: |-
sudo apt-get update
sudo apt-get install -y wget gpg
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -o root -g root -m 644 packages.microsoft.gpg /usr/share/keyrings/
sudo sh -c 'echo "deb [arch=amd64 signed-by=/usr/share/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
sudo apt-get install -y apt-transport-https
sudo apt-get update
sudo apt-get install -y code
sudo apt-get install -y xvfb

- name: Install VSIX extension
shell: bash
run: |-
code --install-extension test/test.vsix
sleep 5

- name: Launch VS Code
shell: bash
run: |-
cd /usr/share/code
xvfb-run code --verbose &
sleep 20

- name: Print Output
shell: bash
run: |-
ls /tmp
sleep 1
echo ======
sleep 1
cat /tmp/test.txt
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"theme": "dark"
},
"publisher": "Katsute",
"version": "3.0.1",
"version": "3.0.2",
"private": true,
"engines": {
"vscode": "^1.93.0"
Expand Down
9 changes: 5 additions & 4 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

import { dirname, join } from "path";
import { join } from "path";
import { platform, release } from "os";
import { exec } from "@vscode/sudo-prompt";
import { existsSync, copyFileSync } from "fs";
Expand All @@ -29,6 +29,7 @@ import { api } from "./extension/api";
import { install, uninstall } from "./extension/writer";
import { optionMenu } from "./menu/menu";
import { configuration, get, update } from "./extension/config";
import { env } from "vscode";

//

Expand All @@ -55,14 +56,14 @@ export const activate: (context: ExtensionContext) => any = (context: ExtensionC
let workbench: string;
let product: string;

const dir = require?.main?.filename ? dirname(require.main.filename) : join(process.cwd(), "resources", "app", "out");
const dir = env.appRoot;

// internal files
if(dir){
// %appdata%/Local/Programs/Microsoft VS Code/resources/app/out/vs/workbench/workbench.desktop.main.js
workbench = join(dir, "vs", "workbench", "workbench.desktop.main.js");
workbench = join(dir, "out", "vs", "workbench", "workbench.desktop.main.js");
// %appdata%/Local/Programs/Microsoft VS Code/resources/app/product.json
product = join(dir, "../", "product.json");
product = join(dir, "product.json");

if(!existsSync(workbench)){
window.showErrorMessage(`Failed to find '${workbench}', please report this issue`);
Expand Down
1 change: 1 addition & 0 deletions test/test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require("fs").writeFileSync(join(require("os").tmpdir(), "test.txt"), `Node: ${require?.main?.filename} OS: ${platform()}\n${dir}\n${join(dir, "out", "vs", "workbench", "workbench.desktop.main.js")} ${existsSync(join(dir, "out", "vs", "workbench", "workbench.desktop.main.js"))}\n${join(dir, "product.json")} ${existsSync(join(dir, "product.json"))}`, "utf-8");
Binary file added test/test.vsix
Binary file not shown.