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 1, 2023
2 parents 1b2404d + 6963683 commit f802e1f
Show file tree
Hide file tree
Showing 69 changed files with 4,058 additions and 388 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"fflate",
"Fuzzysort",
"geojsofromnuri",
"idldoc",
"IDLJSON",
"IDLNB",
"idlnotebook",
Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,22 @@ 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.0 November 2023

Fixed a bug with the debugger that would fail to get information about your IDL session.

Add auto-complete within compile_opt statements! This now shows you all the compile options that are available and is smart enough to filter out compile opts that have already been specified.

Add a new option to disable reporting problems with user docs. This setting can be found under "Problem Reporting => Report Docs Problems".

Fixed an issue that incorrectly handled when a system had an odd number of CPUs and we could not create the right number of worker threads causing the language server to not start up

Added the ability to parse legacy IDL Doc style tags that use the `@tag` style approach. Not all of the same docs functionality and validation works, but the core information is brought into the language server.

- If you are using AutoDoc when formatting code, any of these legacy IDL Doc docs will automatically be migrated to the RST (i.e. new) flavor of IDL Doc. This way, if you want, you have an option to migrate to the latest and greatest doc style automatically.

- Also updated syntax highlighting to account for these docs tags

## 4.0.0 November 2023

The official release of IDL Notebooks! This is a first pass at adding notebook support for IDL (which is independent from Jupyter). We are hoping to have early adopters try it out and provide feedback on how notebooks behave. Read below to learn more or find an example IDL and ENVI Notebook directly within VSCode in the IDL sidebar.
Expand Down
13 changes: 13 additions & 0 deletions apps/package-json/src/contributes/config/problems-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,19 @@ export function AddProblemsConfig(nls: IPackageNLS) {
scope: IDL_CONFIG_SCOPE,
};

// folders to not ask to init config for
ourConfig.properties[
`${IDL_LANGUAGE_NAME}.${IDL_EXTENSION_CONFIG_KEYS.problemsReportDocsProblems}`
] = {
type: 'boolean',
default: DEFAULT_IDL_EXTENSION_CONFIG.problems.reportDocsProblems,
description: TranslationFromConfiguration(
IDL_EXTENSION_CONFIG_KEYS.problemsReportDocsProblems,
nls
),
scope: IDL_CONFIG_SCOPE,
};

// problem codes to ignore
ourConfig.properties[
`${IDL_LANGUAGE_NAME}.${IDL_EXTENSION_CONFIG_KEYS.problemsIgnoreProblems}`
Expand Down
63 changes: 35 additions & 28 deletions apps/test-tokenizer/src/parse-tests/tokenizer-test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { CancellationToken } from '@idl/cancellation-tokens';
import { LogManager } from '@idl/logger';
import { IDLIndex } from '@idl/parsing/index';
import { Tokenizer } from '@idl/parsing/tokenizer';
import { TimeItAsync } from '@idl/shared';
import * as glob from 'fast-glob';
import { readFileSync, writeFileSync } from 'fs';
import { join } from 'path';
import * as progressBar from 'progress';
Expand Down Expand Up @@ -33,7 +34,8 @@ export async function TokenizerTest(
);

// search for files
const files = await glob('**/**.pro', { cwd: folder });
// const files = await glob('**/**.pro', { cwd: folder });
const files = await index.findFiles(folder, '**/**.pro');
if (files.length === 0) {
throw new Error(`No ".pro" files found in "${folder}"`);
}
Expand All @@ -52,7 +54,7 @@ export async function TokenizerTest(
title: `${i + 1}/${files.length}`,
file: files[i],
});
const read = readFileSync(join(folder, files[i]), 'utf-8').split('\n');
const read = readFileSync(files[i], 'utf-8').split('\n');
lines += read.length;
code.push(read);
}
Expand All @@ -75,31 +77,36 @@ export async function TokenizerTest(
width: 25,
}
);
// for (let i = 0; i < code.length; i++) {
// const canTick = true;

// // extract tokens
// if (useIndex) {
// // TrackPopularity(index, await index.indexCode(files[i], code[i], true));
// await index.getParsedCode(files[i], code[i], true);
// } else {
// Tokenizer(code[i]);
// }

// // tick the bar if we can
// if (canTick) {
// bar2.tick({
// title: `${i + 1}/${files.length}`,
// file: files[i],
// });
// }
// }

bar2.tick({
title: `Indexing`,
file: `workspace with threads`,
});
await index.indexWorkspace(folder);
for (let i = 0; i < code.length; i++) {
const canTick = true;

// extract tokens
if (useIndex) {
// TrackPopularity(index, await index.indexCode(files[i], code[i], true));
await index.getParsedProCode(
files[i],
code[i],
new CancellationToken(),
{ postProcess: true }
);
} else {
Tokenizer(code[i], new CancellationToken());
}

// tick the bar if we can
if (canTick) {
bar2.tick({
title: `${i + 1}/${files.length}`,
file: files[i],
});
}
}

// bar2.tick({
// title: `Indexing`,
// file: `workspace with threads`,
// });
// await index.indexWorkspace(folder);

