Skip to content

Commit 4d84116

Browse files
Merge branch 'develop'
2 parents c0261e2 + c210ed0 commit 4d84116

File tree

723 files changed

+10476
-1054
lines changed

Some content is hidden

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

723 files changed

+10476
-1054
lines changed

CHANGELOG.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,29 @@ Added the ability to convert a notebook to a PDF! This requires an additional ex
2828

2929
- You do need to save your notebook to disk so we have a path to write the Markdown and PDF files
3030

31-
## 4.3.0
31+
## 4.3.1 February 2024
32+
33+
Resolved an issue where the language server would take a while to startup when you didn't have any workspace folders open. It should be almost instantaneous now!
34+
35+
Resolved an issue where problems were not correctly reported (or honoring settings changes) for files that didn't belong to a workspace.
36+
37+
Added more controls to help fine-tune problem reporting and be able to disable it altogether:
38+
39+
- Add code actions for being able to easily disable problem codes from within the editor for a workspace or user settings
40+
41+
- Code actions work for notebooks or PRO files
42+
43+
- Added an IDL comment-based API to control how problems are reported for files and lines of IDL code
44+
45+
- Added a new preference that wil disable problem reporting altogether
46+
47+
Update documentation for all problem codes to point to our configuration guide for how to disable problems
48+
49+
Fixed an issue where, after the new documentation was added to the extension, that we no longer correctly opened example notebooks.
50+
51+
With the addition of new commands for code actions and fixing reported problems, we have retroactively removed some from the command palette that were meant for internal use.
52+
53+
## 4.3.0 February 2024
3254

3355
Added official documentation to the extension! It is hosted on Github pages and a local copy is included with the extension.
3456

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,12 @@ See [CHANGELOG](CHANGELOG.md).
184184

185185
- PDF icon is from "Material Icon Theme"
186186

