diff --git a/.eslintrc.json b/.eslintrc.json index 42e2e7e68..5098b92d6 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -39,13 +39,18 @@ "extends": ["plugin:@nx/typescript"], "rules": { "@typescript-eslint/no-explicit-any": "off", - "no-shadow": "error" + "no-shadow": "error", + "@typescript-eslint/no-extra-semi": "error", + "no-extra-semi": "off" } }, { "files": ["*.js", "*.jsx"], "extends": ["plugin:@nx/javascript"], - "rules": {} + "rules": { + "@typescript-eslint/no-extra-semi": "error", + "no-extra-semi": "off" + } } ] } diff --git a/.prettierignore b/.prettierignore index 6027050a6..cc14cfeb4 100644 --- a/.prettierignore +++ b/.prettierignore @@ -17,4 +17,5 @@ compliance apps/test-tokenizer/src/test-maker/cache/cache.json .angular -/.nx/cache \ No newline at end of file +/.nx/cache +/.nx/workspace-data \ No newline at end of file diff --git a/.vscodeignore b/.vscodeignore index c7a65839d..ffbfbf14b 100644 --- a/.vscodeignore +++ b/.vscodeignore @@ -69,4 +69,5 @@ package-lock.json perf.txt problems.json tsconfig.base.json -webpack.base.config.js \ No newline at end of file +webpack.node.config.js +webpack.vscode.config.js \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index d4bde73a0..33f09ea00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,36 @@ Document some advanced types so users may try them out and provide feedback. The - Read more in the extension documentation +## 4.6.0 - August 2024 + +Fixed an issue where we open a file that we have stopped in, even if it is compiled as a SAVE file. Now, only PRO files will be jumped to. + +Fixed an issue where, if you have a comment block before and after a routine definition, the second comment block is picked. We now only use the comment block after a routine definition if we did not find one just before. + +Fixed an issue where documentation after a routine definition wasn't properly reporting problems. + +For both of the problems above, and for documentation inside of a routine, the interior comments must be on the next line after the definition otherwise they will not be detected. If this breaks existing behavior for you, let us know and we can change it back! + +Resolved an issue where, when routine definitions changed, problems were not properly detected as they should be. Example: changing the name of a keyword should have an error appear in any file that used the old keyword. + +Notebooks now support compiling files! If a cell only has comments and compile statements, then it will be executed as a batch file. This allows you to merge notebooks and traditional editing/creation of PRO code. + +Updated the "Hello World" IDL Notebook example with this new behavior. + +Improve auto-complete for executive commands. + +For `.compile` we now have auto-complete for files known to the language server. + +Created a new concept called a Routine Definition File for IDL. These files allow developers, who deliver code as SAVE files or as DLLs/DLMs, to provide documentation so that other users get hover help, auto-complete, and the ability to create notebooks automatically from examples in the docs. + +> See the new documentation page [here](https://interactive-data-language.github.io/vscode-idl/types/routine_definition_files.html) for more information. + +Fixed an issue where we were not correctly detecting unclosed quotes when there was an escaped quote within the content of the string. + +Re-work the toolbar for animations in IDL Notebooks. The new toolbar uses the same colors/style as the sidebar and will look good on most themes. There was an issue, after a library update, where colors for high contrast themes did not work with the slider and have now been fixed. + +Notebook maps (requires ENVI) now have a button that will reset the view to the initial state. Helpful in case you zoom out or lose the location of your imagery while zooming/panning around. + ## 4.5.1 - May 2024 Continuing with our story of IDL Notebook user experience, each session of notebook now gets it's own instance of IDL! This means a few things: diff --git a/apps/client-e2e/project.json b/apps/client-e2e/project.json index b92c1f8e0..2e04a9504 100644 --- a/apps/client-e2e/project.json +++ b/apps/client-e2e/project.json @@ -12,7 +12,7 @@ "main": "apps/client-e2e/src/main.ts", "tsConfig": "apps/client-e2e/tsconfig.app.json", "assets": [], - "webpackConfig": "webpack.base.config.js", + "webpackConfig": "webpack.vscode.config.js", "externalDependencies": "none", "target": "node", "compiler": "tsc" @@ -44,17 +44,13 @@ }, "lint": { "executor": "@nx/eslint:lint", - "outputs": ["{options.outputFile}"], - "options": { - "lintFilePatterns": ["apps/client-e2e/**/*.ts"] - } + "outputs": ["{options.outputFile}"] }, "test": { "executor": "@nx/jest:jest", "outputs": ["{workspaceRoot}/coverage/apps/client-e2e"], "options": { - "jestConfig": "apps/client-e2e/jest.config.ts", - "passWithNoTests": true + "jestConfig": "apps/client-e2e/jest.config.ts" } } }, diff --git a/apps/client-e2e/src/main.ts b/apps/client-e2e/src/main.ts index 9fd92506d..0947480a0 100644 --- a/apps/client-e2e/src/main.ts +++ b/apps/client-e2e/src/main.ts @@ -40,7 +40,7 @@ export async function run(): Promise { /** * Manually specify IDL folder */ - const idlDir = FindIDL(); + const idlDir = FindIDL('idl90'); // validate we know where it is if (!idlDir) { diff --git a/apps/client-e2e/src/tests/client-e2e-config.interface.ts b/apps/client-e2e/src/tests/client-e2e-config.interface.ts index d3e1c03ef..8f0387370 100644 --- a/apps/client-e2e/src/tests/client-e2e-config.interface.ts +++ b/apps/client-e2e/src/tests/client-e2e-config.interface.ts @@ -8,7 +8,7 @@ export const CLIENT_E2E_CONFIG = { DELAYS: { /** Problem delay for PRO files and anything else */ DEFAULT: 1000, - /** Problem delay for IDL Notebooks */ - PROBLEMS_NOTEBOOK: 1000, + /** Delay for tests using problem reporting and notebooks */ + PROBLEMS_NOTEBOOK: 2000, }, }; diff --git a/apps/client-e2e/src/tests/interactions/_interactions-runner.ts b/apps/client-e2e/src/tests/interactions/_interactions-runner.ts index 21a228691..e44aea34a 100644 --- a/apps/client-e2e/src/tests/interactions/_interactions-runner.ts +++ b/apps/client-e2e/src/tests/interactions/_interactions-runner.ts @@ -1,33 +1,41 @@ import { Logger } from '@idl/logger'; import { Runner } from '../runner.class'; -import { AddDocs } from './add-docs'; +import { DefFilesInteractRight } from './basic-interactions/def-files-interact-right'; +import { IDLJSONInteractRight } from './basic-interactions/idl-json-interact-right'; +import { IndexIDLFolderRightAndOpenEditClose } from './basic-interactions/index-idl-folder-right-and-open-edit-close'; +import { ProCodeInteractRight } from './basic-interactions/pro-code-interacts-right'; +import { TasksInteractRight } from './basic-interactions/tasks-interact-right'; +import { DuplicateGlobals } from './change-detection/duplicate-globals'; +import { DuplicateGlobalsFromDefs } from './change-detection/duplicate-globals-from-defs'; +import { DuplicateGlobalsFromOnlyDefs } from './change-detection/duplicate-globals-from-only-defs'; +import { RoutineChange } from './change-detection/routine-change'; import { ExecuteCodeActionsWithEditForNotebook, ExecuteCodeActionsWithEditForPROFile, -} from './execute-code-actions-with-edits'; -import { IDLDisableAllFromSettings } from './idl-disable-all-from-setting'; -import { IDLDisableAllFromSettingsForNotebook } from './idl-disable-all-from-setting-for-notebook'; -import { - IDLDisableAllFromComments, - IDLDisableLinesFromComments, -} from './idl-disable-from-comments'; -import { IDLDisableIndividualsFromSettings } from './idl-disable-individuals-from-setting'; -import { IDLDisableIndividualsFromSettingsForNotebook } from './idl-disable-individuals-from-setting-for-notebook'; -import { IDLJSONInteractRight } from './idl-json-interact-right'; -import { IndexIDLFolderRightAndOpenEditClose } from './index-idl-folder-right-and-open-edit-close'; -import { MigrateCodeDL30, MigrateCodeDL30_2 } from './migrate-code-dl-3.0'; -import { NotebookImpliedPrintProblemReporting } from './notebook-implied-print-problem-reporting'; -import { NotebookProblemsTrackRight } from './notebook-problems-track-right'; -import { NotebookCompletionBasic } from './notebooks-completion-basic'; -import { NotebooksInteractRight } from './notebooks-interact-right'; -import { NotebooksNoDuplicateRoutines } from './notebooks-no-duplicate-routines'; +} from './code-actions/execute-code-actions-with-edits'; import { ProCodeCodeActionsExisting, ProCodeCodeActionsNoExisting, -} from './pro-code-code-actions'; -import { ProCodeInteractRight } from './pro-code-interacts-right'; -import { TasksInteractRight } from './tasks-interact-right'; +} from './code-actions/pro-code-code-actions'; +import { AddDocs } from './commands/add-docs'; +import { + MigrateCodeDL30, + MigrateCodeDL30_2, +} from './commands/migrate-code-dl-3.0'; +import { IDLDisableAllFromSettings } from './disable-problems/idl-disable-all-from-setting'; +import { IDLDisableAllFromSettingsForNotebook } from './disable-problems/idl-disable-all-from-setting-for-notebook'; +import { + IDLDisableAllFromComments, + IDLDisableLinesFromComments, +} from './disable-problems/idl-disable-from-comments'; +import { IDLDisableIndividualsFromSettings } from './disable-problems/idl-disable-individuals-from-setting'; +import { IDLDisableIndividualsFromSettingsForNotebook } from './disable-problems/idl-disable-individuals-from-setting-for-notebook'; +import { NotebookImpliedPrintProblemReporting } from './notebooks/notebook-implied-print-problem-reporting'; +import { NotebookProblemsTrackRight } from './notebooks/notebook-problems-track-right'; +import { NotebookCompletionBasic } from './notebooks/notebooks-completion-basic'; +import { NotebooksInteractRight } from './notebooks/notebooks-interact-right'; +import { NotebooksNoDuplicateRoutines } from './notebooks/notebooks-no-duplicate-routines'; /* * Logger to be used for tests related to debugging @@ -79,6 +87,11 @@ INTERACTIONS_RUNNER.addTest({ fn: ProCodeInteractRight, }); +INTERACTIONS_RUNNER.addTest({ + name: 'PRO def files interact right', + fn: DefFilesInteractRight, +}); + INTERACTIONS_RUNNER.addTest({ name: 'Disable problem reporting using comments (all)', fn: IDLDisableAllFromComments, @@ -164,3 +177,23 @@ INTERACTIONS_RUNNER.addTest({ name: 'Notebooks report problems right for implied print and standalone expressions', fn: NotebookImpliedPrintProblemReporting, }); + +INTERACTIONS_RUNNER.addTest({ + name: 'Detect duplicate globals from two PRO files', + fn: DuplicateGlobals, +}); + +INTERACTIONS_RUNNER.addTest({ + name: 'Detect duplicate globals from PRO and def files', + fn: DuplicateGlobalsFromDefs, +}); + +INTERACTIONS_RUNNER.addTest({ + name: 'Detect duplicate globals from only def files', + fn: DuplicateGlobalsFromOnlyDefs, +}); + +INTERACTIONS_RUNNER.addTest({ + name: 'Advanced change detection from routines changing', + fn: RoutineChange, +}); diff --git a/apps/client-e2e/src/tests/interactions/basic-interactions/def-files-interact-right.ts b/apps/client-e2e/src/tests/interactions/basic-interactions/def-files-interact-right.ts new file mode 100644 index 000000000..1f784656b --- /dev/null +++ b/apps/client-e2e/src/tests/interactions/basic-interactions/def-files-interact-right.ts @@ -0,0 +1,114 @@ +import { GetExtensionPath, Sleep } from '@idl/shared'; +import { OpenFileInVSCode, ReplaceDocumentContent } from '@idl/vscode/shared'; +import expect from 'expect'; +import { readFileSync } from 'fs'; +import * as vscode from 'vscode'; +import { + SemanticTokens, + SemanticTokensParams, + TextDocumentPositionParams, +} from 'vscode-languageserver'; + +import { CLIENT_E2E_CONFIG } from '../../client-e2e-config.interface'; +import { RunnerFunction } from '../../runner.interface'; + +/** + * Verifies working with notebooks does the right thing with changes and doesnt trigger + * PRO code parsing in the language server + */ +export const DefFilesInteractRight: RunnerFunction = async (init) => { + const doc = await OpenFileInVSCode( + GetExtensionPath('idl/test/client-e2e/def-files/testclente2e.pro.def') + ); + + // short pause to make sure we open and parse + await Sleep(CLIENT_E2E_CONFIG.DELAYS.DEFAULT); + + /** + * Get URi for the notebook + */ + const uri = doc.uri.toString(); + + /** + * Event params for LSP user interaction + */ + const hoverParams: TextDocumentPositionParams = { + textDocument: { + uri, + }, + position: { + line: 25, + character: 11, + }, + }; + + // verify hover has return + expect( + await init.client.client.sendRequest('textDocument/hover', hoverParams) + ).toBeTruthy(); + + // verify definition has return + expect( + await init.client.client.sendRequest('textDocument/definition', hoverParams) + ).toBeFalsy(); + + /** + * Event params for LSP user interaction + */ + const completionParams: TextDocumentPositionParams = { + textDocument: { + uri, + }, + position: { + line: 26, + character: 0, + }, + }; + + // verify definition has return + expect( + await init.client.client.sendRequest( + 'textDocument/completion', + completionParams + ) + ).toBeFalsy(); + + /** + * Event params for LSP semantic token request + */ + const tokenParams: SemanticTokensParams = { + textDocument: { + uri: uri, + }, + }; + + // verify semantic tokens + expect( + (await init.client.client.sendRequest( + 'textDocument/semanticTokens/full', + tokenParams + )) as SemanticTokens + ).toBeFalsy(); + + /** + * Get number of original diagnostics + */ + const nOrig = vscode.languages.getDiagnostics(doc.uri).length; + + // replace the content in our document + await ReplaceDocumentContent( + doc, + readFileSync( + GetExtensionPath( + 'idl/test/client-e2e/def-files/testclente2e-changes.pro.def' + ), + 'utf-8' + ) + ); + + // short pause + await Sleep(CLIENT_E2E_CONFIG.DELAYS.DEFAULT); + + // verify problems + expect(vscode.languages.getDiagnostics(doc.uri).length).toEqual(nOrig); +}; diff --git a/apps/client-e2e/src/tests/interactions/idl-json-interact-right.ts b/apps/client-e2e/src/tests/interactions/basic-interactions/idl-json-interact-right.ts similarity index 89% rename from apps/client-e2e/src/tests/interactions/idl-json-interact-right.ts rename to apps/client-e2e/src/tests/interactions/basic-interactions/idl-json-interact-right.ts index 64968613c..29c902d22 100644 --- a/apps/client-e2e/src/tests/interactions/idl-json-interact-right.ts +++ b/apps/client-e2e/src/tests/interactions/basic-interactions/idl-json-interact-right.ts @@ -8,7 +8,8 @@ import { TextDocumentPositionParams, } from 'vscode-languageserver'; -import { RunnerFunction } from '../runner.interface'; +import { CLIENT_E2E_CONFIG } from '../../client-e2e-config.interface'; +import { RunnerFunction } from '../../runner.interface'; /** * Verifies idl.json does the right thing with changes and doesnt trigger @@ -20,7 +21,7 @@ export const IDLJSONInteractRight: RunnerFunction = async (init) => { ); // short pause to make sure we open and parse - await Sleep(250); + await Sleep(CLIENT_E2E_CONFIG.DELAYS.DEFAULT); /** * Get number of original diagnostics @@ -37,7 +38,7 @@ export const IDLJSONInteractRight: RunnerFunction = async (init) => { ); // short pause - await Sleep(250); + await Sleep(CLIENT_E2E_CONFIG.DELAYS.DEFAULT); // verify problems expect(vscode.languages.getDiagnostics(doc.uri).length).toEqual(nOrig); diff --git a/apps/client-e2e/src/tests/interactions/index-idl-folder-right-and-open-edit-close.ts b/apps/client-e2e/src/tests/interactions/basic-interactions/index-idl-folder-right-and-open-edit-close.ts similarity index 84% rename from apps/client-e2e/src/tests/interactions/index-idl-folder-right-and-open-edit-close.ts rename to apps/client-e2e/src/tests/interactions/basic-interactions/index-idl-folder-right-and-open-edit-close.ts index eb9239ec8..3d3b54be2 100644 --- a/apps/client-e2e/src/tests/interactions/index-idl-folder-right-and-open-edit-close.ts +++ b/apps/client-e2e/src/tests/interactions/basic-interactions/index-idl-folder-right-and-open-edit-close.ts @@ -8,7 +8,8 @@ import expect from 'expect'; import { readFileSync } from 'fs'; import * as vscode from 'vscode'; -import { RunnerFunction } from '../runner.interface'; +import { CLIENT_E2E_CONFIG } from '../../client-e2e-config.interface'; +import { RunnerFunction } from '../../runner.interface'; /** * Verify that we index the "idl" folder correctly in the extension @@ -27,7 +28,7 @@ export const IndexIDLFolderRightAndOpenEditClose: RunnerFunction = async ( ); // short pause to make sure we open and parse - await Sleep(250); + await Sleep(CLIENT_E2E_CONFIG.DELAYS.DEFAULT); // verify problems expect(vscode.languages.getDiagnostics(doc.uri).length).toEqual(0); @@ -42,7 +43,7 @@ export const IndexIDLFolderRightAndOpenEditClose: RunnerFunction = async ( ); // short pause - await Sleep(250); + await Sleep(CLIENT_E2E_CONFIG.DELAYS.DEFAULT); // verify problems expect(vscode.languages.getDiagnostics(doc.uri).length).toEqual(1); @@ -51,7 +52,7 @@ export const IndexIDLFolderRightAndOpenEditClose: RunnerFunction = async ( await vscode.commands.executeCommand(VSCODE_COMMANDS.CLOSE_EDITOR); // short pause - await Sleep(250); + await Sleep(CLIENT_E2E_CONFIG.DELAYS.DEFAULT); // verify problems are empty again via original content expect(vscode.languages.getDiagnostics(doc.uri).length).toEqual(0); diff --git a/apps/client-e2e/src/tests/interactions/pro-code-interacts-right.ts b/apps/client-e2e/src/tests/interactions/basic-interactions/pro-code-interacts-right.ts similarity index 88% rename from apps/client-e2e/src/tests/interactions/pro-code-interacts-right.ts rename to apps/client-e2e/src/tests/interactions/basic-interactions/pro-code-interacts-right.ts index cb1e03d80..91c03be4f 100644 --- a/apps/client-e2e/src/tests/interactions/pro-code-interacts-right.ts +++ b/apps/client-e2e/src/tests/interactions/basic-interactions/pro-code-interacts-right.ts @@ -1,4 +1,4 @@ -import { GetExtensionPath } from '@idl/shared'; +import { GetExtensionPath, Sleep } from '@idl/shared'; import { OpenFileInVSCode } from '@idl/vscode/shared'; import expect from 'expect'; import { @@ -7,7 +7,8 @@ import { TextDocumentPositionParams, } from 'vscode-languageserver'; -import { RunnerFunction } from '../runner.interface'; +import { CLIENT_E2E_CONFIG } from '../../client-e2e-config.interface'; +import { RunnerFunction } from '../../runner.interface'; /** * Verifies working with pro code does the right thing with changes and doesnt trigger @@ -18,6 +19,8 @@ export const ProCodeInteractRight: RunnerFunction = async (init) => { GetExtensionPath('idl/test/client-e2e/test_user_interaction.pro') ); + await Sleep(CLIENT_E2E_CONFIG.DELAYS.DEFAULT); + /** * Get URi for the notebook */ diff --git a/apps/client-e2e/src/tests/interactions/tasks-interact-right.ts b/apps/client-e2e/src/tests/interactions/basic-interactions/tasks-interact-right.ts similarity index 89% rename from apps/client-e2e/src/tests/interactions/tasks-interact-right.ts rename to apps/client-e2e/src/tests/interactions/basic-interactions/tasks-interact-right.ts index b520e28be..a1f3b941d 100644 --- a/apps/client-e2e/src/tests/interactions/tasks-interact-right.ts +++ b/apps/client-e2e/src/tests/interactions/basic-interactions/tasks-interact-right.ts @@ -8,7 +8,8 @@ import { TextDocumentPositionParams, } from 'vscode-languageserver'; -import { RunnerFunction } from '../runner.interface'; +import { CLIENT_E2E_CONFIG } from '../../client-e2e-config.interface'; +import { RunnerFunction } from '../../runner.interface'; /** * Verifies working with tasks does the right thing with changes and doesnt trigger @@ -20,7 +21,7 @@ export const TasksInteractRight: RunnerFunction = async (init) => { ); // short pause to make sure we open and parse - await Sleep(250); + await Sleep(CLIENT_E2E_CONFIG.DELAYS.DEFAULT); /** * Get number of original diagnostics @@ -37,7 +38,7 @@ export const TasksInteractRight: RunnerFunction = async (init) => { ); // short pause - await Sleep(250); + await Sleep(CLIENT_E2E_CONFIG.DELAYS.DEFAULT); // verify problems expect(vscode.languages.getDiagnostics(doc.uri).length).toEqual(nOrig); diff --git a/apps/client-e2e/src/tests/interactions/change-detection/duplicate-globals-from-defs.ts b/apps/client-e2e/src/tests/interactions/change-detection/duplicate-globals-from-defs.ts new file mode 100644 index 000000000..195e1dfa2 --- /dev/null +++ b/apps/client-e2e/src/tests/interactions/change-detection/duplicate-globals-from-defs.ts @@ -0,0 +1,30 @@ +import { GetExtensionPath, Sleep } from '@idl/shared'; +import { OpenFileInVSCode } from '@idl/vscode/shared'; +import expect from 'expect'; +import * as vscode from 'vscode'; + +import { CLIENT_E2E_CONFIG } from '../../client-e2e-config.interface'; +import { RunnerFunction } from '../../runner.interface'; + +/** + * Make sure that we properly detect issues with global tokens + * to report duplicate routines from def files + */ +export const DuplicateGlobalsFromDefs: RunnerFunction = async (init) => { + const doc1 = await OpenFileInVSCode( + GetExtensionPath('idl/test/client-e2e/change-detection/mypro2.pro') + ); + + const doc2 = await OpenFileInVSCode( + GetExtensionPath('idl/test/client-e2e/change-detection/mypro2.pro.def') + ); + + // short pause to make sure we open and parse + await Sleep(CLIENT_E2E_CONFIG.DELAYS.DEFAULT); + + // verify problems + expect(vscode.languages.getDiagnostics(doc1.uri).length).toEqual(1); + + // verify problems + expect(vscode.languages.getDiagnostics(doc2.uri).length).toEqual(1); +}; diff --git a/apps/client-e2e/src/tests/interactions/change-detection/duplicate-globals-from-only-defs.ts b/apps/client-e2e/src/tests/interactions/change-detection/duplicate-globals-from-only-defs.ts new file mode 100644 index 000000000..63a127833 --- /dev/null +++ b/apps/client-e2e/src/tests/interactions/change-detection/duplicate-globals-from-only-defs.ts @@ -0,0 +1,30 @@ +import { GetExtensionPath, Sleep } from '@idl/shared'; +import { OpenFileInVSCode } from '@idl/vscode/shared'; +import expect from 'expect'; +import * as vscode from 'vscode'; + +import { CLIENT_E2E_CONFIG } from '../../client-e2e-config.interface'; +import { RunnerFunction } from '../../runner.interface'; + +/** + * Make sure that we properly detect issues with global tokens + * to report duplicate routines from only def files + */ +export const DuplicateGlobalsFromOnlyDefs: RunnerFunction = async (init) => { + const doc1 = await OpenFileInVSCode( + GetExtensionPath('idl/test/client-e2e/change-detection/mypro3.pro.def') + ); + + const doc2 = await OpenFileInVSCode( + GetExtensionPath('idl/test/client-e2e/change-detection/mypro3-dup.pro.def') + ); + + // short pause to make sure we open and parse + await Sleep(CLIENT_E2E_CONFIG.DELAYS.DEFAULT); + + // verify problems + expect(vscode.languages.getDiagnostics(doc1.uri).length).toEqual(1); + + // verify problems + expect(vscode.languages.getDiagnostics(doc2.uri).length).toEqual(1); +}; diff --git a/apps/client-e2e/src/tests/interactions/change-detection/duplicate-globals.ts b/apps/client-e2e/src/tests/interactions/change-detection/duplicate-globals.ts new file mode 100644 index 000000000..e1749d418 --- /dev/null +++ b/apps/client-e2e/src/tests/interactions/change-detection/duplicate-globals.ts @@ -0,0 +1,30 @@ +import { GetExtensionPath, Sleep } from '@idl/shared'; +import { OpenFileInVSCode } from '@idl/vscode/shared'; +import expect from 'expect'; +import * as vscode from 'vscode'; + +import { CLIENT_E2E_CONFIG } from '../../client-e2e-config.interface'; +import { RunnerFunction } from '../../runner.interface'; + +/** + * Make sure that we properly detect issues with global tokens + * to report duplicate routines + */ +export const DuplicateGlobals: RunnerFunction = async (init) => { + const doc1 = await OpenFileInVSCode( + GetExtensionPath('idl/test/client-e2e/change-detection/mypro1.pro') + ); + + const doc2 = await OpenFileInVSCode( + GetExtensionPath('idl/test/client-e2e/change-detection/mypro1-dup.pro') + ); + + // short pause to make sure we open and parse + await Sleep(CLIENT_E2E_CONFIG.DELAYS.DEFAULT); + + // verify problems + expect(vscode.languages.getDiagnostics(doc1.uri).length).toEqual(1); + + // verify problems + expect(vscode.languages.getDiagnostics(doc2.uri).length).toEqual(1); +}; diff --git a/apps/client-e2e/src/tests/interactions/change-detection/routine-change.ts b/apps/client-e2e/src/tests/interactions/change-detection/routine-change.ts new file mode 100644 index 000000000..b1ba2e88d --- /dev/null +++ b/apps/client-e2e/src/tests/interactions/change-detection/routine-change.ts @@ -0,0 +1,68 @@ +import { GetExtensionPath, Sleep } from '@idl/shared'; +import { OpenFileInVSCode, ReplaceDocumentContent } from '@idl/vscode/shared'; +import expect from 'expect'; +import { readFileSync } from 'fs'; +import * as vscode from 'vscode'; + +import { CLIENT_E2E_CONFIG } from '../../client-e2e-config.interface'; +import { RunnerFunction } from '../../runner.interface'; + +/** + * Detects problems from changes in routines + */ +export const RoutineChange: RunnerFunction = async (init) => { + const doc1 = await OpenFileInVSCode( + GetExtensionPath('idl/test/client-e2e/change-detection/file1.pro') + ); + + const doc2 = await OpenFileInVSCode( + GetExtensionPath('idl/test/client-e2e/change-detection/file2.pro'), + true, + true + ); + + // short pause to make sure we open and parse + await Sleep(CLIENT_E2E_CONFIG.DELAYS.PROBLEMS_NOTEBOOK); + + // verify problems + expect(vscode.languages.getDiagnostics(doc1.uri).length).toEqual(0); + + // verify problems + expect(vscode.languages.getDiagnostics(doc2.uri).length).toEqual(0); + + // replace the content in our document + await ReplaceDocumentContent( + doc2, + readFileSync( + GetExtensionPath('idl/test/client-e2e/change-detection/file2-after.pro'), + 'utf-8' + ) + ); + + // short pause + await Sleep(CLIENT_E2E_CONFIG.DELAYS.PROBLEMS_NOTEBOOK); + + // verify problems + expect(vscode.languages.getDiagnostics(doc1.uri).length).toEqual(1); + + // verify problems + expect(vscode.languages.getDiagnostics(doc2.uri).length).toEqual(0); + + // replace the content in our document + await ReplaceDocumentContent( + doc2, + readFileSync( + GetExtensionPath('idl/test/client-e2e/change-detection/file2.pro'), + 'utf-8' + ) + ); + + // short pause + await Sleep(CLIENT_E2E_CONFIG.DELAYS.PROBLEMS_NOTEBOOK); + + // verify problems + expect(vscode.languages.getDiagnostics(doc1.uri).length).toEqual(0); + + // verify problems + expect(vscode.languages.getDiagnostics(doc2.uri).length).toEqual(0); +}; diff --git a/apps/client-e2e/src/tests/interactions/execute-code-actions-with-edits.ts b/apps/client-e2e/src/tests/interactions/code-actions/execute-code-actions-with-edits.ts similarity index 92% rename from apps/client-e2e/src/tests/interactions/execute-code-actions-with-edits.ts rename to apps/client-e2e/src/tests/interactions/code-actions/execute-code-actions-with-edits.ts index 494f8d0c6..2e6acf21d 100644 --- a/apps/client-e2e/src/tests/interactions/execute-code-actions-with-edits.ts +++ b/apps/client-e2e/src/tests/interactions/code-actions/execute-code-actions-with-edits.ts @@ -5,8 +5,8 @@ import expect from 'expect'; import { readFileSync } from 'fs'; import * as vscode from 'vscode'; -import { CLIENT_E2E_CONFIG } from '../client-e2e-config.interface'; -import { RunnerFunction } from '../runner.interface'; +import { CLIENT_E2E_CONFIG } from '../../client-e2e-config.interface'; +import { RunnerFunction } from '../../runner.interface'; /** * Verifies code actions do the right thing for PRO files @@ -19,7 +19,7 @@ export const ExecuteCodeActionsWithEditForPROFile: RunnerFunction = async ( ); // short pause to make sure we open and parse - await Sleep(250); + await Sleep(CLIENT_E2E_CONFIG.DELAYS.DEFAULT); const edit: AutoFixProblem = [ { diff --git a/apps/client-e2e/src/tests/interactions/pro-code-code-actions-notebook.ts b/apps/client-e2e/src/tests/interactions/code-actions/pro-code-code-actions-notebook.ts similarity index 94% rename from apps/client-e2e/src/tests/interactions/pro-code-code-actions-notebook.ts rename to apps/client-e2e/src/tests/interactions/code-actions/pro-code-code-actions-notebook.ts index 8fe46d660..8612e70df 100644 --- a/apps/client-e2e/src/tests/interactions/pro-code-code-actions-notebook.ts +++ b/apps/client-e2e/src/tests/interactions/code-actions/pro-code-code-actions-notebook.ts @@ -4,7 +4,8 @@ import expect from 'expect'; import * as vscode from 'vscode'; import { CodeActionParams } from 'vscode-languageserver'; -import { RunnerFunction } from '../runner.interface'; +import { CLIENT_E2E_CONFIG } from '../../client-e2e-config.interface'; +import { RunnerFunction } from '../../runner.interface'; /** * Verifies code actions do the right thing for notebooks @@ -19,7 +20,7 @@ export const ProCodeCodeActionsNotebook: RunnerFunction = async (init) => { const doc = nb.getCells()[0].document; // short pause to make sure we open and parse - await Sleep(1000); + await Sleep(CLIENT_E2E_CONFIG.DELAYS.DEFAULT); // get diagnostics const diags = GetRealDiagnostic(vscode.languages.getDiagnostics(doc.uri)); diff --git a/apps/client-e2e/src/tests/interactions/pro-code-code-actions.ts b/apps/client-e2e/src/tests/interactions/code-actions/pro-code-code-actions.ts similarity index 97% rename from apps/client-e2e/src/tests/interactions/pro-code-code-actions.ts rename to apps/client-e2e/src/tests/interactions/code-actions/pro-code-code-actions.ts index d0746e721..ade5682bd 100644 --- a/apps/client-e2e/src/tests/interactions/pro-code-code-actions.ts +++ b/apps/client-e2e/src/tests/interactions/code-actions/pro-code-code-actions.ts @@ -4,7 +4,8 @@ import expect from 'expect'; import * as vscode from 'vscode'; import { CodeActionParams } from 'vscode-languageserver'; -import { RunnerFunction } from '../runner.interface'; +import { CLIENT_E2E_CONFIG } from '../../client-e2e-config.interface'; +import { RunnerFunction } from '../../runner.interface'; /** * Verifies code actions do the right thing @@ -15,7 +16,7 @@ export const ProCodeCodeActionsNoExisting: RunnerFunction = async (init) => { ); // short pause to make sure we open and parse - await Sleep(1000); + await Sleep(CLIENT_E2E_CONFIG.DELAYS.DEFAULT); // get diagnostics const diags = GetRealDiagnostic(vscode.languages.getDiagnostics(doc.uri)); diff --git a/apps/client-e2e/src/tests/interactions/add-docs.ts b/apps/client-e2e/src/tests/interactions/commands/add-docs.ts similarity index 96% rename from apps/client-e2e/src/tests/interactions/add-docs.ts rename to apps/client-e2e/src/tests/interactions/commands/add-docs.ts index 22632b518..c810bfd0d 100644 --- a/apps/client-e2e/src/tests/interactions/add-docs.ts +++ b/apps/client-e2e/src/tests/interactions/commands/add-docs.ts @@ -4,7 +4,7 @@ import expect from 'expect'; import { readFileSync } from 'fs'; import * as vscode from 'vscode'; -import { RunnerFunction } from '../runner.interface'; +import { RunnerFunction } from '../../runner.interface'; /** * Function that verifies we can correctly add docs to text document diff --git a/apps/client-e2e/src/tests/interactions/migrate-code-dl-3.0.ts b/apps/client-e2e/src/tests/interactions/commands/migrate-code-dl-3.0.ts similarity index 83% rename from apps/client-e2e/src/tests/interactions/migrate-code-dl-3.0.ts rename to apps/client-e2e/src/tests/interactions/commands/migrate-code-dl-3.0.ts index 7b38408b8..eff3022f2 100644 --- a/apps/client-e2e/src/tests/interactions/migrate-code-dl-3.0.ts +++ b/apps/client-e2e/src/tests/interactions/commands/migrate-code-dl-3.0.ts @@ -4,7 +4,8 @@ import expect from 'expect'; import { readFileSync } from 'fs'; import * as vscode from 'vscode'; -import { RunnerFunction } from '../runner.interface'; +import { CLIENT_E2E_CONFIG } from '../../client-e2e-config.interface'; +import { RunnerFunction } from '../../runner.interface'; /** * Function that verifies we can correctly migrate code to ENVI DL 3.0 API @@ -15,13 +16,13 @@ export const MigrateCodeDL30: RunnerFunction = async (init) => { ); // short pause to make sure we open and parse - await Sleep(100); + await Sleep(CLIENT_E2E_CONFIG.DELAYS.DEFAULT); // add docs await vscode.commands.executeCommand(IDL_COMMANDS.CODE.MIGRATE_TO_DL30_API); // short pause - await Sleep(100); + await Sleep(CLIENT_E2E_CONFIG.DELAYS.DEFAULT); // make sure output is correct expect(doc.getText()).toEqual( @@ -35,7 +36,7 @@ export const MigrateCodeDL30: RunnerFunction = async (init) => { await vscode.commands.executeCommand(IDL_COMMANDS.CODE.MIGRATE_TO_DL30_API); // short pause - await Sleep(100); + await Sleep(CLIENT_E2E_CONFIG.DELAYS.DEFAULT); // verify we have the same code expect(doc.getText()).toEqual( @@ -55,13 +56,13 @@ export const MigrateCodeDL30_2: RunnerFunction = async (init) => { ); // short pause to make sure we open and parse - await Sleep(100); + await Sleep(CLIENT_E2E_CONFIG.DELAYS.DEFAULT); // add docs await vscode.commands.executeCommand(IDL_COMMANDS.CODE.MIGRATE_TO_DL30_API); // short pause - await Sleep(100); + await Sleep(CLIENT_E2E_CONFIG.DELAYS.DEFAULT); // make sure output is correct expect(doc.getText()).toEqual( @@ -75,7 +76,7 @@ export const MigrateCodeDL30_2: RunnerFunction = async (init) => { await vscode.commands.executeCommand(IDL_COMMANDS.CODE.MIGRATE_TO_DL30_API); // short pause - await Sleep(100); + await Sleep(CLIENT_E2E_CONFIG.DELAYS.DEFAULT); // verify we have the same code expect(doc.getText()).toEqual( diff --git a/apps/client-e2e/src/tests/interactions/idl-disable-all-from-setting-for-notebook.ts b/apps/client-e2e/src/tests/interactions/disable-problems/idl-disable-all-from-setting-for-notebook.ts similarity index 93% rename from apps/client-e2e/src/tests/interactions/idl-disable-all-from-setting-for-notebook.ts rename to apps/client-e2e/src/tests/interactions/disable-problems/idl-disable-all-from-setting-for-notebook.ts index 5fc4a2545..df8a507c9 100644 --- a/apps/client-e2e/src/tests/interactions/idl-disable-all-from-setting-for-notebook.ts +++ b/apps/client-e2e/src/tests/interactions/disable-problems/idl-disable-all-from-setting-for-notebook.ts @@ -5,8 +5,8 @@ import { OpenNotebookInVSCode } from '@idl/vscode/shared'; import expect from 'expect'; import * as vscode from 'vscode'; -import { CLIENT_E2E_CONFIG } from '../client-e2e-config.interface'; -import { RunnerFunction } from '../runner.interface'; +import { CLIENT_E2E_CONFIG } from '../../client-e2e-config.interface'; +import { RunnerFunction } from '../../runner.interface'; /** * Makes sure that we can disable reporting of problems using our settings and that diff --git a/apps/client-e2e/src/tests/interactions/idl-disable-all-from-setting.ts b/apps/client-e2e/src/tests/interactions/disable-problems/idl-disable-all-from-setting.ts similarity index 81% rename from apps/client-e2e/src/tests/interactions/idl-disable-all-from-setting.ts rename to apps/client-e2e/src/tests/interactions/disable-problems/idl-disable-all-from-setting.ts index 8885d52aa..3dedf2787 100644 --- a/apps/client-e2e/src/tests/interactions/idl-disable-all-from-setting.ts +++ b/apps/client-e2e/src/tests/interactions/disable-problems/idl-disable-all-from-setting.ts @@ -5,8 +5,8 @@ import { OpenFileInVSCode } from '@idl/vscode/shared'; import expect from 'expect'; import * as vscode from 'vscode'; -import { CLIENT_E2E_CONFIG } from '../client-e2e-config.interface'; -import { RunnerFunction } from '../runner.interface'; +import { CLIENT_E2E_CONFIG } from '../../client-e2e-config.interface'; +import { RunnerFunction } from '../../runner.interface'; /** * Makes sure that we can disable reporting of problems using our settings @@ -21,7 +21,7 @@ export const IDLDisableAllFromSettings: RunnerFunction = async () => { ); // short pause to make sure we open and parse - await Sleep(CLIENT_E2E_CONFIG.DELAYS.DEFAULT); + await Sleep(CLIENT_E2E_CONFIG.DELAYS.PROBLEMS_NOTEBOOK); // verify problems expect(vscode.languages.getDiagnostics(doc.uri).length).toEqual(3); @@ -34,7 +34,7 @@ export const IDLDisableAllFromSettings: RunnerFunction = async () => { ); // short pause - await Sleep(CLIENT_E2E_CONFIG.DELAYS.DEFAULT); + await Sleep(CLIENT_E2E_CONFIG.DELAYS.PROBLEMS_NOTEBOOK); // verify no problems expect(vscode.languages.getDiagnostics(doc.uri).length).toEqual(0); @@ -47,7 +47,7 @@ export const IDLDisableAllFromSettings: RunnerFunction = async () => { ); // short pause to make sure we open and parse - await Sleep(CLIENT_E2E_CONFIG.DELAYS.DEFAULT); + await Sleep(CLIENT_E2E_CONFIG.DELAYS.PROBLEMS_NOTEBOOK); // verify problems are back to normal expect(vscode.languages.getDiagnostics(doc.uri).length).toEqual(3); diff --git a/apps/client-e2e/src/tests/interactions/idl-disable-from-comments.ts b/apps/client-e2e/src/tests/interactions/disable-problems/idl-disable-from-comments.ts similarity index 83% rename from apps/client-e2e/src/tests/interactions/idl-disable-from-comments.ts rename to apps/client-e2e/src/tests/interactions/disable-problems/idl-disable-from-comments.ts index d1f33002a..7cd8adfaa 100644 --- a/apps/client-e2e/src/tests/interactions/idl-disable-from-comments.ts +++ b/apps/client-e2e/src/tests/interactions/disable-problems/idl-disable-from-comments.ts @@ -4,8 +4,8 @@ import expect from 'expect'; import { readFileSync } from 'fs'; import * as vscode from 'vscode'; -import { CLIENT_E2E_CONFIG } from '../client-e2e-config.interface'; -import { RunnerFunction } from '../runner.interface'; +import { CLIENT_E2E_CONFIG } from '../../client-e2e-config.interface'; +import { RunnerFunction } from '../../runner.interface'; /** * Makes sure that we can disable reporting of all problems using comments in IDL @@ -16,7 +16,7 @@ export const IDLDisableAllFromComments: RunnerFunction = async (init) => { ); // short pause to make sure we open and parse - await Sleep(1000); + await Sleep(CLIENT_E2E_CONFIG.DELAYS.PROBLEMS_NOTEBOOK); // verify problems expect(vscode.languages.getDiagnostics(doc.uri).length).toEqual(3); @@ -33,7 +33,7 @@ export const IDLDisableAllFromComments: RunnerFunction = async (init) => { ); // short pause - await Sleep(1000); + await Sleep(CLIENT_E2E_CONFIG.DELAYS.PROBLEMS_NOTEBOOK); // verify problems expect(vscode.languages.getDiagnostics(doc.uri).length).toEqual(0); @@ -50,7 +50,7 @@ export const IDLDisableLinesFromComments: RunnerFunction = async (init) => { ); // short pause to make sure we open and parse - await Sleep(CLIENT_E2E_CONFIG.DELAYS.DEFAULT); + await Sleep(CLIENT_E2E_CONFIG.DELAYS.PROBLEMS_NOTEBOOK); // verify problems expect(vscode.languages.getDiagnostics(doc.uri).length).toEqual(3); @@ -67,7 +67,7 @@ export const IDLDisableLinesFromComments: RunnerFunction = async (init) => { ); // short pause - await Sleep(CLIENT_E2E_CONFIG.DELAYS.DEFAULT); + await Sleep(CLIENT_E2E_CONFIG.DELAYS.PROBLEMS_NOTEBOOK); // verify problems expect(vscode.languages.getDiagnostics(doc.uri).length).toEqual(1); diff --git a/apps/client-e2e/src/tests/interactions/idl-disable-individuals-from-setting-for-notebook.ts b/apps/client-e2e/src/tests/interactions/disable-problems/idl-disable-individuals-from-setting-for-notebook.ts similarity index 95% rename from apps/client-e2e/src/tests/interactions/idl-disable-individuals-from-setting-for-notebook.ts rename to apps/client-e2e/src/tests/interactions/disable-problems/idl-disable-individuals-from-setting-for-notebook.ts index b62d6664a..0ef5575c5 100644 --- a/apps/client-e2e/src/tests/interactions/idl-disable-individuals-from-setting-for-notebook.ts +++ b/apps/client-e2e/src/tests/interactions/disable-problems/idl-disable-individuals-from-setting-for-notebook.ts @@ -7,8 +7,8 @@ import { OpenNotebookInVSCode } from '@idl/vscode/shared'; import expect from 'expect'; import * as vscode from 'vscode'; -import { CLIENT_E2E_CONFIG } from '../client-e2e-config.interface'; -import { RunnerFunction } from '../runner.interface'; +import { CLIENT_E2E_CONFIG } from '../../client-e2e-config.interface'; +import { RunnerFunction } from '../../runner.interface'; /** * Makes sure that we can disable single problems and it works for notebooks diff --git a/apps/client-e2e/src/tests/interactions/idl-disable-individuals-from-setting.ts b/apps/client-e2e/src/tests/interactions/disable-problems/idl-disable-individuals-from-setting.ts similarity index 86% rename from apps/client-e2e/src/tests/interactions/idl-disable-individuals-from-setting.ts rename to apps/client-e2e/src/tests/interactions/disable-problems/idl-disable-individuals-from-setting.ts index fc50024cd..8b8f3699c 100644 --- a/apps/client-e2e/src/tests/interactions/idl-disable-individuals-from-setting.ts +++ b/apps/client-e2e/src/tests/interactions/disable-problems/idl-disable-individuals-from-setting.ts @@ -7,8 +7,8 @@ import { OpenFileInVSCode } from '@idl/vscode/shared'; import expect from 'expect'; import * as vscode from 'vscode'; -import { CLIENT_E2E_CONFIG } from '../client-e2e-config.interface'; -import { RunnerFunction } from '../runner.interface'; +import { CLIENT_E2E_CONFIG } from '../../client-e2e-config.interface'; +import { RunnerFunction } from '../../runner.interface'; /** * Makes sure that we can disable single problems @@ -20,7 +20,7 @@ export const IDLDisableIndividualsFromSettings: RunnerFunction = async () => { ); // short pause to make sure we open and parse - await Sleep(250); + await Sleep(CLIENT_E2E_CONFIG.DELAYS.PROBLEMS_NOTEBOOK); // verify problems expect(vscode.languages.getDiagnostics(doc.uri).length).toEqual(3); @@ -38,7 +38,7 @@ export const IDLDisableIndividualsFromSettings: RunnerFunction = async () => { ); // short pause - await Sleep(CLIENT_E2E_CONFIG.DELAYS.DEFAULT); + await Sleep(CLIENT_E2E_CONFIG.DELAYS.PROBLEMS_NOTEBOOK); // make sure it ran fine expect(ok).toBeTruthy(); @@ -66,7 +66,7 @@ export const IDLDisableIndividualsFromSettings: RunnerFunction = async () => { ); // short pause to make sure we have updates - await Sleep(CLIENT_E2E_CONFIG.DELAYS.DEFAULT); + await Sleep(CLIENT_E2E_CONFIG.DELAYS.PROBLEMS_NOTEBOOK); // verify problems are back at the original value expect(vscode.languages.getDiagnostics(doc.uri).length).toEqual(3); diff --git a/apps/client-e2e/src/tests/interactions/notebook-implied-print-problem-reporting.ts b/apps/client-e2e/src/tests/interactions/notebooks/notebook-implied-print-problem-reporting.ts similarity index 86% rename from apps/client-e2e/src/tests/interactions/notebook-implied-print-problem-reporting.ts rename to apps/client-e2e/src/tests/interactions/notebooks/notebook-implied-print-problem-reporting.ts index 52a184526..0f68d642c 100644 --- a/apps/client-e2e/src/tests/interactions/notebook-implied-print-problem-reporting.ts +++ b/apps/client-e2e/src/tests/interactions/notebooks/notebook-implied-print-problem-reporting.ts @@ -3,8 +3,8 @@ import { OpenNotebookInVSCode } from '@idl/vscode/shared'; import expect from 'expect'; import * as vscode from 'vscode'; -import { CLIENT_E2E_CONFIG } from '../client-e2e-config.interface'; -import { RunnerFunction } from '../runner.interface'; +import { CLIENT_E2E_CONFIG } from '../../client-e2e-config.interface'; +import { RunnerFunction } from '../../runner.interface'; /** * Function that verifies problems reported for implied print diff --git a/apps/client-e2e/src/tests/interactions/notebook-problems-track-right.ts b/apps/client-e2e/src/tests/interactions/notebooks/notebook-problems-track-right.ts similarity index 93% rename from apps/client-e2e/src/tests/interactions/notebook-problems-track-right.ts rename to apps/client-e2e/src/tests/interactions/notebooks/notebook-problems-track-right.ts index 57a976b1d..b2204d5dd 100644 --- a/apps/client-e2e/src/tests/interactions/notebook-problems-track-right.ts +++ b/apps/client-e2e/src/tests/interactions/notebooks/notebook-problems-track-right.ts @@ -3,8 +3,8 @@ import { OpenNotebookInVSCode } from '@idl/vscode/shared'; import expect from 'expect'; import * as vscode from 'vscode'; -import { CLIENT_E2E_CONFIG } from '../client-e2e-config.interface'; -import { RunnerFunction } from '../runner.interface'; +import { CLIENT_E2E_CONFIG } from '../../client-e2e-config.interface'; +import { RunnerFunction } from '../../runner.interface'; /** * Function that verifies adding a new cell does not accidentally inherit old problems diff --git a/apps/client-e2e/src/tests/interactions/notebooks-completion-basic.ts b/apps/client-e2e/src/tests/interactions/notebooks/notebooks-completion-basic.ts similarity index 93% rename from apps/client-e2e/src/tests/interactions/notebooks-completion-basic.ts rename to apps/client-e2e/src/tests/interactions/notebooks/notebooks-completion-basic.ts index 33f9c7f87..9fdc6d9ab 100644 --- a/apps/client-e2e/src/tests/interactions/notebooks-completion-basic.ts +++ b/apps/client-e2e/src/tests/interactions/notebooks/notebooks-completion-basic.ts @@ -6,8 +6,8 @@ import { TextDocumentPositionParams, } from 'vscode-languageserver'; -import { CLIENT_E2E_CONFIG } from '../client-e2e-config.interface'; -import { RunnerFunction } from '../runner.interface'; +import { CLIENT_E2E_CONFIG } from '../../client-e2e-config.interface'; +import { RunnerFunction } from '../../runner.interface'; /** * Verifies working with notebooks does the right thing with changes and doesnt trigger diff --git a/apps/client-e2e/src/tests/interactions/notebooks-interact-right.ts b/apps/client-e2e/src/tests/interactions/notebooks/notebooks-interact-right.ts similarity index 97% rename from apps/client-e2e/src/tests/interactions/notebooks-interact-right.ts rename to apps/client-e2e/src/tests/interactions/notebooks/notebooks-interact-right.ts index 3f2ba01af..c7ea04c77 100644 --- a/apps/client-e2e/src/tests/interactions/notebooks-interact-right.ts +++ b/apps/client-e2e/src/tests/interactions/notebooks/notebooks-interact-right.ts @@ -7,7 +7,7 @@ import { TextDocumentPositionParams, } from 'vscode-languageserver'; -import { RunnerFunction } from '../runner.interface'; +import { RunnerFunction } from '../../runner.interface'; /** * Verifies working with notebooks does the right thing with changes and doesnt trigger diff --git a/apps/client-e2e/src/tests/interactions/notebooks-no-duplicate-routines.ts b/apps/client-e2e/src/tests/interactions/notebooks/notebooks-no-duplicate-routines.ts similarity index 93% rename from apps/client-e2e/src/tests/interactions/notebooks-no-duplicate-routines.ts rename to apps/client-e2e/src/tests/interactions/notebooks/notebooks-no-duplicate-routines.ts index a96e35075..8a52976c9 100644 --- a/apps/client-e2e/src/tests/interactions/notebooks-no-duplicate-routines.ts +++ b/apps/client-e2e/src/tests/interactions/notebooks/notebooks-no-duplicate-routines.ts @@ -3,8 +3,8 @@ import { OpenNotebookInVSCode, VSCODE_COMMANDS } from '@idl/vscode/shared'; import expect from 'expect'; import * as vscode from 'vscode'; -import { CLIENT_E2E_CONFIG } from '../client-e2e-config.interface'; -import { RunnerFunction } from '../runner.interface'; +import { CLIENT_E2E_CONFIG } from '../../client-e2e-config.interface'; +import { RunnerFunction } from '../../runner.interface'; /** * Verifies diff --git a/apps/client-e2e/src/tests/notebooks/_notebook-runner.ts b/apps/client-e2e/src/tests/notebooks/_notebook-runner.ts index 991a89b06..9338913f4 100644 --- a/apps/client-e2e/src/tests/notebooks/_notebook-runner.ts +++ b/apps/client-e2e/src/tests/notebooks/_notebook-runner.ts @@ -1,6 +1,8 @@ import { Logger } from '@idl/logger'; import { Runner } from '../runner.class'; +import { ExecutiveCommandsExpectedOutput } from './executive-commands-expected-output'; +import { ExecutiveCompileFailure } from './executive-compile-failure'; import { NewNotebook } from './new-notebook'; import { NotebookCallStackDecorationsNoDecorations } from './notebook-call-stack-decorations-no-decorations'; import { NotebookCallStackDecorationsOnExecutionHalted1 } from './notebook-call-stack-decorations-on-execution-halted'; @@ -112,6 +114,16 @@ NOTEBOOK_RUNNER.addTest({ critical: true, }); +NOTEBOOK_RUNNER.addTest({ + name: 'Detect failure in executive commands running', + fn: ExecutiveCompileFailure, +}); + +NOTEBOOK_RUNNER.addTest({ + name: 'Ensure output from executive commands is right', + fn: ExecutiveCommandsExpectedOutput, +}); + NOTEBOOK_RUNNER.addTest({ name: 'Run cells in notebook not saved to disk', fn: RunUnsavedNotebook, diff --git a/apps/client-e2e/src/tests/notebooks/executive-commands-expected-output.ts b/apps/client-e2e/src/tests/notebooks/executive-commands-expected-output.ts new file mode 100644 index 000000000..94774c8b9 --- /dev/null +++ b/apps/client-e2e/src/tests/notebooks/executive-commands-expected-output.ts @@ -0,0 +1,50 @@ +import { GetExtensionPath, Sleep } from '@idl/shared'; +import { OpenNotebookInVSCode, VSCODE_COMMANDS } from '@idl/vscode/shared'; +import expect from 'expect'; +import * as vscode from 'vscode'; + +import { RunnerFunction } from '../runner.interface'; +import { CompareNotebookJSONOutputs } from './helpers/compare-notebook-json-outputs'; + +/** + * Verifies we set quiet right and have the correct outputs + */ +export const ExecutiveCommandsExpectedOutput: RunnerFunction = async (init) => { + const nbUri = GetExtensionPath( + 'idl/test/client-e2e/notebooks/executive-commands/quiet-works-right.idlnb' + ); + + const expectedUri = GetExtensionPath( + 'idl/test/client-e2e/notebooks/executive-commands/quiet-works-right-output.idlnb' + ); + + // open notebook + const nb = await OpenNotebookInVSCode(nbUri, true); + + // short pause to parse + await Sleep(500); + + // run all cells + await vscode.commands.executeCommand(VSCODE_COMMANDS.NOTEBOOK_RUN_ALL); + + // save to disk + await nb.save(); + + // compare outputs + await CompareNotebookJSONOutputs(expectedUri, nbUri); + + // run all cells + await vscode.commands.executeCommand(VSCODE_COMMANDS.NOTEBOOK_CLEAR_OUTPUTS); + + // save to disk + await nb.save(); + + // close notebook + await vscode.commands.executeCommand(VSCODE_COMMANDS.CLOSE_EDITOR); + + // pause momentarily + await Sleep(100); + + // verify we cleaned up + expect(vscode.window.activeNotebookEditor).toBeUndefined(); +}; diff --git a/apps/client-e2e/src/tests/notebooks/executive-compile-failure.ts b/apps/client-e2e/src/tests/notebooks/executive-compile-failure.ts new file mode 100644 index 000000000..111b29c04 --- /dev/null +++ b/apps/client-e2e/src/tests/notebooks/executive-compile-failure.ts @@ -0,0 +1,29 @@ +import { GetExtensionPath } from '@idl/shared'; + +import { RunnerFunction } from '../runner.interface'; +import { ICompareCellOutputs } from './helpers/compare-cells.interface'; +import { RunNotebookAndCompareCells } from './helpers/run-notebook-and-compare-cells'; + +/** + * Types of outputs from cells that we expect to have + */ +export const CELL_OUTPUT: ICompareCellOutputs[] = [ + { + idx: 0, + success: false, + mimeTypes: ['text/plain'], + }, +]; + +/** + * Makes sure we detect failures when we fail to compile a cell + */ +export const ExecutiveCompileFailure: RunnerFunction = async (init) => { + await RunNotebookAndCompareCells( + GetExtensionPath( + 'idl/test/client-e2e/notebooks/executive-commands/fail-on-fake-cell.idlnb' + ), + CELL_OUTPUT, + init.notebooks.controller + ); +}; diff --git a/apps/client-e2e/src/tests/notebooks/helpers/compare-cells.ts b/apps/client-e2e/src/tests/notebooks/helpers/compare-cells.ts index ccbf8d316..adea9bfe2 100644 --- a/apps/client-e2e/src/tests/notebooks/helpers/compare-cells.ts +++ b/apps/client-e2e/src/tests/notebooks/helpers/compare-cells.ts @@ -12,7 +12,8 @@ import { */ export async function CompareCellOutputs( nb: vscode.NotebookDocument, - cellOutput: ICompareCellOutputs[] + cellOutput: ICompareCellOutputs[], + checkExecution = true ) { /** * get notebook cells @@ -38,10 +39,12 @@ export async function CompareCellOutputs( expect(nbCell).not.toBeUndefined(); // validate success if we have it - if (expected.success) { - expect(nbCell.executionSummary?.success).toBeTruthy(); - } else { - expect(nbCell.executionSummary?.success).toBeFalsy(); + if (checkExecution) { + if (expected.success) { + expect(nbCell.executionSummary?.success).toBeTruthy(); + } else { + expect(nbCell.executionSummary?.success).toBeFalsy(); + } } // get output mime types diff --git a/apps/client-e2e/src/tests/notebooks/helpers/notebook-timeout.interface.ts b/apps/client-e2e/src/tests/notebooks/helpers/notebook-timeout.interface.ts deleted file mode 100644 index 1190c0779..000000000 --- a/apps/client-e2e/src/tests/notebooks/helpers/notebook-timeout.interface.ts +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Default timeout, ms, for notebooks pause - */ -export const DEFAULT_RUNNER_NOTEBOOK_TIMEOUT = 250; diff --git a/apps/client-e2e/src/tests/notebooks/helpers/run-notebook-and-check-call-stack-decorations.ts b/apps/client-e2e/src/tests/notebooks/helpers/run-notebook-and-check-call-stack-decorations.ts index c740f7a72..e381b0d04 100644 --- a/apps/client-e2e/src/tests/notebooks/helpers/run-notebook-and-check-call-stack-decorations.ts +++ b/apps/client-e2e/src/tests/notebooks/helpers/run-notebook-and-check-call-stack-decorations.ts @@ -10,7 +10,7 @@ import expect from 'expect'; import { existsSync, rmSync } from 'fs'; import * as vscode from 'vscode'; -import { DEFAULT_RUNNER_NOTEBOOK_TIMEOUT } from './notebook-timeout.interface'; +import { CLIENT_E2E_CONFIG } from '../../client-e2e-config.interface'; /** * helper function to: @@ -57,7 +57,7 @@ export async function RunNotebookAndCheckCallStackDecorations( // short pause based on the number of cells we have // sometimes the rendering takes too long to register (like complex maps) // so we need an extra pause - await Sleep(DEFAULT_RUNNER_NOTEBOOK_TIMEOUT); + await Sleep(CLIENT_E2E_CONFIG.DELAYS.PROBLEMS_NOTEBOOK); // get current decorations const current = decorations.decorations.stack; diff --git a/apps/client-e2e/src/tests/notebooks/helpers/run-notebook-and-compare-cells.ts b/apps/client-e2e/src/tests/notebooks/helpers/run-notebook-and-compare-cells.ts index 0e4db8d9f..df0704561 100644 --- a/apps/client-e2e/src/tests/notebooks/helpers/run-notebook-and-compare-cells.ts +++ b/apps/client-e2e/src/tests/notebooks/helpers/run-notebook-and-compare-cells.ts @@ -6,9 +6,9 @@ import expect from 'expect'; import { existsSync, rmSync } from 'fs'; import * as vscode from 'vscode'; +import { CLIENT_E2E_CONFIG } from '../../client-e2e-config.interface'; import { CompareCellOutputs } from './compare-cells'; import { ICompareCellOutputs } from './compare-cells.interface'; -import { DEFAULT_RUNNER_NOTEBOOK_TIMEOUT } from './notebook-timeout.interface'; /** * helper function to: @@ -54,7 +54,7 @@ export async function RunNotebookAndCompareCells( // short pause based on the number of cells we have // sometimes the rendering takes too long to register (like complex maps) // so we need an extra pause - await Sleep(DEFAULT_RUNNER_NOTEBOOK_TIMEOUT); + await Sleep(CLIENT_E2E_CONFIG.DELAYS.PROBLEMS_NOTEBOOK); // compare cells await CompareCellOutputs(nb, cells); diff --git a/apps/client-e2e/src/tests/notebooks/notebook-reset.ts b/apps/client-e2e/src/tests/notebooks/notebook-reset.ts index 90e35499f..cff8d7cd0 100644 --- a/apps/client-e2e/src/tests/notebooks/notebook-reset.ts +++ b/apps/client-e2e/src/tests/notebooks/notebook-reset.ts @@ -3,6 +3,7 @@ import { OpenNotebookInVSCode, VSCODE_COMMANDS } from '@idl/vscode/shared'; import expect from 'expect'; import * as vscode from 'vscode'; +import { CLIENT_E2E_CONFIG } from '../client-e2e-config.interface'; import { RunnerFunction } from '../runner.interface'; import { CompareCellOutputs } from './helpers/compare-cells'; import { ICompareCellOutputs } from './helpers/compare-cells.interface'; @@ -56,8 +57,11 @@ export const RunNotebookReset: RunnerFunction = async (init) => { // make sure stopped expect(init.notebooks.controller.isStarted(nb)).toBeTruthy(); + // pause + await Sleep(CLIENT_E2E_CONFIG.DELAYS.PROBLEMS_NOTEBOOK); + // compare state - CompareCellOutputs(nb, CELL_OUTPUT); + await CompareCellOutputs(nb, CELL_OUTPUT); // clear outputs await vscode.commands.executeCommand(VSCODE_COMMANDS.NOTEBOOK_CLEAR_OUTPUTS); diff --git a/apps/client-e2e/src/tests/notebooks/notebook-stop.ts b/apps/client-e2e/src/tests/notebooks/notebook-stop.ts index 2d9980aaf..98189860a 100644 --- a/apps/client-e2e/src/tests/notebooks/notebook-stop.ts +++ b/apps/client-e2e/src/tests/notebooks/notebook-stop.ts @@ -3,6 +3,7 @@ import { OpenNotebookInVSCode, VSCODE_COMMANDS } from '@idl/vscode/shared'; import expect from 'expect'; import * as vscode from 'vscode'; +import { CLIENT_E2E_CONFIG } from '../client-e2e-config.interface'; import { RunnerFunction } from '../runner.interface'; import { CompareCellOutputs } from './helpers/compare-cells'; import { ICompareCellOutputs } from './helpers/compare-cells.interface'; @@ -56,6 +57,9 @@ export const RunNotebookStop: RunnerFunction = async (init) => { // make sure stopped expect(init.notebooks.controller.isStarted(nb)).toBeFalsy(); + // pause + await Sleep(CLIENT_E2E_CONFIG.DELAYS.PROBLEMS_NOTEBOOK); + // compare state - CompareCellOutputs(nb, CELL_OUTPUT); + await CompareCellOutputs(nb, CELL_OUTPUT); }; diff --git a/apps/client-e2e/src/tests/notebooks/run-unsaved-notebook.ts b/apps/client-e2e/src/tests/notebooks/run-unsaved-notebook.ts index be34a7952..9af34e1c2 100644 --- a/apps/client-e2e/src/tests/notebooks/run-unsaved-notebook.ts +++ b/apps/client-e2e/src/tests/notebooks/run-unsaved-notebook.ts @@ -3,10 +3,10 @@ import { VSCODE_COMMANDS } from '@idl/vscode/shared'; import expect from 'expect'; import * as vscode from 'vscode'; +import { CLIENT_E2E_CONFIG } from '../client-e2e-config.interface'; import { RunnerFunction } from '../runner.interface'; import { CompareCellOutputs } from './helpers/compare-cells'; import { ICompareCellOutputs } from './helpers/compare-cells.interface'; -import { DEFAULT_RUNNER_NOTEBOOK_TIMEOUT } from './helpers/notebook-timeout.interface'; /** * Types of outputs from cells that we expect to have @@ -34,7 +34,7 @@ export const RunUnsavedNotebook: RunnerFunction = async (init) => { ); // short pause - await Sleep(DEFAULT_RUNNER_NOTEBOOK_TIMEOUT); + await Sleep(CLIENT_E2E_CONFIG.DELAYS.PROBLEMS_NOTEBOOK); // get active editor const editor = vscode.window.activeNotebookEditor; @@ -65,7 +65,7 @@ export const RunUnsavedNotebook: RunnerFunction = async (init) => { // short pause based on the number of cells we have // sometimes the rendering takes too long to register (like complex maps) // so we need an extra pause - await Sleep(DEFAULT_RUNNER_NOTEBOOK_TIMEOUT); + await Sleep(CLIENT_E2E_CONFIG.DELAYS.PROBLEMS_NOTEBOOK); // compare cells await CompareCellOutputs(nb, CELL_OUTPUT); diff --git a/apps/client-e2e/src/tests/notebooks/save-and-clear-output.ts b/apps/client-e2e/src/tests/notebooks/save-and-clear-output.ts index 3c8e67e20..8540fb253 100644 --- a/apps/client-e2e/src/tests/notebooks/save-and-clear-output.ts +++ b/apps/client-e2e/src/tests/notebooks/save-and-clear-output.ts @@ -1,7 +1,8 @@ -import { GetExtensionPath } from '@idl/shared'; +import { GetExtensionPath, Sleep } from '@idl/shared'; import { OpenNotebookInVSCode, VSCODE_COMMANDS } from '@idl/vscode/shared'; import * as vscode from 'vscode'; +import { CLIENT_E2E_CONFIG } from '../client-e2e-config.interface'; import { RunnerFunction } from '../runner.interface'; import { CompareCellOutputs } from './helpers/compare-cells'; import { VerifyEmpty } from './helpers/verify-empty'; @@ -35,12 +36,18 @@ export const SaveAndClearNotebook: RunnerFunction = async (init) => { */ const nbAfter = await OpenNotebookInVSCode(file); + // pause + await Sleep(CLIENT_E2E_CONFIG.DELAYS.PROBLEMS_NOTEBOOK); + // compare cells - CompareCellOutputs(nbAfter, CELL_OUTPUT); + await CompareCellOutputs(nbAfter, CELL_OUTPUT, false); // clear any existing outputs await vscode.commands.executeCommand(VSCODE_COMMANDS.NOTEBOOK_CLEAR_OUTPUTS); + // pause + await Sleep(CLIENT_E2E_CONFIG.DELAYS.PROBLEMS_NOTEBOOK); + // verify that our cells are empty VerifyEmpty(nbAfter); diff --git a/apps/client-e2e/src/tests/runner.class.ts b/apps/client-e2e/src/tests/runner.class.ts index a728a9262..ef691fdb9 100644 --- a/apps/client-e2e/src/tests/runner.class.ts +++ b/apps/client-e2e/src/tests/runner.class.ts @@ -129,6 +129,9 @@ export class Runner { // log this.logger.error([`Failed test: "${this.tests[i].name}"`, err]); + // pause so output logs can be captured + await Sleep(2000); + // account for failure failures += 1; diff --git a/apps/client/project.json b/apps/client/project.json index 43e21cba8..bd249ebd8 100644 --- a/apps/client/project.json +++ b/apps/client/project.json @@ -12,7 +12,7 @@ "main": "apps/client/src/main.ts", "tsConfig": "apps/client/tsconfig.app.json", "assets": ["apps/client/src/assets"], - "webpackConfig": "webpack.base.config.js", + "webpackConfig": "webpack.vscode.config.js", "externalDependencies": "none", "target": "node", "compiler": "tsc" @@ -39,17 +39,13 @@ }, "lint": { "executor": "@nx/eslint:lint", - "outputs": ["{options.outputFile}"], - "options": { - "lintFilePatterns": ["apps/client/**/*.ts"] - } + "outputs": ["{options.outputFile}"] }, "test": { "executor": "@nx/jest:jest", "outputs": ["{workspaceRoot}/coverage/apps/client"], "options": { - "jestConfig": "apps/client/jest.config.ts", - "passWithNoTests": true + "jestConfig": "apps/client/jest.config.ts" } } }, diff --git a/apps/i18n/project.json b/apps/i18n/project.json index c889a4587..fe678c853 100644 --- a/apps/i18n/project.json +++ b/apps/i18n/project.json @@ -11,6 +11,7 @@ "outputPath": "dist/apps/i18n", "main": "apps/i18n/src/main.ts", "tsConfig": "apps/i18n/tsconfig.app.json", + "webpackConfig": "webpack.node.config.js", "assets": ["apps/i18n/src/assets"], "target": "node", "compiler": "tsc" @@ -37,17 +38,13 @@ }, "lint": { "executor": "@nx/eslint:lint", - "outputs": ["{options.outputFile}"], - "options": { - "lintFilePatterns": ["apps/i18n/**/*.ts"] - } + "outputs": ["{options.outputFile}"] }, "test": { "executor": "@nx/jest:jest", "outputs": ["{workspaceRoot}/coverage/apps/i18n"], "options": { - "jestConfig": "apps/i18n/jest.config.ts", - "passWithNoTests": true + "jestConfig": "apps/i18n/jest.config.ts" } } }, diff --git a/apps/i18n/webpack.config.js b/apps/i18n/webpack.config.js new file mode 100644 index 000000000..81db92b95 --- /dev/null +++ b/apps/i18n/webpack.config.js @@ -0,0 +1,8 @@ +const { composePlugins, withNx } = require('@nx/webpack'); + +// Nx plugins for webpack. +module.exports = composePlugins(withNx(), (config) => { + // Update the webpack config as needed here. + // e.g. `config.plugins.push(new MyPlugin())` + return config; +}); diff --git a/apps/idl-docs-parser/project.json b/apps/idl-docs-parser/project.json index eebf2bc8d..3404798dd 100644 --- a/apps/idl-docs-parser/project.json +++ b/apps/idl-docs-parser/project.json @@ -11,6 +11,7 @@ "outputPath": "dist/apps/idl-docs-parser", "main": "apps/idl-docs-parser/src/main.ts", "tsConfig": "apps/idl-docs-parser/tsconfig.app.json", + "webpackConfig": "webpack.node.config.js", "assets": ["apps/idl-docs-parser/src/assets"], "target": "node", "compiler": "tsc" @@ -37,17 +38,13 @@ }, "lint": { "executor": "@nx/eslint:lint", - "outputs": ["{options.outputFile}"], - "options": { - "lintFilePatterns": ["apps/idl-docs-parser/**/*.ts"] - } + "outputs": ["{options.outputFile}"] }, "test": { "executor": "@nx/jest:jest", "outputs": ["{workspaceRoot}/coverage/apps/idl-docs-parser"], "options": { - "jestConfig": "apps/idl-docs-parser/jest.config.ts", - "passWithNoTests": true + "jestConfig": "apps/idl-docs-parser/jest.config.ts" } } }, diff --git a/apps/idl-docs-parser/src/helpers/code-formatter.ts b/apps/idl-docs-parser/src/helpers/code-formatter.ts index cb4034c0e..3d72bed5e 100644 --- a/apps/idl-docs-parser/src/helpers/code-formatter.ts +++ b/apps/idl-docs-parser/src/helpers/code-formatter.ts @@ -49,7 +49,7 @@ async function ParseAndFormatCode(code: string) { new CancellationToken(), { postProcess: true, - isNotebook: true, + type: 'notebook', } ); @@ -72,7 +72,7 @@ async function ParseAndFormatCode(code: string) { new CancellationToken(), { postProcess: true, - isNotebook: true, + type: 'notebook', } ); } diff --git a/apps/idl-docs-parser/src/index.py b/apps/idl-docs-parser/src/index.py new file mode 100644 index 000000000..0bbdfe486 --- /dev/null +++ b/apps/idl-docs-parser/src/index.py @@ -0,0 +1,108 @@ +from llama_index.core import SimpleDirectoryReader, StorageContext, VectorStoreIndex +from llama_index.core import set_global_tokenizer, load_index_from_storage +from llama_index.embeddings.huggingface import HuggingFaceEmbedding +from llama_index.llms.llama_cpp import LlamaCPP +from llama_index.llms.llama_cpp.llama_utils import ( + messages_to_prompt, + completion_to_prompt, +) +from transformers import AutoTokenizer + + +""" +References: + +Save/restore/create index +https://docs.llamaindex.ai/en/stable/examples/vector_stores/SimpleIndexDemo/ + +Custom model that runs locally: +https://docs.llamaindex.ai/en/stable/examples/llm/llama_2_llama_cpp/ + +This needs to use a GGUF model file and not bin like the example shows +""" + + +# set the global tokenizer +set_global_tokenizer( + AutoTokenizer.from_pretrained("NousResearch/Llama-2-7b-chat-hf").encode +) + + +def CreateIndex(source, index_id, destination, embed_model=None): + """ + Create new index and persist it to disk + + Optionally specify the model to use for creating embeddings. + + Comes from: https://docs.llamaindex.ai/en/stable/examples/llm/llama_2_llama_cpp/ + """ + # load documents + documents = SimpleDirectoryReader(source).load_data() + index = VectorStoreIndex.from_documents(documents, embed_model=embed_model) + + # save index to disk + index.set_index_id(index_id) + index.storage_context.persist(destination) + + # return! + return index + + +def LoadIndex(path, index_id, embed_model=None): + """ + Load an index from disk + + TODO: is there anything to add for the embed model from above + """ + # rebuild storage context + storage_context = StorageContext.from_defaults(persist_dir=path) + + # load index + return load_index_from_storage(storage_context, index_id=index_id, embed_model=embed_model) + + +# folders +DOCUMENT_DIR = "" +CACHE_DIR = "" + +# ID for our index (from examples) +INDEX_ID = "vector_index" + +# create the model we use to create embeddings +embed_model = HuggingFaceEmbedding(model_name="BAAI/bge-small-en-v1.5") + +# create our index +# index = CreateIndex(DOCUMENT_DIR, INDEX_ID, CACHE_DIR, embed_model=embed_model) + +# load our search index from disk +index = LoadIndex(CACHE_DIR, INDEX_ID, embed_model=embed_model) + +# URL for the model we use +model_url = "https://huggingface.co/TheBloke/Llama-2-13B-chat-GGUF/resolve/main/llama-2-13b-chat.Q4_0.gguf" + +# create our LLM +llm = LlamaCPP( + # You can pass in the URL to a GGML model to download it automatically + model_url=model_url, + # optionally, you can set the path to a pre-downloaded model instead of model_url + # model_path="", + temperature=0.1, + max_new_tokens=256, + # llama2 has a context window of 4096 tokens, but we set it lower to allow for some wiggle room + context_window=3900, + # kwargs to pass to __call__() + generate_kwargs={}, + # kwargs to pass to __init__() + # set to at least 1 to use GPU + model_kwargs={"n_gpu_layers": 1}, + # transform inputs into Llama2 format + messages_to_prompt=messages_to_prompt, + completion_to_prompt=completion_to_prompt, + verbose=True, +) + +# set up query engine +query_engine = index.as_query_engine(llm=llm) + +response = query_engine.query("How much training data do I need to create a model?") +print(response) \ No newline at end of file diff --git a/apps/idl-webview-e2e/project.json b/apps/idl-webview-e2e/project.json index 468af1da3..35a99e4b6 100644 --- a/apps/idl-webview-e2e/project.json +++ b/apps/idl-webview-e2e/project.json @@ -19,9 +19,6 @@ }, "lint": { "executor": "@nx/eslint:lint", - "options": { - "lintFilePatterns": ["apps/idl-webview-e2e/**/*.{js,ts}"] - }, "outputs": ["{options.outputFile}"] } }, diff --git a/apps/idl-webview/project.json b/apps/idl-webview/project.json index ebd04350c..a4d7fcf8e 100644 --- a/apps/idl-webview/project.json +++ b/apps/idl-webview/project.json @@ -59,10 +59,10 @@ "executor": "@angular-devkit/build-angular:dev-server", "configurations": { "production": { - "browserTarget": "idl-webview:build:production" + "buildTarget": "idl-webview:build:production" }, "development": { - "browserTarget": "idl-webview:build:development" + "buildTarget": "idl-webview:build:development" } }, "defaultConfiguration": "development" @@ -70,25 +70,18 @@ "extract-i18n": { "executor": "@angular-devkit/build-angular:extract-i18n", "options": { - "browserTarget": "idl-webview:build" + "buildTarget": "idl-webview:build" } }, "lint": { "executor": "@nx/eslint:lint", - "options": { - "lintFilePatterns": [ - "apps/idl-webview/src/**/*.ts", - "apps/idl-webview/src/**/*.html" - ] - }, "outputs": ["{options.outputFile}"] }, "test": { "executor": "@nx/jest:jest", "outputs": ["{workspaceRoot}/coverage/apps/idl-webview"], "options": { - "jestConfig": "apps/idl-webview/jest.config.ts", - "passWithNoTests": true + "jestConfig": "apps/idl-webview/jest.config.ts" } } }, diff --git a/apps/idl-webview/src/app/app.module.ts b/apps/idl-webview/src/app/app.module.ts index f6902a84d..71cf6f049 100644 --- a/apps/idl-webview/src/app/app.module.ts +++ b/apps/idl-webview/src/app/app.module.ts @@ -1,4 +1,7 @@ -import { HttpClientModule } from '@angular/common/http'; +import { + provideHttpClient, + withInterceptorsFromDi, +} from '@angular/common/http'; import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; @@ -13,6 +16,8 @@ import { TranslocoRootModule } from './transloco-root.module'; @NgModule({ declarations: [AppComponent], + bootstrap: [AppComponent], + schemas: [CUSTOM_ELEMENTS_SCHEMA], imports: [ TranslocoRootModule, BrowserModule, @@ -22,10 +27,7 @@ import { TranslocoRootModule } from './transloco-root.module'; ServicesModule, HomeModule, ProfilerModule, - HttpClientModule, ], - providers: [], - bootstrap: [AppComponent], - schemas: [CUSTOM_ELEMENTS_SCHEMA], + providers: [provideHttpClient(withInterceptorsFromDi())], }) export class AppModule {} diff --git a/apps/idl-webview/src/app/home/home.module.ts b/apps/idl-webview/src/app/home/home.module.ts index c4c696d51..9d9cae3b5 100644 --- a/apps/idl-webview/src/app/home/home.module.ts +++ b/apps/idl-webview/src/app/home/home.module.ts @@ -1,6 +1,6 @@ import { CommonModule } from '@angular/common'; import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core'; -import { TranslocoModule } from '@ngneat/transloco'; +import { TranslocoModule } from '@jsverse/transloco'; import { MaterialModule } from '../material.module'; import { HomeComponent } from './components/home/home.component'; diff --git a/apps/idl-webview/src/app/profiler/profiler.module.ts b/apps/idl-webview/src/app/profiler/profiler.module.ts index a002bea0d..8132e367b 100644 --- a/apps/idl-webview/src/app/profiler/profiler.module.ts +++ b/apps/idl-webview/src/app/profiler/profiler.module.ts @@ -1,6 +1,6 @@ import { CommonModule } from '@angular/common'; import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core'; -import { TranslocoModule } from '@ngneat/transloco'; +import { TranslocoModule } from '@jsverse/transloco'; import { MaterialModule } from '../material.module'; import { ProfilerComponent } from './components/profiler/profiler.component'; diff --git a/apps/idl-webview/src/app/transloco-root.module.ts b/apps/idl-webview/src/app/transloco-root.module.ts index d0d3da528..b09c049b2 100644 --- a/apps/idl-webview/src/app/transloco-root.module.ts +++ b/apps/idl-webview/src/app/transloco-root.module.ts @@ -7,7 +7,7 @@ import { translocoConfig, TranslocoLoader, TranslocoModule, -} from '@ngneat/transloco'; +} from '@jsverse/transloco'; import { environment } from '../environments/environment'; diff --git a/apps/idl-webview/src/themes/theme.scss b/apps/idl-webview/src/themes/theme.scss index 1665bae89..fe5e3d3fb 100644 --- a/apps/idl-webview/src/themes/theme.scss +++ b/apps/idl-webview/src/themes/theme.scss @@ -1,10 +1,10 @@ -@use 'angular-material-css-vars/main' as mat-css; +@use 'angular-material-css-vars' as mat-css-vars; // optional $mat-css-dark-theme-selector: '.isDarkTheme'; $mat-css-light-theme-selector: '.isLightTheme'; // init theme -@include mat-css.init-material-css-vars() using($mat-css-theme) { +@include mat-css-vars.init-material-css-vars() using($mat-css-theme) { //call any theme mixins here. we dont so placeholder } diff --git a/apps/notebook/components-e2e/project.json b/apps/notebook/components-e2e/project.json index 879f3df53..ee2af1379 100644 --- a/apps/notebook/components-e2e/project.json +++ b/apps/notebook/components-e2e/project.json @@ -22,10 +22,7 @@ }, "lint": { "executor": "@nx/eslint:lint", - "outputs": ["{options.outputFile}"], - "options": { - "lintFilePatterns": ["apps/notebook/components-e2e/**/*.{js,ts}"] - } + "outputs": ["{options.outputFile}"] } }, "tags": [], diff --git a/apps/notebook/components/project.json b/apps/notebook/components/project.json index 9255c8e30..ff3a93324 100644 --- a/apps/notebook/components/project.json +++ b/apps/notebook/components/project.json @@ -13,7 +13,7 @@ "outputPath": "dist/apps/notebook/components", "index": "apps/notebook/components/src/index.html", "main": "apps/notebook/components/src/main.ts", - "polyfills": ["zone.js"], + "polyfills": "apps/notebook/components/src/polyfills.ts", "tsConfig": "apps/notebook/components/tsconfig.app.json", "inlineStyleLanguage": "scss", "styles": [], @@ -61,10 +61,10 @@ "executor": "@angular-devkit/build-angular:dev-server", "configurations": { "production": { - "browserTarget": "notebook-components:build:production" + "buildTarget": "notebook-components:build:production" }, "development": { - "browserTarget": "notebook-components:build:development" + "buildTarget": "notebook-components:build:development" } }, "defaultConfiguration": "development", @@ -77,31 +77,18 @@ "extract-i18n": { "executor": "@angular-devkit/build-angular:extract-i18n", "options": { - "browserTarget": "notebook-components:build" + "buildTarget": "notebook-components:build" } }, "lint": { "executor": "@nx/eslint:lint", - "outputs": ["{options.outputFile}"], - "options": { - "lintFilePatterns": [ - "apps/notebook/components/**/*.ts", - "apps/notebook/components/**/*.html" - ] - } + "outputs": ["{options.outputFile}"] }, "test": { "executor": "@nx/jest:jest", "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], "options": { - "jestConfig": "apps/notebook/components/jest.config.ts", - "passWithNoTests": true - }, - "configurations": { - "ci": { - "ci": true, - "codeCoverage": true - } + "jestConfig": "apps/notebook/components/jest.config.ts" } }, "serve-static": { diff --git a/apps/notebook/components/src/app/app.module.ts b/apps/notebook/components/src/app/app.module.ts index 1bf56b852..4089527a3 100644 --- a/apps/notebook/components/src/app/app.module.ts +++ b/apps/notebook/components/src/app/app.module.ts @@ -1,8 +1,12 @@ -import { HttpClientModule } from '@angular/common/http'; +import { + provideHttpClient, + withInterceptorsFromDi, +} from '@angular/common/http'; import { ApplicationRef, DoBootstrap, Injector, NgModule } from '@angular/core'; import { createCustomElement } from '@angular/elements'; import { MatIconRegistry } from '@angular/material/icon'; import { BrowserModule, DomSanitizer } from '@angular/platform-browser'; +import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { MaterialCssVarsModule, MaterialCssVarsService, @@ -20,6 +24,8 @@ import { } from './components/map/map-property-sheet/map-property-sheet.component'; import { FAST_FORWARD } from './icons/fast-forward'; import { FAST_REWIND } from './icons/fast-rewind'; +import { LAYERS } from './icons/layers'; +import { MY_LOCATION_FILLED } from './icons/my-location-fill'; import { PAUSE } from './icons/pause'; import { PLAY } from './icons/play'; import { SAVE } from './icons/save'; @@ -28,16 +34,20 @@ import { VSCodeRendererMessenger } from './services/vscode-renderer-messenger.se @NgModule({ declarations: [AppComponent], + bootstrap: [], + exports: [], imports: [ BrowserModule, - HttpClientModule, + BrowserAnimationsModule, MaterialCssVarsModule.forRoot({}), MaterialModule, ComponentsModule, ], - providers: [MaterialCssVarsService, VSCodeRendererMessenger], - bootstrap: [], - exports: [], + providers: [ + MaterialCssVarsService, + VSCodeRendererMessenger, + provideHttpClient(withInterceptorsFromDi()), + ], }) export class AppModule implements DoBootstrap { constructor( @@ -86,6 +96,8 @@ export class AppModule implements DoBootstrap { const icons: { [key: string]: any } = { 'fast-forward': FAST_FORWARD, 'fast-rewind': FAST_REWIND, + layers: LAYERS, + my_location_fill: MY_LOCATION_FILLED, pause: PAUSE, play: PLAY, save: SAVE, diff --git a/apps/notebook/components/src/app/components/animation-controls/animation-controls.component.html b/apps/notebook/components/src/app/components/animation-controls/animation-controls.component.html index b4e20cc42..d37f89c8e 100644 --- a/apps/notebook/components/src/app/components/animation-controls/animation-controls.component.html +++ b/apps/notebook/components/src/app/components/animation-controls/animation-controls.component.html @@ -2,37 +2,53 @@ fxLayout="row" fxLayoutAlign="center center" class="renderer-toolbar" - style="max-width: 350px" + style="max-width: 350px; padding-top: 5px" > - -
-

