Skip to content

Commit

Permalink
Merge branch 'develop' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
znorman-harris committed Dec 6, 2023
2 parents f802e1f + 45cd09f commit e3708c4
Show file tree
Hide file tree
Showing 16 changed files with 227 additions and 19 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ Code style revamp! We reworked how routines, routine methods, properties, and st

- When generating ENVI and IDL tasks, using our new case libraries, we attempt to make a pretty display name from parameter names. For example converting the keyword "my_keyword" to "My Keyword". This applied to task and parameter display names.

## 4.1.1 December 2023

Added a new preference for notebooks called "Quiet Mode" that allows you to control the IDL preference for `!quiet` when executing notebook cells.

When using ".edit" in the debug console, added a message that let's you know that a matching file was not found.

## 4.1.0 November 2023

Fixed a bug with the debugger that would fail to get information about your IDL session.
Expand Down
9 changes: 9 additions & 0 deletions apps/client-e2e/src/tests/notebooks/_notebook-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { RunTestENVINotebook } from './run-test-envi-notebook';
import { RunTestNotebook } from './run-test-notebook';
import { RunUnsavedNotebook } from './run-unsaved-notebook';
import { SaveAndClearNotebook } from './save-and-clear-output';
import { VerifyQuietNotebookSetting } from './verify-quiet-notebook-setting';

/*
* Logger to be used for tests related to debugging
Expand Down Expand Up @@ -138,6 +139,14 @@ NOTEBOOK_RUNNER.addTest({
critical: true,
});

// make sure quiet mode works right
// this should always be after the RunNotebookStop test which makes
// sure we have a fresh session to tweak preferences for
NOTEBOOK_RUNNER.addTest({
name: 'Verify quiet mode for notebooks',
fn: VerifyQuietNotebookSetting,
});

// notebook problems track right
NOTEBOOK_RUNNER.addTest({
name: 'Notebook problems track right',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
import { GetExtensionPath, IDL_COMMANDS, Sleep } from '@idl/shared';
import { GetWorkspaceConfig, IIDLWorkspaceConfig } from '@idl/vscode/config';
import { IDL_EXTENSION_CONFIG_KEYS } from '@idl/vscode/extension-config';
import expect from 'expect';
import * as vscode from 'vscode';

import { RunnerFunction } from '../runner.interface';
import { ICompareCellOutputs } from './helpers/compare-cells.interface';
import {
DEFAULT_RUNNER_TIMEOUT,
RunNotebookAndCompareCells,
} from './helpers/run-notebook-and-compare-cells';

/**
* Types of outputs from cells that we expect to have
*/
export const QUIET_OUTPUT: ICompareCellOutputs[] = [
{
idx: 0,
success: true,
mimeTypes: [],
},
];

/**
* Types of outputs from cells that we expect to have
*/
export const NOT_QUIET_OUTPUT: ICompareCellOutputs[] = [
{
idx: 0,
success: true,
mimeTypes: ['text/plain'],
},
];

/**
* Function that runs basic tests for ENVI message listeners
*/
export const VerifyQuietNotebookSetting: RunnerFunction = async (init) => {
// get the current workspace config
const config = GetWorkspaceConfig();

// make sure we are quiet
(config as IIDLWorkspaceConfig).update(
IDL_EXTENSION_CONFIG_KEYS.notebooksQuietMode,
true,
true
);

// run in quiet mode
await RunNotebookAndCompareCells(
GetExtensionPath('idl/test/client-e2e/notebooks/quiet-preference.idlnb'),
QUIET_OUTPUT,
init.notebooks.controller,
DEFAULT_RUNNER_TIMEOUT
);

// turn off
(config as IIDLWorkspaceConfig).update(
IDL_EXTENSION_CONFIG_KEYS.notebooksQuietMode,
false,
true
);

// reset
await vscode.commands.executeCommand(IDL_COMMANDS.NOTEBOOKS.RESET);

// short pause
await Sleep(100);

// make sure stopped
expect(init.notebooks.controller.isStarted()).toBeTruthy();

// run in quiet mode
await RunNotebookAndCompareCells(
GetExtensionPath('idl/test/client-e2e/notebooks/quiet-preference.idlnb'),
NOT_QUIET_OUTPUT,
init.notebooks.controller,
DEFAULT_RUNNER_TIMEOUT
);

// turn on again
(config as IIDLWorkspaceConfig).update(
IDL_EXTENSION_CONFIG_KEYS.notebooksQuietMode,
true,
true
);

// stop execution
await vscode.commands.executeCommand(IDL_COMMANDS.NOTEBOOKS.STOP);

// short pause
await Sleep(100);

// make sure stopped
expect(init.notebooks.controller.isStarted()).toBeFalsy();
};
13 changes: 13 additions & 0 deletions apps/package-json/src/contributes/config/notebook-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,19 @@ export function AddNotebookConfig(nls: IPackageNLS) {
scope: IDL_CONFIG_SCOPE,
};

