Skip to content

Commit

Permalink
Add some comments and references
Browse files Browse the repository at this point in the history
  • Loading branch information
DavisVaughan committed Jan 17, 2025
1 parent 8828ccb commit 388980e
Showing 3 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions editors/code/src/constants.ts
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@ const folderName = path.basename(__dirname);

/**
* Path to the root directory of this extension.
* https://github.com/microsoft/vscode-python-tools-extension-template/blob/main/src/common/constants.ts
*/
export const EXTENSION_ROOT_DIR =
folderName === "common"
6 changes: 6 additions & 0 deletions editors/code/src/logging.ts
Original file line number Diff line number Diff line change
@@ -20,6 +20,12 @@ export function registerLogger(logChannel: OutputChannel): Disposable {
};
}

/*
* Free function for logging to the global output channel shared with the server
*
* Adapted from:
* https://github.com/microsoft/vscode-python-tools-extension-template/blob/main/src/common/log/logging.ts
*/
export function outputLog(...args: Arguments): void {
if (process.env.CI === "true") {
console.log(...args);
10 changes: 10 additions & 0 deletions editors/code/src/workspace.ts
Original file line number Diff line number Diff line change
@@ -2,6 +2,16 @@ import path from "path";
import * as vscode from "vscode";
import * as fs from "fs-extra";

/*
* Locate the "root" workspace folder
*
* Iterates through the open workspace folders, looking for the one with the "shortest"
* path. If no workspaces are open, returns a mock `WorkspaceFolder` representing the
* current directory.
*
* Adapted from:
* https://github.com/microsoft/vscode-python-tools-extension-template/blob/8f474ec4ac4e7205ffed9f7f243473bb00bf29c0/src/common/utilities.ts#L38
*/
export async function getRootWorkspaceFolder(): Promise<vscode.WorkspaceFolder> {
const workspaces: readonly vscode.WorkspaceFolder[] = getWorkspaceFolders();

0 comments on commit 388980e

Please sign in to comment.