Skip to content

Commit c9fabca

Browse files
Merge remote-tracking branch 'origin/develop'
2 parents 861b41d + 01cfd88 commit c9fabca

149 files changed

Lines changed: 6812 additions & 963 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,42 @@ Document some advanced types so users may try them out and provide feedback. The
1616

1717
- Read more in the extension documentation
1818

19+
## 4.5.0 - May 2024
20+
21+
New-and improved IDL Notebook user experience!
22+
23+
- When compiling cells, we don't show you the output from compiling to focus on what runs
24+
25+
- The paths for notebook cells have been cleaned up and are now easy to read (before they had IDs in the names of the paths)
26+
27+
- Notebook cells now offer implied print! For main level programs (i.e. cells by default), we detect and automatically print variables, outputs from function calls, and expressions like "2 + 42". You can see some examples of this in our sample IDL Notebook included with the extension.
28+
29+
- Variables that will be printed have a special semantic token highlighting applied to them to make it clear it is not being interpreted as a procedure. This depends on your VSCode theme, but should either look like other variables or stands out compared to procedure calls.
30+
31+
- After running a notebook cell, we check to see if there is any output. If there is no output, we do not create notebook cell output. Previously we always added output to cells, even if there wasn't anything to track.
32+
33+
Fixed an issue where we incorrectly reported an error when using the property index signature to retrieve a property. This affected statements of the form "struct.(0).(0)"
34+
35+
Add icons for the languages that we contribute to the extension
36+
37+
Add human-readable names for the languages that we contribute
38+
39+
Fixed an edge case when reporting that a variable cannot be indexed with the `!null` type
40+
41+
Type detection now properly handles the following cases:
42+
43+
- Any statement using `&&` or `||` will return boolean type
44+
45+
- Any statement using a logical operator should return the correct type (i.e. `eq`, `ne`, `le`). For example: `[1,2,3] eq 5` should give a type of `Array<Boolean>`. This supports lists, hashes, orderedhashes, and dictionaries.
46+
47+
These type changes help fix scenarios where we were incorrectly reporting errors for extension users.
48+
49+
The extension now automatically detects when you have code that is "standalone" which needs to be assigned to a value (or have a value assigned to it).
50+
51+
When running IDL through the debug console, we now properly catch stops/breakpoints that aren't a result of manually sending commands to IDL. This supports use cases where widget/UI applications are running and hit a stop or breakpoint in a callback routine.
52+
53+
Moved the following features out of `preview` since there have been no reported issues:
54+
1955
Added the ability to convert a notebook to a PDF! This requires an additional extension called ":"Markdown PDF", which you will be prompted to install. This includes:
2056

2157
- A new sidebar entry for PDF generation and a button in the top-right of the notebook to generate a PDF

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
<div align="center">
3434
<video controls autoplay loop muted playsinline style="max-width: 720px; width: 100%">
35-
<source src="https://l3harrisgeospatial-webcontent.s3.amazonaws.com/vscode-idl/vscode-tiny.mp4" type="video/mp4">
35+
<source src="https://vis-webcontent.s3.amazonaws.com/vscode-idl/vscode-tiny.mp4" type="video/mp4">
3636
</video>
3737
</div>
3838

apps/client-e2e/src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { performance } from 'perf_hooks';
99
import * as vscode from 'vscode';
1010

1111
import { ResetSettingsForTests } from './tests/helpers/reset-settings-for-tests';
12-
import { TestRunner } from './tests/runner';
12+
import { TestRunner } from './tests/test-runner';
1313

