OXYGENHUB

Diagnostics: log from activation, report when no repository is found, Initialize Repository command and Source Control welcome 810a1c538e78

Author
Andy McCall @andymccall <[email protected]>
When
· 2026-09-27 15:29 UTC
Signature
✔ signed by Andy McCall
Hash
810a1c538e780fa8626209aaa527abb7de937f6efaac152ed78cf7824af3ce17
Depends on
71d8bf9717d2 bed495a96408
Depended on by
f6bda77ecb9f 35d56b5803d9
In bookmarks
main
In tags
v0.16.0 v0.16.1 v0.17.0 v0.17.1 v0.18.0
Edits
8 atoms, 0 tree operations, 3 files

Browse the tree at this change

modified CHANGELOG.md +4 −0
1 1
# Changelog
2 2
3 +
## 0.1.2 (2026-09-27)
4 +
5 +
Log from the start of activation, report when no repository is found, an Initialize Repository command, and a Source Control welcome entry.
6 +
3 7
## 0.1.1 (2026-09-27)
4 8
5 9
Activate on `.oxy/format` (a directory never matches `workspaceContains`) and on startup, so repositories are found in every window.
…
8 unchanged lines
modified package.json +10 −2
…
1 unchanged lines
2 2
  "name": "oxygen-vscode",
3 3
  "displayName": "Oxygen",
4 4
  "description": "Oxygen version control: source control view, diffs, decorations, bookmarks and history for oxy repositories",
5 -
  "version": "0.1.1",
5 +
  "version": "0.1.2",
6 6
  "publisher": "oxygen",
7 7
  "license": "MIT OR Apache-2.0",
8 8
  "icon": "assets/images/oxygen.png",
…
23 unchanged lines
32 32
      { "command": "oxygen.openChanges", "title": "Open Changes", "category": "Oxygen" },
33 33
      { "command": "oxygen.openBaseVersion", "title": "Open Base Version", "category": "Oxygen" },
34 34
      { "command": "oxygen.showOutput", "title": "Show Output", "category": "Oxygen" },
35 -
      { "command": "oxygen.showLog", "title": "Show Log", "category": "Oxygen" }
35 +
      { "command": "oxygen.showLog", "title": "Show Log", "category": "Oxygen" },
36 +
      { "command": "oxygen.init", "title": "Initialize Repository", "category": "Oxygen" }
37 +
    ],
38 +
    "viewsWelcome": [
39 +
      {
40 +
        "view": "scm",
41 +
        "contents": "Oxygen is installed but found no oxy repository in the open folders.\n[Initialize Oxygen Repository](command:oxygen.init)\n[Show Oxygen Output](command:oxygen.showOutput)",
42 +
        "when": "workbenchState != empty && !oxygen.hasRepository"
43 +
      }
36 44
    ],
37 45
    "menus": {
38 46
      "scm/title": [
…
59 unchanged lines
modified src/extension.ts +24 −0
…
18 unchanged lines
19 19
export async function activate(context: vscode.ExtensionContext): Promise<void> {
20 20
  output = vscode.window.createOutputChannel("Oxygen");
21 21
  context.subscriptions.push(output);
22 +
  output.appendLine(`Oxygen extension ${context.extension.packageJSON.version} activating; folders: ${(vscode.workspace.workspaceFolders ?? []).map((f) => f.uri.fsPath).join(", ") || "(none)"}`);
22 23
  oxy = new Oxy(findBinary(vscode.workspace.getConfiguration("oxygen").get<string>("path")), (line) => output.appendLine(line));
23 24
24 25
  try {
…
25 unchanged lines
50 51
    vscode.commands.registerCommand("oxygen.openBaseVersion", (state?: OxyResourceState) => state && vscode.commands.executeCommand("vscode.open", baseUri(state.repository.root, state.path))),
51 52
    vscode.commands.registerCommand("oxygen.commit", (arg?: Repository | vscode.SourceControl) => commit(arg)),
52 53
    vscode.commands.registerCommand("oxygen.showLog", () => showLog()),
54 +
    vscode.commands.registerCommand("oxygen.init", () => initRepository()),
53 55
    vscode.workspace.onDidChangeWorkspaceFolders(() => void discover()),
54 56
    vscode.workspace.onDidChangeConfiguration((e) => {
55 57
      if (e.affectsConfiguration("oxygen.path")) {
…
34 unchanged lines
90 92
      repositories.delete(root);
91 93
    }
92 94
  }
95 +
  if (wanted.size === 0 && (vscode.workspace.workspaceFolders ?? []).length > 0) {
96 +
    output.appendLine("no Oxygen repository in the open folders (oxy root found none)");
97 +
  }
93 98
  for (const [root, folder] of wanted) {
94 99
    if (!repositories.has(root)) {
95 100
      const repo = new Repository(oxy, root, folder);
…
61 unchanged lines
157 162
  }
158 163
}
159 164
165 +
async function initRepository(): Promise<void> {
166 +
  const folders = vscode.workspace.workspaceFolders ?? [];
167 +
  if (folders.length === 0) {
168 +
    void vscode.window.showErrorMessage("Oxygen: open a folder first.");
169 +
    return;
170 +
  }
171 +
  const folder = folders.length === 1 ? folders[0] : await vscode.window.showWorkspaceFolderPick({ placeHolder: "Folder to initialize as an Oxygen repository" });
172 +
  if (!folder) {
173 +
    return;
174 +
  }
175 +
  try {
176 +
    await oxy.check(folder.uri.fsPath, ["init"]);
177 +
    await discover();
178 +
    void vscode.window.showInformationMessage(`Oxygen: initialized ${folder.name}.`);
179 +
  } catch (e) {
180 +
    showError(e);
181 +
  }
182 +
}
183 +
160 184
async function showLog(): Promise<void> {
161 185
  const repo = repositoryFor(undefined);
162 186
  if (!repo) {
…
26 unchanged lines