{{ multiplierText() }}

- - - - -
+
+ +
+

{{ multiplierText() }}

+ + + + +
+ +
+ +
- - - + --> +
diff --git a/apps/notebook/components/src/app/components/components.module.ts b/apps/notebook/components/src/app/components/components.module.ts index 352e826c2..3391bddbc 100644 --- a/apps/notebook/components/src/app/components/components.module.ts +++ b/apps/notebook/components/src/app/components/components.module.ts @@ -1,5 +1,8 @@ import { CommonModule } from '@angular/common'; -import { HttpClientModule } from '@angular/common/http'; +import { + provideHttpClient, + withInterceptorsFromDi, +} from '@angular/common/http'; import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core'; import { MaterialCssVarsModule } from 'angular-material-css-vars'; @@ -22,12 +25,6 @@ import { PlotComponent } from './plot/plot.component'; MapPropertySheetComponent, AnimationControlsComponent, ], - imports: [ - CommonModule, - HttpClientModule, - MaterialCssVarsModule, - MaterialModule, - ], exports: [ EntryComponent, ImageComponent, @@ -38,6 +35,7 @@ import { PlotComponent } from './plot/plot.component'; AnimationControlsComponent, ], schemas: [CUSTOM_ELEMENTS_SCHEMA], - providers: [], + imports: [CommonModule, MaterialCssVarsModule, MaterialModule], + providers: [provideHttpClient(withInterceptorsFromDi())], }) export class ComponentsModule {} diff --git a/apps/notebook/components/src/app/components/entry/entry.component.ts b/apps/notebook/components/src/app/components/entry/entry.component.ts index dc57d6233..20aa2b2a0 100644 --- a/apps/notebook/components/src/app/components/entry/entry.component.ts +++ b/apps/notebook/components/src/app/components/entry/entry.component.ts @@ -17,6 +17,10 @@ import { DataSharingService } from '../data-sharing.service'; */ export const IDL_NB_ENTRY_COMPONENT_SELECTOR = 'idl-nb-entry'; +const DEFAULT_CLASS = 'vscode-outlined'; + +const OUTLINED_CLASS = 'vscode-outlined-focus'; + /** * Entry components handles the logic of determining the right thing * to render and creates the correct type of element to display @@ -68,7 +72,7 @@ export class EntryComponent implements AfterViewInit { */ embed!: IDLNotebookEmbeddedItem; - class = ''; + class = DEFAULT_CLASS; constructor( @Host() private dataShare: DataSharingService, @@ -76,11 +80,11 @@ export class EntryComponent implements AfterViewInit { ) {} ngAfterViewInit() { - this.el.nativeElement.onclick = () => { - this.class = 'vscode-outlined'; + this.el.nativeElement.onmousedown = () => { + this.class = OUTLINED_CLASS; }; this.el.nativeElement.onmouseleave = () => { - this.class = ''; + this.class = DEFAULT_CLASS; }; } } diff --git a/apps/notebook/components/src/app/components/map/helpers/awesome-image.class.ts b/apps/notebook/components/src/app/components/map/helpers/awesome-image.class.ts index 95447f48e..5f71951fe 100644 --- a/apps/notebook/components/src/app/components/map/helpers/awesome-image.class.ts +++ b/apps/notebook/components/src/app/components/map/helpers/awesome-image.class.ts @@ -1,7 +1,7 @@ // ... -import { LayerContext, LayerProps } from '@deck.gl/core/typed'; -import { BitmapLayer, BitmapLayerProps } from '@deck.gl/layers/typed'; +import { LayerContext, LayerProps } from '@deck.gl/core'; +import { BitmapLayer, BitmapLayerProps } from '@deck.gl/layers'; import { ColorTransform } from './color-transform.class'; import { ImageDisplayOptions } from './color-transform.interface'; diff --git a/apps/notebook/components/src/app/components/map/helpers/create-layers.interface.ts b/apps/notebook/components/src/app/components/map/helpers/create-layers.interface.ts new file mode 100644 index 000000000..d82beb457 --- /dev/null +++ b/apps/notebook/components/src/app/components/map/helpers/create-layers.interface.ts @@ -0,0 +1,9 @@ +import { LayersList } from '@deck.gl/core'; + +/** [xmin, ymin, xmax, ymax] */ +export type LayerBounds = [number, number, number, number]; + +export interface ILayers { + layers: LayersList; + bounds: LayerBounds; +} diff --git a/apps/notebook/components/src/app/components/map/helpers/create-layers.ts b/apps/notebook/components/src/app/components/map/helpers/create-layers.ts index b98aeaea4..4b8b68dd2 100644 --- a/apps/notebook/components/src/app/components/map/helpers/create-layers.ts +++ b/apps/notebook/components/src/app/components/map/helpers/create-layers.ts @@ -1,5 +1,5 @@ -import { LayersList } from '@deck.gl/core/typed'; -import { GeoJsonLayer } from '@deck.gl/layers/typed'; +import { LayersList } from '@deck.gl/core'; +import { GeoJsonLayer } from '@deck.gl/layers'; import { IDLNotebookEmbeddedItem, IDLNotebookMap, @@ -10,11 +10,14 @@ import { bboxify } from '@mapbox/geojson-extent'; import { nanoid } from 'nanoid'; import { AwesomeImage } from './awesome-image.class'; +import { ILayers, LayerBounds } from './create-layers.interface'; /** * Creates the deck.gl layers for the map */ -export function CreateLayers(embed: IDLNotebookEmbeddedItem) { +export function CreateLayers( + embed: IDLNotebookEmbeddedItem +): ILayers { /** * Create layers that we want to embed */ @@ -28,7 +31,7 @@ export function CreateLayers(embed: IDLNotebookEmbeddedItem) { /** * Track bounds */ - let bounds: [number, number, number, number] = undefined as any; + let bounds: LayerBounds = undefined as any; // process all of our data for (let i = 0; i < toEmbed.length; i++) { diff --git a/apps/notebook/components/src/app/components/map/map.component.html b/apps/notebook/components/src/app/components/map/map.component.html index e6b2b6983..77fea2f58 100644 --- a/apps/notebook/components/src/app/components/map/map.component.html +++ b/apps/notebook/components/src/app/components/map/map.component.html @@ -1,12 +1,32 @@ -
+
-
+
+ +
+ + +
+
+ +
Base map: Powered by Esri
diff --git a/apps/notebook/components/src/app/components/map/map.component.ts b/apps/notebook/components/src/app/components/map/map.component.ts index 3d7a6ca48..b6c07d030 100644 --- a/apps/notebook/components/src/app/components/map/map.component.ts +++ b/apps/notebook/components/src/app/components/map/map.component.ts @@ -7,16 +7,22 @@ import { SkipSelf, ViewChild, } from '@angular/core'; -import { Deck, WebMercatorViewport } from '@deck.gl/core/typed'; -import { TileLayer } from '@deck.gl/geo-layers/typed'; -import { BitmapLayer } from '@deck.gl/layers/typed'; +import { Deck, FlyToInterpolator, WebMercatorViewport } from '@deck.gl/core'; +import { TileLayer } from '@deck.gl/geo-layers'; +import { BitmapLayer } from '@deck.gl/layers'; import { IDLNotebookMap } from '@idl/types/notebooks'; +import copy from 'fast-copy'; +import { firstValueFrom } from 'rxjs'; import { VSCodeRendererMessenger } from '../../services/vscode-renderer-messenger.service'; import { BaseRendererComponent } from '../base-renderer.component'; import { DataSharingService } from '../data-sharing.service'; import { CreateLayers } from './helpers/create-layers'; +import { ILayers } from './helpers/create-layers.interface'; +/** + * Initial view state + */ const INITIAL_VIEW_STATE = { latitude: 39.99758595367171, longitude: -105.2101538546129, @@ -42,7 +48,7 @@ export const IDL_NB_MAP_COMPONENT_SELECTOR = 'idl-nb-map'; width: 100%; } - .credits { + .map-credits { position: absolute; right: 0; bottom: 0; @@ -67,6 +73,12 @@ export class MapComponent */ private deck!: Deck; + /** Current layers */ + private layers!: ILayers; + + /** Do we show the layers dialog */ + showLayers = false; + /** * Interval callback to make sure we render * @@ -120,29 +132,11 @@ export class MapComponent */ const layers = CreateLayers(this._embed); - // check if we have bounds from our layers - if (layers.bounds) { - /** - * Get viewport - */ - const { longitude, latitude, zoom } = new WebMercatorViewport({ - width: this.el.nativeElement.offsetWidth, - height: this.el.nativeElement.offsetHeight, - }).fitBounds( - [ - [layers.bounds[0], layers.bounds[1]], - [layers.bounds[2], layers.bounds[3]], - ], - { - padding: 100, - } - ); + // save layers + this.layers = layers; - /** - * Update view state - */ - Object.assign(INITIAL_VIEW_STATE, { longitude, latitude, zoom }); - } + // update default view state + this.updateInitialViewState(); /** * Create instance of deck with basemap and layers @@ -190,12 +184,12 @@ export class MapComponent fetch: async (url) => { // get value as bloc - const val = await this.http - .get(url, { + const val = await firstValueFrom( + this.http.get(url, { withCredentials: false, responseType: 'blob', }) - .toPromise(); + ); // convert to data URI and display return URL.createObjectURL(val); @@ -210,7 +204,66 @@ export class MapComponent }); // manually trigger a re-draw which seems to help when display stays black - this.deck.redraw('YOLO'); + this.deck.redraw(); + } + } + + /** + * Updates our view state based on data extents and the current map size + */ + updateInitialViewState() { + if (this.layers) { + // check if we have bounds from our layers + if (this.layers.bounds) { + /** + * Get viewport + */ + const { longitude, latitude, zoom } = new WebMercatorViewport({ + width: this.el.nativeElement.offsetWidth, + height: this.el.nativeElement.offsetHeight, + }).fitBounds( + [ + [this.layers.bounds[0], this.layers.bounds[1]], + [this.layers.bounds[2], this.layers.bounds[3]], + ], + { + padding: 100, + } + ); + + /** + * Update view state + */ + Object.assign(INITIAL_VIEW_STATE, { longitude, latitude, zoom }); + } } } + + /** + * Set the view back to defaults + */ + resetView() { + /** + * Reset initial view state so deck.gl picks up changes + * + * Without this, the next code doesnt work + */ + this.deck.setProps({ initialViewState: undefined }); + + // update our view state in case the map size has changed + this.updateInitialViewState(); + + /** + * Set view state with an animation + */ + this.deck.setProps({ + initialViewState: { + ...copy(INITIAL_VIEW_STATE), + transitionInterpolator: new FlyToInterpolator({ + speed: 2, + }), + transitionDuration: 'auto', + }, + }); + } } diff --git a/apps/notebook/components/src/app/icons/fast-forward.ts b/apps/notebook/components/src/app/icons/fast-forward.ts index fdccd6810..92ee4209a 100644 --- a/apps/notebook/components/src/app/icons/fast-forward.ts +++ b/apps/notebook/components/src/app/icons/fast-forward.ts @@ -1 +1 @@ -export const FAST_FORWARD = ``; +export const FAST_FORWARD = ``; diff --git a/apps/notebook/components/src/app/icons/fast-rewind.ts b/apps/notebook/components/src/app/icons/fast-rewind.ts index 9ffca48d7..4659457b1 100644 --- a/apps/notebook/components/src/app/icons/fast-rewind.ts +++ b/apps/notebook/components/src/app/icons/fast-rewind.ts @@ -1 +1 @@ -export const FAST_REWIND = ``; +export const FAST_REWIND = ``; diff --git a/apps/notebook/components/src/app/icons/layers.ts b/apps/notebook/components/src/app/icons/layers.ts new file mode 100644 index 000000000..cef34a25d --- /dev/null +++ b/apps/notebook/components/src/app/icons/layers.ts @@ -0,0 +1 @@ +export const LAYERS = ``; diff --git a/apps/notebook/components/src/app/icons/my-location-fill.ts b/apps/notebook/components/src/app/icons/my-location-fill.ts new file mode 100644 index 000000000..2d2a53b4c --- /dev/null +++ b/apps/notebook/components/src/app/icons/my-location-fill.ts @@ -0,0 +1 @@ +export const MY_LOCATION_FILLED = ``; diff --git a/apps/notebook/components/src/app/icons/pause.ts b/apps/notebook/components/src/app/icons/pause.ts index e145c9aa9..c6794f56b 100644 --- a/apps/notebook/components/src/app/icons/pause.ts +++ b/apps/notebook/components/src/app/icons/pause.ts @@ -1 +1 @@ -export const PAUSE = ``; +export const PAUSE = ``; diff --git a/apps/notebook/components/src/app/icons/play.ts b/apps/notebook/components/src/app/icons/play.ts index 0379a1c48..22459b942 100644 --- a/apps/notebook/components/src/app/icons/play.ts +++ b/apps/notebook/components/src/app/icons/play.ts @@ -1 +1 @@ -export const PLAY = ``; +export const PLAY = ``; diff --git a/apps/notebook/components/src/app/icons/save.ts b/apps/notebook/components/src/app/icons/save.ts index 9373fff5a..590bcab28 100644 --- a/apps/notebook/components/src/app/icons/save.ts +++ b/apps/notebook/components/src/app/icons/save.ts @@ -1 +1 @@ -export const SAVE = ``; +export const SAVE = ``; diff --git a/apps/notebook/components/src/app/material.module.ts b/apps/notebook/components/src/app/material.module.ts index 42a2a364b..36d518f0d 100644 --- a/apps/notebook/components/src/app/material.module.ts +++ b/apps/notebook/components/src/app/material.module.ts @@ -1,6 +1,7 @@ import { NgModule } from '@angular/core'; import { MatButtonModule } from '@angular/material/button'; import { MatIconModule } from '@angular/material/icon'; +import { MatMenuModule } from '@angular/material/menu'; import { MatSliderModule } from '@angular/material/slider'; import { MatTableModule } from '@angular/material/table'; import { FlexLayoutModule } from '@ngbracket/ngx-layout'; @@ -8,6 +9,7 @@ import { FlexLayoutModule } from '@ngbracket/ngx-layout'; const modules = [ MatIconModule, MatButtonModule, + MatMenuModule, MatSliderModule, MatTableModule, FlexLayoutModule, diff --git a/apps/notebook/components/src/app/styles/shared-styles.scss b/apps/notebook/components/src/app/styles/shared-styles.scss index 0655ba41d..b460a76d1 100644 --- a/apps/notebook/components/src/app/styles/shared-styles.scss +++ b/apps/notebook/components/src/app/styles/shared-styles.scss @@ -1,6 +1,5 @@ /* You can add global styles to this file, and also import other style files */ -$accent: var(--vscode-activityBarBadge-background); $cell-height-limit: 500px; .div { @@ -10,11 +9,21 @@ $cell-height-limit: 500px; } .mat-primary { - --mdc-slider-handle-color: #{$accent} !important; - --mdc-slider-focus-handle-color: #{$accent} !important; - --mdc-slider-hover-handle-color: #{$accent} !important; - --mdc-slider-active-track-color: #{$accent} !important; - --mdc-slider-inactive-track-color: #{$accent} !important; + --mdc-slider-handle-color: var( + --vscode-activityBarBadge-background + ) !important; + --mdc-slider-focus-handle-color: var( + --vscode-activityBarBadge-background + ) !important; + --mdc-slider-hover-handle-color: var( + --vscode-activityBarBadge-background + ) !important; + --mdc-slider-active-track-color: var( + --vscode-activityBarBadge-background + ) !important; + --mdc-slider-inactive-track-color: var( + --vscode-activityBarBadge-background + ) !important; /* --mdc-slider-with-tick-marks-inactive-container-color: var( --vscode-activityBarBadge-background ) !important; */ @@ -26,14 +35,11 @@ $cell-height-limit: 500px; // override class for more compact icon buttons without "