187+
- PDF Generation
188+
189+
- We use a 3rd party extension called "Markdown PDF" to create PDFs
190+
191+
- Credit goes to [yzane](https://github.com/yzane/vscode-markdown-pdf/tree/master) as the creator of this extension
192+
187193
## Usage Metrics
188194

189195
The IDL extension for VSCode collects anonymous usage data on the extension. The goal of this information is to improve the overall experience, focus development on tools that users work with the most, and make sure our software can run on the average user's hardware.

apps/client-e2e/src/main.ts

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { FindIDL } from '@idl/idl';
22
import { EXTENSION_FULL_NAME, GetExtensionPath } from '@idl/shared';
33
import { Sleep } from '@idl/tests/helpers';
4-
import { GetWorkspaceConfig, IIDLWorkspaceConfig } from '@idl/vscode/config';
5-
import { IDL_EXTENSION_CONFIG_KEYS } from '@idl/vscode/extension-config';
4+
import { GetWorkspaceConfig } from '@idl/vscode/config';
65
import { IInitializeType } from '@idl/vscode/initialize-types';
76
import { OpenFileInVSCode, VSCODE_COMMANDS } from '@idl/vscode/shared';
87
import expect from 'expect';
98
import { performance } from 'perf_hooks';
109
import * as vscode from 'vscode';
1110

11+
import { ResetSettingsForTests } from './tests/helpers/reset-settings-for-tests';
1212
import { TestRunner } from './tests/runner';
1313

1414
/**
@@ -66,6 +66,12 @@ export async function run(): Promise<void> {
6666
GetExtensionPath('idl/test/client-e2e/load_first_problems.pro')
6767
);
6868

69+
// get the current workspace config
70+
const config = GetWorkspaceConfig();
71+
72+
// reset config
73+
await ResetSettingsForTests(config);
74+
6975
// flag if we have started or not
7076
let started = false;
7177

@@ -104,16 +110,6 @@ export async function run(): Promise<void> {
104110
// close editor
105111
await vscode.commands.executeCommand(VSCODE_COMMANDS.CLOSE_EDITOR);
106112

107-
// get the current workspace config
108-
const config = GetWorkspaceConfig();
109-
110-
// set latest IDL folder
111-
(config as IIDLWorkspaceConfig).update(
112-
IDL_EXTENSION_CONFIG_KEYS.IDLDirectory,
113-
idlDir,
114-
true
115-
);
116-
117113
// check if we allow debug logs
118114
if (DEBUG_LOGS) {
119115
ACTIVATION_RESULT.client.logger.setDebug(DEBUG_LOGS);
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* Test configuration with constants to easily change timeouts and delays when running tests
3+
*
4+
* These occasionally need to change so tests pass 100% of the time
5+
*/
6+
export const CLIENT_E2E_CONFIG = {
7+
/** Test delays */
8+
DELAYS: {
9+
/** Problem delay for PRO files and anything else */
10+
DEFAULT: 1000,
11+
/** Problem delay for IDL Notebooks */
12+
PROBLEMS_NOTEBOOK: 1000,
13+
},
14+
};
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
import { FindIDL } from '@idl/idl';
2+
import { GetExtensionPath, IDL_LANGUAGE_NAME } from '@idl/shared';
3+
import { IIDLWorkspaceConfig } from '@idl/vscode/config';
4+
import {
5+
DEFAULT_IDL_EXTENSION_CONFIG,
6+
IDL_EXTENSION_CONFIG_KEYS,
7+
} from '@idl/vscode/extension-config';
8+
import copy from 'fast-copy';
9+
import { deepEqual } from 'fast-equals';
10+
import { readFileSync } from 'fs';
11+
12+
/**
13+
* Scope we reset at
14+
*/
15+
const SCOPE = true;
16+
17+
/** read in the package.json */
18+
const PACKAGE = JSON.parse(
19+
readFileSync(GetExtensionPath('package.json'), 'utf-8')
20+
);
21+
22+
/**
23+
* Copy the config
24+
*/
25+
let SAFE_COPY = copy(DEFAULT_IDL_EXTENSION_CONFIG);
26+
27+
/**
28+
* Wrapper to correctly set config because of nonsense settings API
29+
*/
30+
async function ResetConfigToDefault(config: IIDLWorkspaceConfig, key: string) {
31+
// starting point to descend
32+
let nested = SAFE_COPY;
33+
34+
/** remove BS from keys from package */
35+
const cleanKey = key.replace(`${IDL_LANGUAGE_NAME}.`, '');
36+
37+
/** get key path */
38+
const split = cleanKey.split(/\./g);
39+
40+
// descend to get value
41+
for (let i = 0; i < split.length; i++) {
42+
nested = nested[split[i]];
43+
}
44+
45+
// reset key if it has changed
46+
if (!deepEqual(config.get(cleanKey), nested)) {
47+
await config.update(cleanKey, nested, SCOPE);
48+
}
49+
}
50+
51+
/**
52+
* Reset extension config for running tests to make sure it is always fresh and consistent
53+
*/
54+
export async function ResetSettingsForTests(config: IIDLWorkspaceConfig) {
55+
// reset our safe copy
56+
SAFE_COPY = copy(DEFAULT_IDL_EXTENSION_CONFIG);
57+
58+
// track props to update
59+
let props: string[] = [];
60+
61+
/** Get defaults */
62+
const fConfig = PACKAGE['contributes']['configuration'];
63+
64+
// get all properties
65+
for (let i = 0; i < fConfig.length; i++) {
66+
props = props.concat(Object.keys(fConfig[i]['properties']));
67+
}
68+
69+
// reset all properties
70+
for (let i = 0; i < props.length; i++) {
71+
await ResetConfigToDefault(config, props[i]);
72+
}
73+
74+
// // open settings
75+
// await vscode.commands.executeCommand('workbench.action.openSettingsJson');
76+
77+
// // get current editor
78+
// const activeEditor = vscode.window.activeTextEditor;
79+
80+
// // get current document
81+
// const settings = activeEditor.document;
82+
83+
// // replace with default content
84+
// // await ReplaceDocumentContent(settings, '{}');
85+
// // await ReplaceDocumentContent(
86+
// // settings,
87+
// // `{"${IDL_LANGUAGE_NAME}.${
88+
// // IDL_EXTENSION_CONFIG_KEYS.IDLDirectory
89+
// // }": ${JSON.stringify(idlDir)}}`
90+
// // );
91+
92+
// // update settings
93+
// await settings.save();
94+
95+
// // Close the active settings.json editor
96+
// await vscode.commands.executeCommand('workbench.action.closeActiveEditor');
97+
98+
/**
99+
* Manually specify IDL folder
100+
*/
101+
const idlDir = FindIDL();
102+
103+
// validate we know where it is
104+
if (!idlDir) {
105+
throw new Error('Unable to find IDL, cannot run tests');
106+
}
107+
108+
// set latest IDL folder
109+
await config.update(IDL_EXTENSION_CONFIG_KEYS.IDLDirectory, idlDir, true);
110+
}

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

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,29 @@ import { Logger } from '@idl/logger';
22

33
import { Runner } from '../runner.class';
44
import { AddDocs } from './add-docs';
5+
import {
6+
ExecuteCodeActionsWithEditForNotebook,
7+
ExecuteCodeActionsWithEditForPROFile,
8+
} from './execute-code-actions-with-edits';
9+
import { IDLDisableAllFromSettings } from './idl-disable-all-from-setting';
10+
import { IDLDisableAllFromSettingsForNotebook } from './idl-disable-all-from-setting-for-notebook';
11+
import {
12+
IDLDisableAllFromComments,
13+
IDLDisableLinesFromComments,
14+
} from './idl-disable-from-comments';
15+
import { IDLDisableIndividualsFromSettings } from './idl-disable-individuals-from-setting';
16+
import { IDLDisableIndividualsFromSettingsForNotebook } from './idl-disable-individuals-from-setting-for-notebook';
517
import { IDLJSONInteractRight } from './idl-json-interact-right';
618
import { IndexIDLFolderRightAndOpenEditClose } from './index-idl-folder-right-and-open-edit-close';
719
import { MigrateCodeDL30, MigrateCodeDL30_2 } from './migrate-code-dl-3.0';
820
import { NotebookProblemsTrackRight } from './notebook-problems-track-right';
921
import { NotebookCompletionBasic } from './notebooks-completion-basic';
1022
import { NotebooksInteractRight } from './notebooks-interact-right';
1123
import { NotebooksNoDuplicateRoutines } from './notebooks-no-duplicate-routines';
24+
import {
25+
ProCodeCodeActionsExisting,
26+
ProCodeCodeActionsNoExisting,
27+
} from './pro-code-code-actions';
1228
import { ProCodeInteractRight } from './pro-code-interacts-right';
1329
import { TasksInteractRight } from './tasks-interact-right';
1430

@@ -62,6 +78,65 @@ INTERACTIONS_RUNNER.addTest({
6278
fn: ProCodeInteractRight,
6379
});
6480

81+
INTERACTIONS_RUNNER.addTest({
82+
name: 'Disable problem reporting using comments (all)',
83+
fn: IDLDisableAllFromComments,
84+
});
85+
86+
INTERACTIONS_RUNNER.addTest({
87+
name: 'Disable problem reporting using comments (by line)',
88+
fn: IDLDisableLinesFromComments,
89+
});
90+
91+
INTERACTIONS_RUNNER.addTest({
92+
name: 'Disable problem reporting from root setting',
93+
fn: IDLDisableAllFromSettings,
94+
critical: true,
95+
});
96+
97+
INTERACTIONS_RUNNER.addTest({
98+
name: 'Disable problem reporting from root setting (notebooks)',
99+
fn: IDLDisableAllFromSettingsForNotebook,
100+
critical: true,
101+
});
102+
103+
INTERACTIONS_RUNNER.addTest({
104+
name: 'Disable problem reporting from individual setting',
105+
fn: IDLDisableIndividualsFromSettings,
106+
critical: true,
107+
});
108+
109+
INTERACTIONS_RUNNER.addTest({
110+
name: 'Disable problem reporting from individual setting (notebooks)',
111+
fn: IDLDisableIndividualsFromSettingsForNotebook,
112+
critical: true,
113+
});
114+
115+
INTERACTIONS_RUNNER.addTest({
116+
name: 'Code actions for none existing',
117+
fn: ProCodeCodeActionsNoExisting,
118+
});
119+
120+
INTERACTIONS_RUNNER.addTest({
121+
name: 'Code actions for existing',
122+
fn: ProCodeCodeActionsExisting,
123+
});
124+
125+
INTERACTIONS_RUNNER.addTest({
126+
name: 'Code actions for notebook cell',
127+
fn: ProCodeCodeActionsExisting,
128+
});
129+
130+
INTERACTIONS_RUNNER.addTest({
131+
name: 'Execute code actions for PRO code',
132+
fn: ExecuteCodeActionsWithEditForPROFile,
133+
});
134+
135+
INTERACTIONS_RUNNER.addTest({
136+
name: 'Execute code actions for notebook',
137+
fn: ExecuteCodeActionsWithEditForNotebook,
138+
});
139+
65140
INTERACTIONS_RUNNER.addTest({
66141
name: 'Notebooks interact right',
67142
fn: NotebooksInteractRight,

0 commit comments

Comments
 (0)