Skip to content
This repository has been archived by the owner on Dec 23, 2021. It is now read-only.

Commit

Permalink
Rename 'New Project' to 'New File' (#101)
Browse files Browse the repository at this point in the history
PBI: 32293
Task: 32284
  • Loading branch information
jonathanwangg authored Aug 9, 2019
1 parent 29161e4 commit a986e41
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 55 deletions.
2 changes: 1 addition & 1 deletion docs/how-to-use.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Commands are accessible through :

- **Open Simulator** : opens the webview of the simulator.

- **New Project** : opens an unsaved file with links to help you and a code snippet that you can save as `code.py` / `main.py`.
- **New File** : opens an unsaved file with links to help you and a code snippet that you can save as `code.py` / `main.py`.
_(**Note :** will open the simulator webview if it's not open yet)_.

- **Run Simulator** : run the code you have open on the simulator (make sure you've clicked on a valid code file).
Expand Down
2 changes: 1 addition & 1 deletion docs/telemetry.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Through the Application Insights API, telemetry events are collected on Pacifica

| **Property** | **Note** |
| :-------------------: | ---------------------------------------------------------------------------------------------------- |
| **Event Name** | Unique event name/descriptor for the event. For ex: Pacifica/COMMAND_NEW_PROJECT |
| **Event Name** | Unique event name/descriptor for the event. For ex: Pacifica/COMMAND_NEW_FILE |
| **VS Code Session ID** | A unique identifier for the current session (changes each time the editor is started) |
| **VS Code Machine ID** | A unique identifier for the computer |
| **VS Code Version** | VS Code version being used by the user |
Expand Down
2 changes: 1 addition & 1 deletion locales/en/out/constants.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"info.extensionActivated": "Congratulations, your extension Adafruit_Simulator is now active!",
"info.firstTimeWebview": "To reopen the simulator click on the \"Open Simulator\" button on the upper right corner of the text editor, or select the command \"Open Simulator\" from command palette.",
"error.invalidFileExtensionDebug": "The file you tried to run isn\\'t a Python file.",
"info.newProject": "New to Python or Circuit Playground Express project? We are here to help!",
"info.newFile": "New to Python or the Circuit Playground Express? We are here to help!",
"info.redirect": "You are being redirected.",
"info.runningCode": "Running user code",
"info.privacyStatement": "Privacy Statement",
Expand Down
2 changes: 1 addition & 1 deletion locales/en/package.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"pacificaExtension.commands.label": "Pacifica",
"pacificaExtension.commands.openSimulator": "Open Simulator",
"pacificaExtension.commands.runSimulator": "Run Simulator",
"pacificaExtension.commands.newProject": "New Project",
"pacificaExtension.commands.newFile": "New File",
"pacificaExtension.commands.runDevice": "Deploy to Device",
"pacificaExtension.configuration.title": "Pacfica configuration",
"pacificaExtension.configuration.properties.open": "Whether to show 'Open Simulator' icon in editor title menu.",
Expand Down
41 changes: 11 additions & 30 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"activationEvents": [
"onCommand:pacifica.openSimulator",
"onCommand:pacifica.runSimulator",
"onCommand:pacifica.newProject",
"onCommand:pacifica.newFile",
"onCommand:pacifica.runDevice",
"onDebug"
],
Expand All @@ -52,8 +52,8 @@
}
},
{
"command": "pacifica.newProject",
"title": "%pacificaExtension.commands.newProject%",
"command": "pacifica.newFile",
"title": "%pacificaExtension.commands.newFile%",
"category": "%pacificaExtension.commands.label%"
},
{
Expand Down
2 changes: 1 addition & 1 deletion package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"pacificaExtension.commands.label": "Pacifica",
"pacificaExtension.commands.openSimulator": "Open Simulator",
"pacificaExtension.commands.runSimulator": "Run Simulator",
"pacificaExtension.commands.newProject": "New Project",
"pacificaExtension.commands.newFile": "New File",
"pacificaExtension.commands.runDevice": "Deploy to Device",
"pacificaExtension.configuration.title": "Pacfica configuration",
"pacificaExtension.configuration.properties.open": "Whether to show 'Open Simulator' icon in editor title menu.",
Expand Down
14 changes: 7 additions & 7 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const CONSTANTS = {
),
NO_FILE_TO_RUN: localize(
"error.noFileToRun",
'[ERROR] We can\'t find a Python file to run. Please make sure you select or open a new ".py" code file, or use the "New Project" command to get started and see useful links.\n'
'[ERROR] We can\'t find a Python file to run. Please make sure you select or open a new ".py" code file, or use the "New File" command to get started and see useful links.\n'
),
NO_PROGRAM_FOUND_DEBUG: localize(
"error.noProgramFoundDebug",
Expand Down Expand Up @@ -86,9 +86,9 @@ export const CONSTANTS = {
"info.invalidFileNameDebug",
'The file you tried to debug isn\'t named "code.py" or "main.py". Rename your file if you want your code to work on your actual device.'
),
NEW_PROJECT: localize(
"info.newProject",
"New to Python or Circuit Playground Express project? We are here to help!"
NEW_FILE: localize(
"info.newFile",
"New to Python or the Circuit Playground Express? We are here to help!"
),
REDIRECT: localize("info.redirect", "You are being redirected."),
RUNNING_CODE: localize("info.runningCode", "Running user code"),
Expand Down Expand Up @@ -123,7 +123,7 @@ export enum TelemetryEventName {

// Extension commands
COMMAND_DEPLOY_DEVICE = "COMMAND.DEPLOY.DEVICE",
COMMAND_NEW_PROJECT = "COMMAND.NEW.PROJECT",
COMMAND_NEW_FILE = "COMMAND.NEW.FILE",
COMMAND_OPEN_SIMULATOR = "COMMAND.OPEN.SIMULATOR",
COMMAND_RUN_SIMULATOR = "COMMAND.RUN.SIMULATOR",

Expand All @@ -141,14 +141,14 @@ export enum TelemetryEventName {

ERROR_PYTHON_DEVICE_PROCESS = "ERROR.PYTHON.DEVICE.PROCESS",
ERROR_PYTHON_PROCESS = "ERROR.PYTHON.PROCESS",
ERROR_COMMAND_NEW_PROJECT = "ERROR.COMMAND.NEW.PROJECT",
ERROR_COMMAND_NEW_FILE = "ERROR.COMMAND.NEW.FILE",
ERROR_DEPLOY_WITHOUT_DEVICE = "ERROR.DEPLOY.WITHOUT.DEVICE",

SUCCESS_COMMAND_DEPLOY_DEVICE = "SUCCESS.COMMAND.DEPLOY.DEVICE",

// Performance
PERFORMANCE_DEPLOY_DEVICE = "PERFORMANCE.DEPLOY.DEVICE",
PERFORMANCE_NEW_PROJECT = "PERFORMANCE.NEW.PROJECT",
PERFORMANCE_NEW_FILE = "PERFORMANCE.NEW.FILE",
PERFORMANCE_OPEN_SIMULATOR = "PERFORMANCE.OPEN.SIMULATOR"
}

Expand Down
20 changes: 10 additions & 10 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ let telemetryAI: TelemetryAI;
let pythonExecutableName: string = "python";
// Notification booleans
let firstTimeClosed: boolean = true;
let shouldShowNewProject: boolean = true;
let shouldShowNewFile: boolean = true;
let shouldShowInvalidFileNamePopup: boolean = true;

function loadScript(context: vscode.ExtensionContext, scriptPath: string) {
Expand Down Expand Up @@ -162,17 +162,17 @@ export async function activate(context: vscode.ExtensionContext) {
const filePath = __dirname + path.sep + fileName;
const file = fs.readFileSync(filePath, "utf8");

if (shouldShowNewProject) {
if (shouldShowNewFile) {
vscode.window
.showInformationMessage(
CONSTANTS.INFO.NEW_PROJECT,
CONSTANTS.INFO.NEW_FILE,
DialogResponses.DONT_SHOW,
DialogResponses.EXAMPLE_CODE,
DialogResponses.TUTORIALS
)
.then((selection: vscode.MessageItem | undefined) => {
if (selection === DialogResponses.DONT_SHOW) {
shouldShowNewProject = false;
shouldShowNewFile = false;
telemetryAI.trackFeatureUsage(
TelemetryEventName.CLICK_DIALOG_DONT_SHOW
);
Expand Down Expand Up @@ -204,19 +204,19 @@ export async function activate(context: vscode.ExtensionContext) {
// tslint:disable-next-line: no-unused-expression
(error: any) => {
telemetryAI.trackFeatureUsage(
TelemetryEventName.ERROR_COMMAND_NEW_PROJECT
TelemetryEventName.ERROR_COMMAND_NEW_FILE
);
console.error(`Failed to open a new text document: ${error}`);
};
};

const newProject: vscode.Disposable = vscode.commands.registerCommand(
"pacifica.newProject",
const newFile: vscode.Disposable = vscode.commands.registerCommand(
"pacifica.newFile",
() => {
telemetryAI.trackFeatureUsage(TelemetryEventName.COMMAND_NEW_PROJECT);
telemetryAI.trackFeatureUsage(TelemetryEventName.COMMAND_NEW_FILE);
telemetryAI.runWithLatencyMeasure(
openTemplateFile,
TelemetryEventName.PERFORMANCE_NEW_PROJECT
TelemetryEventName.PERFORMANCE_NEW_FILE
);
}
);
Expand Down Expand Up @@ -473,7 +473,7 @@ export async function activate(context: vscode.ExtensionContext) {
openSimulator,
runSimulator,
runDevice,
newProject,
newFile,
vscode.debug.registerDebugConfigurationProvider(
"python",
simulatorDebugConfiguration
Expand Down

0 comments on commit a986e41

Please sign in to comment.