bar2.complete = true;
bar2.render();
Expand Down
209 changes: 38 additions & 171 deletions apps/test-tokenizer/src/playground-code.ts
Original file line number Diff line number Diff line change
@@ -1,174 +1,41 @@
/**
* Code for use with the playground
*/
export const PLAYGROUND_CODE = `PRO ENVIBoundingBoxSet_Example
COMPILE_OPT IDL2, hidden
; Start the application
e = ENVI(/HEADLESS)
; Define bounding box rings
; [[xMin,yMin], [xMax,yMin], [xMax,yMax], [xMin,yMax], [xMin,yMin]]
boxes = [ $
[[530, 381], [570, 381], [570, 421], [530, 421], [530, 381]], $
[[438, 859], [478, 859], [478, 899], [438, 899], [438, 859]], $
[[392, 212], [432, 212], [432, 252], [392, 252], [392, 212]], $
[[636, 499], [676, 499], [676, 539], [636, 539], [636, 499]], $
[[266, 519], [306, 519], [306, 559], [266, 559], [266, 519]], $
[[398, 729], [438, 729], [438, 769], [398, 769], [398, 729]], $
[[300, 486], [340, 486], [340, 526], [300, 526], [300, 486]], $
[[400, 545], [440, 545], [440, 585], [400, 585], [400, 545]], $
[[204, 723], [244, 723], [244, 763], [204, 763], [204, 723]]]
; Supplement class labels, colors, and bounding boxes
labels = List('red_car', 'green_car', 'blue_car')
colors = List([255,0,0], [0,255,0], [0,0,255])
classBoxes = (List(boxes[*,*,0:2], boxes[*,*,3:5], boxes[*,*,6:8])).ToArray(/TRANSPOSE)
; Construct the bounding box set
bboxSet = ENVIBoundingBoxSet()
; Iterate class labels, adding class information to the object
FOREACH name, labels, index DO BEGIN
bboxSet.AddClass, CLASS=index, LABEL=name, COLOR=colors[index]
; Assign three boxes per class
FOR n=0, 2 DO BEGIN
bboxSet.AddBoundingBox, CLASS=index, BOUNDING_BOX=classBoxes[*,*,index,n]
ENDFOR
ENDFOREACH
Print, 'Classes:'
Print, bboxSet.Classes
Print, 'Labels:'
Print, bboxSet.Labels
Print, 'Class Colors: '
Print, bboxSet.Colors
Print, 'Classes Count: ', bboxSet.nClasses
Print, 'Bounding Box Count: ', bboxSet.nBounding_Boxes
Print, 'Class to Bounding Box Map:'
Print, bboxSet.Bounding_Boxes_Per_Class
Print, 'Get Bounding Box by Index: '
; Get the first bounding box in class 0
Print, bboxSet.GetBoundingBox(CLASS=0, INDEX=0)
Print, 'Get All Class 1 Bounding Boxes:'
; Get all bounding boxes for class 1
Print, bboxSet.GetBoundingBox(CLASS=1, /ALL), /IMPLIED
; Remove boxes and classes
; First, remove all bounding boxes from class 0
bboxSet.RemoveBoundingBox, CLASS=0, /ALL
; Remove the bounding box at index 0 in class 1
bboxSet.RemoveBoundingBox, CLASS=1, INDEX=0
; Remove a bounding box from class 2 (using coordinates)
bboxSet.RemoveBoundingBox, CLASS=2, BOUNDING_BOX=classBoxes[*,*,2,0]
; Remove the red_car class
bboxSet.RemoveClass, CLASS=0
Print, 'After removing boxes and class 0.
Print, 'Classes:'
Print, bboxSet.Classes
Print, 'Labels:'
Print, bboxSet.Labels
Print, 'Class Colors: '
Print, bboxSet.Colors
Print, 'Classes Count: ', bboxSet.nClasses
Print, 'Bounding Box Count: ', bboxSet.nBounding_Boxes
Print, 'Class to Bounding Box Map:'
Print, bboxSet.Bounding_Boxes_Per_Class
; Get GeoJSON and display
geoJson = bboxSet.GetGeoJSON()
Print, geoJson, /IMPLIED
END`;
export const PLAYGROUND_CODE = `;+
; LatLon_Distance
; Computes the distance of a rhumb line connecting two points on a sphere or spheroid
;
; @param lon1, lat1 {input} Longitude and latitude of the 1st point, p0
; @param lon2, lat2 {input} Longitude and latitude of the 2nd point, p1
; @param method {input} The method to be used, options are:
; 1 - Haversine (sphere) - selected by default
; 2 - Vincenty (spheroid)
;
; @keyword meters Set this keyword to return the distance in meters
; @keyword radians Set this keyword if inputs are specified in radians (the default is degrees)
; @keyword radius 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
; @keyword semimajor_axis Set this keyword to the length of the semimajor axis of the reference ellipsoid, in [m]
; the default value is the WGS-84 6378137
; @keyword semiminor_axis 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
;
; @returns The distance between the 2 points, [km] by default
;
; @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
;
; @history
; 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`;
4 changes: 3 additions & 1 deletion apps/test-tokenizer/src/playground.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ export async function Playground() {
*/
let parsed: IParsed;
const t1 = TimeIt(() => {
Parser(PLAYGROUND_CODE, new CancellationToken(), { cleanup: false });
parsed = Parser(PLAYGROUND_CODE, new CancellationToken(), {
cleanup: false,
});
});
console.log();
console.log(`Parser time (ms): ${t1}`);
Expand Down
2 changes: 1 addition & 1 deletion apps/test-tokenizer/src/test-maker/cache/cache.json

Large diffs are not rendered by default.

Loading

0 comments on commit f802e1f

Please sign in to comment.