Skip to content

Commit e9f1071

Browse files
authored
Fix telemetry not getting picked up for Terminal REPL (#23958)
#23941 Having no blank spaces in front of plain 'python' or 'python3' were returning falsey value.
1 parent 59a8d03 commit e9f1071

File tree

2 files changed

+49
-48
lines changed

2 files changed

+49
-48
lines changed

python_files/Notebooks intro.ipynb

Lines changed: 48 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"cell_type": "markdown",
1212
"metadata": {},
1313
"source": [
14-
"1. Open the command palette with the shortcut: `Ctrl/Command` + `Shift` + `P`\r\n",
14+
"1. Open the command palette with the shortcut: `Ctrl/Command` + `Shift` + `P`\n",
1515
"2. Search for the command `Create New Blank Notebook`"
1616
]
1717
},
@@ -26,8 +26,8 @@
2626
"cell_type": "markdown",
2727
"metadata": {},
2828
"source": [
29-
"1. Open the command palette with the shortcut: `Ctrl/Command` + `Shift` + `P`\r\n",
30-
"\r\n",
29+
"1. Open the command palette with the shortcut: `Ctrl/Command` + `Shift` + `P`\n",
30+
"\n",
3131
"2. Search for the command `Python: Open Start Page`"
3232
]
3333
},
@@ -42,10 +42,10 @@
4242
"cell_type": "markdown",
4343
"metadata": {},
4444
"source": [
45-
"You are currently viewing what we call our Notebook Editor. It is an interactive document based on Jupyter Notebooks that supports the intermixing of code, outputs and markdown documentation. \r\n",
46-
"\r\n",
47-
"This cell is a markdown cell. To edit the text in this cell, simply double click on the cell to change it into edit mode.\r\n",
48-
"\r\n",
45+
"You are currently viewing what we call our Notebook Editor. It is an interactive document based on Jupyter Notebooks that supports the intermixing of code, outputs and markdown documentation. \n",
46+
"\n",
47+
"This cell is a markdown cell. To edit the text in this cell, simply double click on the cell to change it into edit mode.\n",
48+
"\n",
4949
"The next cell below is a code cell. You can switch a cell between code and markdown by clicking on the code ![code icon](https://raw.githubusercontent.com/microsoft/vscode-python/main/images/codeIcon.PNG) /markdown ![markdown icon](https://raw.githubusercontent.com/microsoft/vscode-python/main/images/markdownIcon.PNG) icons or using the keyboard shortcut `M` and `Y` respectively."
5050
]
5151
},
@@ -55,16 +55,16 @@
5555
"metadata": {},
5656
"outputs": [],
5757
"source": [
58-
"print('hello world')"
58+
"print(\"hello world\")"
5959
]
6060
},
6161
{
6262
"cell_type": "markdown",
6363
"metadata": {},
6464
"source": [
65-
"* To execute the code in the cell above, click on the cell to select it and then either press the play ![play](https://raw.githubusercontent.com/microsoft/vscode-python/main/images/playIcon.PNG) button in the cell toolbar, or use the keyboard shortcut `Ctrl/Command` + `Enter`.\r\n",
66-
"* To edit the code, just click in cell and start editing.\r\n",
67-
"* To add a new cell below, click the `Add Cell` icon ![add cell](https://raw.githubusercontent.com/microsoft/vscode-python/main/images/addIcon.PNG) at the bottom left of the cell or enter command mode with the `ESC` Key and then use the keyboard shortcut `B` to create the new cell below.\r\n"
65+
"* To execute the code in the cell above, click on the cell to select it and then either press the play ![play](https://raw.githubusercontent.com/microsoft/vscode-python/main/images/playIcon.PNG) button in the cell toolbar, or use the keyboard shortcut `Ctrl/Command` + `Enter`.\n",
66+
"* To edit the code, just click in cell and start editing.\n",
67+
"* To add a new cell below, click the `Add Cell` icon ![add cell](https://raw.githubusercontent.com/microsoft/vscode-python/main/images/addIcon.PNG) at the bottom left of the cell or enter command mode with the `ESC` Key and then use the keyboard shortcut `B` to create the new cell below.\n"
6868
]
6969
},
7070
{
@@ -78,40 +78,40 @@
7878
"cell_type": "markdown",
7979
"metadata": {},
8080
"source": [
81-
"**Variable explorer**\r\n",
82-
"\r\n",
83-
"To view all your active variables and their current values in the notebook, click on the variable explorer icon ![variable explorer](https://raw.githubusercontent.com/microsoft/vscode-python/main/images/variableExplorerIcon.PNG) in the top toolbar.\r\n",
84-
"\r\n",
85-
"![Variable Explorer](https://raw.githubusercontent.com/microsoft/vscode-python/main/images/variableexplorer.png)\r\n",
86-
"\r\n",
87-
"**Data Viewer**\r\n",
88-
"\r\n",
89-
"To view your data frame in a more visual \"Excel\" like format, open the variable explorer and to the left of any dataframe object, you will see the data viewer icon ![data viewer](https://raw.githubusercontent.com/microsoft/vscode-python/main/images/dataViewerIcon.PNG) which you can click to open the data viewer.\r\n",
90-
"\r\n",
91-
"![Data Viewer](https://raw.githubusercontent.com/microsoft/vscode-python/main/images/dataviewer.gif)\r\n",
92-
"\r\n",
93-
"**Convert to Python File**\r\n",
94-
"\r\n",
95-
"To export your notebook to a Python file (.py), click on the `Convert to Python script` icon ![Export icon](https://raw.githubusercontent.com/microsoft/vscode-python/main/images/exportIcon.PNG) in the top toolbar \r\n",
96-
"\r\n",
97-
"![Export](https://raw.githubusercontent.com/microsoft/vscode-python/main/images/savetopythonfile.png)\r\n",
98-
"\r\n",
99-
"**Plot Viewer**\r\n",
100-
"\r\n",
101-
"If you have a graph (such as matplotlib) in your output, you'll notice if you hover over the graph, the `Plot Viewer` icon ![Plot Viewer](https://raw.githubusercontent.com/microsoft/vscode-python/main/images/plotViewerIcon.PNG) will appear in the top left. Click the icon to open up the graph in the Plotviewer which allows you to zoom on your plots and export it in formats such as png and jpeg.\r\n",
102-
"\r\n",
103-
"![Plot Viewer](https://raw.githubusercontent.com/microsoft/vscode-python/main/images/plotviewer.gif)\r\n",
104-
"\r\n",
105-
"**Switching Kernels**\r\n",
106-
"\r\n",
107-
"The notebook editor will detect all kernels in your system by default. To change your notebook kernel, click on the kernel status in the top toolbar at the far right. For example, your kernel status may say \"Python 3: Idle\". This will open up the kernel selector where you can choose your desired kernel.\r\n",
108-
"\r\n",
109-
"![Switching Kernels](https://raw.githubusercontent.com/microsoft/vscode-python/main/images/kernelchange.gif)\r\n",
110-
"\r\n",
111-
"**Remote Jupyter Server**\r\n",
112-
"\r\n",
113-
"To connect to a remote Jupyter server, open the command prompt and search for the command `Specify remote or local Jupyter server for connections`. Then select `Existing` and enter the remote Jupyter server URL. Afterwards, you'll be prompted to reload the window and the Notebook will be opened connected to the remote Jupyter server.\r\n",
114-
"\r\n",
81+
"**Variable explorer**\n",
82+
"\n",
83+
"To view all your active variables and their current values in the notebook, click on the variable explorer icon ![variable explorer](https://raw.githubusercontent.com/microsoft/vscode-python/main/images/variableExplorerIcon.PNG) in the top toolbar.\n",
84+
"\n",
85+
"![Variable Explorer](https://raw.githubusercontent.com/microsoft/vscode-python/main/images/variableexplorer.png)\n",
86+
"\n",
87+
"**Data Viewer**\n",
88+
"\n",
89+
"To view your data frame in a more visual \"Excel\" like format, open the variable explorer and to the left of any dataframe object, you will see the data viewer icon ![data viewer](https://raw.githubusercontent.com/microsoft/vscode-python/main/images/dataViewerIcon.PNG) which you can click to open the data viewer.\n",
90+
"\n",
91+
"![Data Viewer](https://raw.githubusercontent.com/microsoft/vscode-python/main/images/dataviewer.gif)\n",
92+
"\n",
93+
"**Convert to Python File**\n",
94+
"\n",
95+
"To export your notebook to a Python file (.py), click on the `Convert to Python script` icon ![Export icon](https://raw.githubusercontent.com/microsoft/vscode-python/main/images/exportIcon.PNG) in the top toolbar \n",
96+
"\n",
97+
"![Export](https://raw.githubusercontent.com/microsoft/vscode-python/main/images/savetopythonfile.png)\n",
98+
"\n",
99+
"**Plot Viewer**\n",
100+
"\n",
101+
"If you have a graph (such as matplotlib) in your output, you'll notice if you hover over the graph, the `Plot Viewer` icon ![Plot Viewer](https://raw.githubusercontent.com/microsoft/vscode-python/main/images/plotViewerIcon.PNG) will appear in the top left. Click the icon to open up the graph in the Plotviewer which allows you to zoom on your plots and export it in formats such as png and jpeg.\n",
102+
"\n",
103+
"![Plot Viewer](https://raw.githubusercontent.com/microsoft/vscode-python/main/images/plotviewer.gif)\n",
104+
"\n",
105+
"**Switching Kernels**\n",
106+
"\n",
107+
"The notebook editor will detect all kernels in your system by default. To change your notebook kernel, click on the kernel status in the top toolbar at the far right. For example, your kernel status may say \"Python 3: Idle\". This will open up the kernel selector where you can choose your desired kernel.\n",
108+
"\n",
109+
"![Switching Kernels](https://raw.githubusercontent.com/microsoft/vscode-python/main/images/kernelchange.gif)\n",
110+
"\n",
111+
"**Remote Jupyter Server**\n",
112+
"\n",
113+
"To connect to a remote Jupyter server, open the command prompt and search for the command `Specify remote or local Jupyter server for connections`. Then select `Existing` and enter the remote Jupyter server URL. Afterwards, you'll be prompted to reload the window and the Notebook will be opened connected to the remote Jupyter server.\n",
114+
"\n",
115115
"![Remote](https://raw.githubusercontent.com/microsoft/vscode-python/main/images/remoteserver.gif)"
116116
]
117117
},
@@ -129,7 +129,7 @@
129129
"cell_type": "markdown",
130130
"metadata": {},
131131
"source": [
132-
"- [Data science tutorial for Visual Studio Code](https://code.visualstudio.com/docs/python/data-science-tutorial)\r\n",
132+
"- [Data science tutorial for Visual Studio Code](https://code.visualstudio.com/docs/python/data-science-tutorial)\n",
133133
"- [Jupyter Notebooks in Visual Studio Code documentation](https://code.visualstudio.com/docs/python/jupyter-support)"
134134
]
135135
}
@@ -145,9 +145,10 @@
145145
"name": "python3"
146146
},
147147
"language_info": {
148+
"name": "python",
148149
"version": "3.8.6-final"
149150
}
150151
},
151152
"nbformat": 4,
152153
"nbformat_minor": 0
153-
}
154+
}

src/client/terminals/codeExecution/terminalReplWatcher.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { EventName } from '../../telemetry/constants';
55

66
function checkREPLCommand(command: string): boolean {
77
const lower = command.toLowerCase().trimStart();
8-
return lower.startsWith('python ') || lower.startsWith('py ');
8+
return lower.startsWith('python') || lower.startsWith('py');
99
}
1010

1111
export function registerTriggerForTerminalREPL(disposables: Disposable[]): void {

0 commit comments

Comments
 (0)