Skip to content
This repository was archived by the owner on Oct 7, 2025. It is now read-only.

Commit f7e5439

Browse files
committed
chore: configuration provider manual
1 parent 5ef897c commit f7e5439

File tree

6 files changed

+167
-99
lines changed

6 files changed

+167
-99
lines changed

.vscode/launch.json

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,24 @@
66
"version": "0.2.0",
77
"configurations": [
88
{
9-
"args": [
10-
"--extensionDevelopmentPath=${workspaceFolder}"
11-
],
12-
"name": "Launch Extension VSCE",
13-
"outFiles": [
14-
"${workspaceFolder}/out/**/*.js"
15-
],
16-
"preLaunchTask": "npm: compile",
9+
"name": "Launch Extension",
10+
"type": "extensionHost",
1711
"request": "launch",
18-
"type": "extensionHost"
12+
"runtimeExecutable": "${execPath}",
13+
"args": ["--extensionDevelopmentPath=${workspaceRoot}" ],
14+
"stopOnEntry": false,
15+
"sourceMaps": true,
16+
"outFiles": ["${workspaceRoot}/out/src/**/*.js"],
17+
"preLaunchTask": "npm: watch",
18+
"env": {
19+
"USE_NEW_CONFIG": "true"
20+
},
1921
},
2022
{
2123
"args": [
2224
"--extensionDevelopmentPath=${workspaceFolder}"
2325
],
24-
"name": "Launch Extension",
26+
"name": "Launch Extension xxxxx",
2527
"outFiles": [
2628
"${workspaceFolder}/dist/**/*.js"
2729
],
@@ -38,7 +40,10 @@
3840
],
3941
"outFiles": [
4042
"${workspaceFolder}/dist/**/*.js"
41-
]
43+
],
44+
"env": {
45+
"USE_NEW_CONFIG": "true"
46+
},
4247
},
4348
{
4449
"name": "Extension Tests",

.vscode/tasks.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"group": "build",
4343
"problemMatcher": [],
4444
"label": "npm: compile",
45-
"detail": "webpack --config ./build/node-extension.webpack.config.js"
45+
"detail": "npm run build"
4646
},
4747
{
4848
"type": "npm",

package-lock.json

Lines changed: 20 additions & 60 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
"scripts": {
9595
"vscode:prepublish": "npm run package",
9696
"compile": "webpack --config ./build/node-extension.webpack.config.js",
97-
"watch": "concurrently \"rollup -c -w\" \"webpack --watch --config ./build/node-extension.webpack.config.js\"",
97+
"watch": "npm run v:update && concurrently \"rollup -c -w\" \"webpack --watch --config ./build/node-extension.webpack.config.js\"",
9898
"build-webapp": "rollup -c",
9999
"build": "npm run v:update && rollup -c && vsce package",
100100
"build:beta": "npm run v:update && rollup -c && vsce package --pre-release",
@@ -182,10 +182,10 @@
182182
},
183183
"dependencies": {
184184
"convert-array-to-csv": "^2.0.0",
185-
"cosmiconfig": "^9.0.0",
186185
"lightning-flow-scanner-core": "4.48.0",
187186
"tabulator-tables": "^6.3.1",
188187
"uuid": "^11.0.5",
189-
"xml2js": "^0.6.2"
188+
"xml2js": "^0.6.2",
189+
"yaml": "^2.8.0"
190190
}
191191
}

src/commands/handlers.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import { findFlowCoverage } from '../libs/FindFlowCoverage';
88
import { CacheProvider } from '../providers/cache-provider';
99
import { testdata } from '../store/testdata';
1010
import { OutputChannel } from '../providers/outputChannel';
11+
import { ConfigProvider } from '../providers/config-provider';
12+
import { inspect } from 'util';
1113

1214
const { USE_NEW_CONFIG: isUseNewConfig } = process.env;
1315

@@ -32,7 +34,7 @@ export default class Commands {
3234
}
3335

3436
private async configRules() {
35-
if (isUseNewConfig) {
37+
if (isUseNewConfig === 'true') {
3638
await this.ruleConfiguration();
3739
return;
3840
}
@@ -100,7 +102,14 @@ export default class Commands {
100102
);
101103
}
102104

103-
private async ruleConfiguration() {}
105+
private async ruleConfiguration() {
106+
const configProvider = new ConfigProvider();
107+
const config = await configProvider.discover(
108+
vscode.workspace.workspaceFolders?.[0].uri.path
109+
);
110+
const document = await vscode.workspace.openTextDocument(config.fspath);
111+
await vscode.window.showTextDocument(document);
112+
}
104113

105114
private async debugView() {
106115
let results = testdata as unknown as core.ScanResult[];
@@ -160,11 +169,16 @@ export default class Commands {
160169
OutputChannel.getInstance().logChannel.trace('reset configurations');
161170
await this.configRules();
162171
}
163-
const ruleConfig = CacheProvider.instance.get('ruleconfig');
172+
let ruleConfig = CacheProvider.instance.get('ruleconfig');
164173
OutputChannel.getInstance().logChannel.debug(
165174
'load stored rule configurations',
166175
ruleConfig
167176
);
177+
if (isUseNewConfig) {
178+
// load and use config
179+
const configProvider = new ConfigProvider();
180+
ruleConfig = await configProvider.loadConfig(rootPath.fsPath);
181+
}
168182
results = core.scan(await core.parse(selectedUris), ruleConfig);
169183
OutputChannel.getInstance().logChannel.debug('Scan Results', ...results);
170184
await CacheProvider.instance.set('results', results);

0 commit comments

Comments
 (0)