Skip to content

Commit eb49e67

Browse files
zthcristianoc
authored andcommitted
add option for autostarting the code analyzer
1 parent 7e85c55 commit eb49e67

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

analysis/examples/example-project/bsconfig.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,7 @@
88
"bs-dependencies": ["reason-react"],
99
"reason": { "react-jsx": 3 },
1010
"namespace": "my-namespace",
11-
"refmt": 3
12-
}
11+
"reanalyze": {
12+
"analysis": ["dce", "exception"]
13+
}
14+
}

client/src/extension.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,15 @@ export function activate(context: ExtensionContext) {
229229

230230
// Start the client. This will also launch the server
231231
context.subscriptions.push(client.start());
232+
233+
// Autostart code analysis if wanted
234+
if (
235+
workspace
236+
.getConfiguration("rescript.settings")
237+
.get<boolean>("autoRunCodeAnalysis")
238+
) {
239+
commands.executeCommand("rescript-vscode.start_code_analysis");
240+
}
232241
}
233242

234243
export function deactivate(): Thenable<void> | undefined {

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@
126126
"type": "boolean",
127127
"default": true,
128128
"description": "Whether you want the extension to prompt for autostarting a ReScript build if a project is opened with no build running."
129+
},
130+
"rescript.settings.autoRunCodeAnalysis": {
131+
"type": "boolean",
132+
"default": false,
133+
"description": "Automatically start ReScript's code analysis."
129134
}
130135
}
131136
},

0 commit comments

Comments
 (0)