1414
/**
1515
* Value returned from activating our extension

apps/client-e2e/src/tests/debugging/_debugging-runner.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { RigorousAlwaysReturn } from './rigorous-always-return';
1515
import { RunFile } from './run-file';
1616
import { StartDebugging } from './start';
1717
import { SyntaxErrorTracking } from './syntax_error_tracking';
18+
import { TimerStop } from './timer-stop';
1819
import { VariableReplacement } from './variable-replacement';
1920

2021
/**
@@ -76,6 +77,11 @@ DEBUGGING_RUNNER.addTest({
7677
fn: BreakpointSetBeforeStart,
7778
});
7879

80+
DEBUGGING_RUNNER.addTest({
81+
name: 'Detect stops not from manually running code',
82+
fn: TimerStop,
83+
});
84+
7985
DEBUGGING_RUNNER.addTest({
8086
name: 'Compile file and open the file we compiled',
8187
fn: Compile,
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import { GetExtensionPath, IDL_COMMANDS, Sleep } from '@idl/shared';
2+
import { OpenFileInVSCode } from '@idl/vscode/shared';
3+
import expect from 'expect';
4+
import * as vscode from 'vscode';
5+
6+
import { RunnerFunction } from '../runner.interface';
7+
8+
/**
9+
* Function that runs a test and makes sure debugging stops and detects the line we are on
10+
*/
11+
export const TimerStop: RunnerFunction = async (init) => {
12+
/**
13+
* Start IDL
14+
*/
15+
const started = await vscode.commands.executeCommand(
16+
IDL_COMMANDS.DEBUG.START
17+
);
18+
19+
// verify we started
20+
expect(started).toBeTruthy();
21+
22+
// close
23+
await vscode.commands.executeCommand('workbench.action.closeAllEditors');
24+
25+
/** Get the file with timer callback */
26+
const file = GetExtensionPath('idl/test/client-e2e/debug/timer_stop.pro');
27+
28+
// open file
29+
await OpenFileInVSCode(file, true);
30+
31+
// short pause
32+
await Sleep(100);
33+
34+
// run
35+
const res = await vscode.commands.executeCommand(IDL_COMMANDS.DEBUG.RUN);
36+
37+
// make sure that we could run
38+
expect(res).toBeTruthy();
39+
40+
// sleep and wait for our timer callback to get hit
41+
await Sleep(1500);
42+
43+
// get call stack
44+
const stack = (await init.debug.adapter._runtime.getCallStack()).frames.map(
45+
(item) => {
46+
return { line: item.line, file: item.file };
47+
}
48+
);
49+
50+
// make sure our call stack matches
51+
expect(stack).toEqual([
52+
{ line: 12, file },
53+
{ line: 19, file },
54+
]);
55+
56+
// return - IDL bug/behavior where we need to do it twice
57+
await init.debug.adapter.evaluate('retall');
58+
59+
// sleep and wait for our timer callback to get hit
60+
await Sleep(500);
61+
62+
// return again to work around windows bug
63+
await init.debug.adapter.evaluate('retall');
64+
};

apps/client-e2e/src/tests/interactions/_interactions-runner.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { IDLDisableIndividualsFromSettingsForNotebook } from './idl-disable-indi
1717
import { IDLJSONInteractRight } from './idl-json-interact-right';
1818
import { IndexIDLFolderRightAndOpenEditClose } from './index-idl-folder-right-and-open-edit-close';
1919
import { MigrateCodeDL30, MigrateCodeDL30_2 } from './migrate-code-dl-3.0';
20+
import { NotebookImpliedPrintProblemReporting } from './notebook-implied-print-problem-reporting';
2021
import { NotebookProblemsTrackRight } from './notebook-problems-track-right';
2122
import { NotebookCompletionBasic } from './notebooks-completion-basic';
2223
import { NotebooksInteractRight } from './notebooks-interact-right';
@@ -158,3 +159,8 @@ INTERACTIONS_RUNNER.addTest({
158159
name: 'Notebook problems track right',
159160
fn: NotebookProblemsTrackRight,
160161
});
162+
163+
INTERACTIONS_RUNNER.addTest({
164+
name: 'Notebooks report problems right for implied print and standalone expressions',
165+
fn: NotebookImpliedPrintProblemReporting,
166+
});
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { GetExtensionPath, Sleep } from '@idl/shared';
2+
import { OpenNotebookInVSCode } from '@idl/vscode/shared';
3+
import expect from 'expect';
4+
import * as vscode from 'vscode';
5+
6+
import { CLIENT_E2E_CONFIG } from '../client-e2e-config.interface';
7+
import { RunnerFunction } from '../runner.interface';
8+
9+
/**
10+
* Function that verifies problems reported for implied print
11+
*/
12+
export const NotebookImpliedPrintProblemReporting: RunnerFunction = async (
13+
init
14+
) => {
15+
// open our notebook
16+
const nb = await OpenNotebookInVSCode(
17+
GetExtensionPath(
18+
'idl/test/client-e2e/notebooks/problems/implied-print.idlnb'
19+
),
20+
true
21+
);
22+
23+
// short pause
24+
await Sleep(CLIENT_E2E_CONFIG.DELAYS.PROBLEMS_NOTEBOOK);
25+
26+
/** Get current cells */
27+
const cells = nb.getCells();
28+
29+
/**
30+
* Verify no problems
31+
*/
32+
expect(
33+
cells.map(
34+
(cell) => vscode.languages.getDiagnostics(cell.document.uri).length
35+
)
36+
).toEqual([0, 1, 0]);
37+
};