// should our extension run in debug mode
ourConfig.properties[
`${IDL_LANGUAGE_NAME}.${IDL_EXTENSION_CONFIG_KEYS.notebooksQuietMode}`
] = {
type: 'boolean',
default: DEFAULT_IDL_EXTENSION_CONFIG.notebooks.quietMode,
description: TranslationFromConfiguration(
IDL_EXTENSION_CONFIG_KEYS.notebooksQuietMode,
nls
),
scope: IDL_CONFIG_SCOPE,
};

// save in overall extension config
EXTENSION_CONFIG.push(ourConfig);
}
Binary file modified extension/icon-theme/seti.woff
Binary file not shown.
8 changes: 5 additions & 3 deletions extension/icon-theme/vs-seti-icon-theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -1820,6 +1820,7 @@
"version.txt": "_clock",
"version": "_clock",
"mvnw": "_maven",
"pom.xml": "_maven",
"tsconfig.json": "_tsconfig",
"swagger.json": "_json_1",
"swagger.yml": "_json_1",
Expand Down Expand Up @@ -1938,7 +1939,7 @@
"sql": "_db",
"swift": "_swift",
"typescript": "_typescript",
"typescriptreact": "_typescript",
"typescriptreact": "_react",
"xml": "_xml",
"dockercompose": "_docker_3",
"yaml": "_yml",
Expand Down Expand Up @@ -2264,7 +2265,7 @@
"sql": "_db_light",
"swift": "_swift_light",
"typescript": "_typescript_light",
"typescriptreact": "_typescript_light",
"typescriptreact": "_react_light",
"xml": "_xml_light",
"dockercompose": "_docker_3_light",
"yaml": "_yml_light",
Expand Down Expand Up @@ -2312,6 +2313,7 @@
"version.txt": "_clock_light",
"version": "_clock_light",
"mvnw": "_maven_light",
"pom.xml": "_maven_light",
"tsconfig.json": "_tsconfig_light",
"swagger.json": "_json_1_light",
"swagger.yml": "_json_1_light",
Expand Down Expand Up @@ -2380,5 +2382,5 @@
"npm-debug.log": "_npm_ignored_light"
}
},
"version": "https://github.com/jesseweed/seti-ui/commit/fd20793e5a75b350eab8d489165fb9b420df3f62"
"version": "https://github.com/jesseweed/seti-ui/commit/8eec7f2e37cd8fd91a98c61d129468bb49735a94"
}
13 changes: 13 additions & 0 deletions idl/test/client-e2e/notebooks/quiet-preference.idlnb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": "2.0.0",
"cells": [
{
"type": "code",
"content": [
"message, 'Info', /info"
],
"metadata": {},
"outputs": []
}
]
}
64 changes: 54 additions & 10 deletions idl/test/scratch/idltasktest.pro
Original file line number Diff line number Diff line change
@@ -1,12 +1,56 @@
compile_opt idl2

case !true of
!true: begin

end
else: begin
; do nothing
end
endswitch
;+
; :Description:
; LatLon_Distance
; Computes the distance of a rhumb line connecting two points on a sphere or spheroid
;
; The distance between the 2 points, [km] by default
;
; :Returns: any
;
; :Arguments:
; lon1: in, required, any
; Longitude and latitude of the 1st point, p0
; lat1: in, required, any
; Longitude and latitude of the 1st point, p0
; lon2: in, required, any
; Longitude and latitude of the 2nd point, p1
; lat2: in, required, any
; Longitude and latitude of the 2nd point, p1
; method: in, required, any
; The method to be used, options are:
; 1 - Haversine (sphere) - selected by default
; 2 - Vincenty (spheroid)
;
; :Keywords:
; meters: bidirectional, required, any
; Set this keyword to return the distance in meters
; radians: bidirectional, required, any
; Set this keyword if inputs are specified in radians (the default is degrees)
; radius: bidirectional, required, any
; Set this keyword to a value specifying the radius of the sphere to be used, in [km]
; the default value is the Authalic radius (equal area hyothetical perfect sphere) = 6371.0072
; semimajor_axis: bidirectional, required, any
; Set this keyword to the length of the semimajor axis of the reference ellipsoid, in [m]
; the default value is the WGS-84 6378137
; semiminor_axis: bidirectional, required, any
; Set this keyword to the length of the semiminor axis of the reference ellipsoid, in [m]
; the default value is the WGS-84 6356752.314245
;
; :References:
; Haversine formula ( great-circle distance between two points on a sphere )
; https://en.wikipedia.org/wiki/Haversine_formula
; Vincenty formula ( distance between two points on the surface of a spheroid )
; https://en.wikipedia.org/wiki/Vincenty%27s_formulae
; https://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf
;
; :Revisions:
; Thu Jul 29, 2021 - Introduce the Vincenty equation (computation of distances over an spheroid)
; Sun Apr 23, 2023 - Fix the Vincenty calculation at latitudes close to zero
; Wed May 10, 2023 - Allow arrays in the Vincenty method
;
;-
function idltasktest, lon1, lat1, lon2, lat2, method, meters = meters, radians = radians, radius = radius, semimajor_axis = semimajor_axis, semiminor_axis = semiminor_axis
compile_opt idl2

