Skip to content

Commit 462e850

Browse files
committed
Show message to start the IDE
When the extension detects that this is an un-configured project (no `.dotty-ide-artifact`, no `build.sbt`), it shows a message asking the user whether she wants the IDE to be started.
1 parent 80f6278 commit 462e850

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

vscode-dotty/src/extension.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,23 @@ export function activate(context: ExtensionContext) {
3939

4040
} else {
4141
// Check whether `.dotty-ide-artifact` exists. If it does, start the language server,
42-
// otherwise, try to auto-configure it if there's no build.sbt
42+
// otherwise, try propose to start it if there's no build.sbt
4343
if (fs.existsSync(languageServerArtifactFile)) {
4444
runLanguageServer(coursierPath, languageServerArtifactFile)
4545
} else if (!fs.existsSync(buildSbtFile)) {
46-
fs.readFile(languageServerDefaultConfigFile, (err, data) => {
47-
if (err) throw err
48-
else {
49-
const [languageServerScalaVersion, sbtDottyVersion] = data.toString().trim().split(/\r?\n/)
50-
fetchAndConfigure(coursierPath, sbtArtifact, languageServerScalaVersion, sbtDottyVersion, loadPluginArtifact).then(() => {
51-
runLanguageServer(coursierPath, languageServerArtifactFile)
46+
vscode.window.showInformationMessage(
47+
"This looks like an unconfigured project. Would you like to start Dotty IDE?",
48+
"Yes", "No"
49+
).then(choice => {
50+
if (choice == "Yes") {
51+
fs.readFile(languageServerDefaultConfigFile, (err, data) => {
52+
if (err) throw err
53+
else {
54+
const [languageServerScalaVersion, sbtDottyVersion] = data.toString().trim().split(/\r?\n/)
55+
fetchAndConfigure(coursierPath, sbtArtifact, languageServerScalaVersion, sbtDottyVersion, loadPluginArtifact).then(() => {
56+
runLanguageServer(coursierPath, languageServerArtifactFile)
57+
})
58+
}
5259
})
5360
}
5461
})

0 commit comments

Comments
 (0)