apps/client-e2e/src/tests/notebooks/_notebook-runner.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ import { RunNotebookStop } from './notebook-stop';
1313
import { NotebookToProCodeAllCells } from './notebook-to-pro-code-all-cells';
1414
import { NotebookToProCodeAllCells2 } from './notebook-to-pro-code-all-cells-2';
1515
import { NotebookToProCodeOnlyCode } from './notebook-to-pro-code-only-code';
16+
import { NotebooksReplaceCellPathsForError } from './notebooks-replace-cell-paths-for-error';
17+
import { NotebooksReplaceCellPathsOnStop } from './notebooks-replace-cell-paths-on-stop';
18+
import { NotebooksVerifyImpliedPrint } from './notebooks-verify-implied-print';
1619
import { OpenENVINotebookExample } from './open-envi-notebook-example';
1720
import { OpenIDLNotebookExample } from './open-idl-notebook-example';
1821
import { ResetNotebookExamples } from './reset-notebook-examples';
@@ -174,6 +177,26 @@ NOTEBOOK_RUNNER.addTest({
174177
fn: NotebookCallStackDecorationsNoDecorations,
175178
});
176179

180+
NOTEBOOK_RUNNER.addTest({
181+
name: 'Stack trace decorations dont show for normal execution',
182+
fn: NotebookCallStackDecorationsNoDecorations,
183+
});
184+
185+
NOTEBOOK_RUNNER.addTest({
186+
name: 'Replace cell paths for stops',
187+
fn: NotebooksReplaceCellPathsOnStop,
188+
});
189+
190+
NOTEBOOK_RUNNER.addTest({
191+
name: 'Replace cell paths for errors',
192+
fn: NotebooksReplaceCellPathsForError,
193+
});
194+
195+
NOTEBOOK_RUNNER.addTest({
196+
name: 'Implied print does the right thing',
197+
fn: NotebooksVerifyImpliedPrint,
198+
});
199+
177200
// reset goes first
178201
NOTEBOOK_RUNNER.addTest({
179202
name: 'Reset does the right thing',

apps/client-e2e/src/tests/notebooks/helpers/compare-cells.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export async function CompareCellOutputs(
6565
/**
6666
* Compares cells and outputs to make sure they match what we expect them to be
6767
*/
68-
export function CompareCellsAndOutputs(
68+
export function CompareCellKindsAndOutputs(
6969
nb: vscode.NotebookDocument,
7070
cellsAndOutput: ICompareCellAndOutputs[]
7171
) {
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import {
2+
IDLRawNotebook,
3+
IDLRawNotebookVersion_2_0_0,
4+
} from '@idl/types/notebooks';
5+
import expect from 'expect';
6+
import { readFileSync } from 'fs';
7+
8+
/**
9+
* gets outputs that we can compare
10+
*/
11+
function GetOutputs(data: IDLRawNotebook<IDLRawNotebookVersion_2_0_0>) {
12+
return data.cells
13+
.map((cell) =>
14+
(cell.outputs || [])
15+
.map((output) =>
16+
output.items
17+
.map((item) =>
18+
Array.isArray(item.content)
19+
? item.content.join('\n').trimEnd().split(/\n/gim)
20+
: [item.content.trimEnd()]
21+
)
22+
.flat()
23+
)
24+
.flat()
25+
)
26+
.flat();
27+
}
28+
29+
/**
30+
* Compares the JSON text content of two notebook files on disk
31+
*/
32+
export async function CompareNotebookJSONOutputs(
33+
referenceUri: string,
34+
actualUri: string
35+
) {
36+
/**
37+
* Get reference notebook
38+
*/
39+
const refData: IDLRawNotebook<IDLRawNotebookVersion_2_0_0> = JSON.parse(
40+
readFileSync(referenceUri, 'utf-8')
41+
);
42+
43+
/**
44+
* Get actual notebook
45+
*/
46+
const actualData: IDLRawNotebook<IDLRawNotebookVersion_2_0_0> = JSON.parse(
47+
readFileSync(actualUri, 'utf-8')
48+
);
49+
50+
// compare
51+
expect(GetOutputs(refData)).toEqual(GetOutputs(actualData));
52+
}

0 commit comments

Comments
 (0)