return, 1
end
2 changes: 1 addition & 1 deletion libs/shared/src/lib/version.interface.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
* Version of the extension
*/
export const VERSION = '4.1.0';
export const VERSION = '4.1.1';
3 changes: 3 additions & 0 deletions libs/translation/src/lib/languages/en/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ export const EN: ITranslation = {

notebooks:
'Preferences that control notebook user experience for IDL Notebooks',
'notebooks.quietMode':
'When enabled, automatically sets `!quiet` to a value of `1` to suppress too much output from IDL and keep notebook cell outputs cleaner.',
'notebooks.embedGraphics':
"Are graphics embedded as output within each cell?\n\nIf you have open notebooks, you'll need to stop IDL and then re-run cells for changes to take effect.",

Expand Down Expand Up @@ -359,6 +361,7 @@ export const EN: ITranslation = {
noRoutineFound:
'No main level program or function/procedure with same name as file found',
returning: 'File compiled while active, returning...',
nothingToEdit: 'No matching file found',
noPauseOnWindows: 'Pause is not currently supported on Windows platforms',
syntaxError:
'IDL detected a syntax error on this line when compiling your code',
Expand Down
2 changes: 2 additions & 0 deletions libs/translation/src/lib/translation.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,8 @@ export interface ITranslation {
syntaxError: string;
/** Warning text for the debug console to let users know it is a preview feature */
previewWarning: string;
/** When no file is found from .edit */
nothingToEdit: string;
};
/** Error translations */
errors: {
Expand Down
7 changes: 7 additions & 0 deletions libs/vscode/debug/src/lib/idl-debug-adapter.class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1420,6 +1420,13 @@ export class IDLDebugAdapter extends LoggingDebugSession {
vscode.commands.executeCommand(VSCODE_COMMANDS.OPEN_FILE, file, {
preview: false,
});
} else {
this.sendEvent(
new OutputEvent(
`${IDL_TRANSLATION.debugger.adapter.nothingToEdit}\n`,
'stderr'
)
);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ export interface IDLExtensionsConfigKeys {

/** Key for notebook preferences */
readonly notebooks: 'notebooks';
/** Do we make IDL quiet? */
readonly notebooksQuietMode: 'notebooks.quietMode';
/** Do we embed graphics or not */
readonly notebooksEmbedGraphics: 'notebooks.embedGraphics';

Expand Down Expand Up @@ -133,6 +135,8 @@ export interface ILanguageServerConfig {
}

export interface INotebookConfig {
/** Do we make IDL quiet? */
quietMode: boolean;
/** Do we embed graphics into notebooks? */
embedGraphics: boolean;
}
Expand Down Expand Up @@ -250,6 +254,7 @@ export const IDL_EXTENSION_CONFIG_KEYS: IDLExtensionsConfigKeys = {
languageServerFullParse: 'languageServer.fullParse',

notebooks: 'notebooks',
notebooksQuietMode: 'notebooks.quietMode',
notebooksEmbedGraphics: 'notebooks.embedGraphics',

problems: 'problems',
Expand Down Expand Up @@ -312,6 +317,7 @@ export const DEFAULT_IDL_EXTENSION_CONFIG: IDLExtensionConfig = {
fullParse: true,
},
notebooks: {
quietMode: true,
embedGraphics: true,
},
problems: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ export class IDLNotebookController {
*/
const commands = [
`retall`,
'!quiet = 1',
`!quiet = ${IDL_EXTENSION_CONFIG.notebooks.quietMode ? '1' : '0'}`,
`!magic.embed = ${
IDL_EXTENSION_CONFIG.notebooks.embedGraphics ? '1' : '0'
}`,
Expand Down Expand Up @@ -413,7 +413,7 @@ export class IDLNotebookController {
*/
const compile = [
`compile_opt idl2`,
`!quiet = 1`,
`!quiet = ${IDL_EXTENSION_CONFIG.notebooks.quietMode ? '1' : '0'}`,
`!magic.embed = ${
IDL_EXTENSION_CONFIG.notebooks.embedGraphics ? '1' : '0'
}`,
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

Loading

0 comments on commit e3708c4

Please sign in to comment.