Skip to content

Commit d589db5

Browse files
authored
feat(vscode): warn if FunC or Tolk extension are enabled (#34)
Fixes #33
1 parent bbb8638 commit d589db5

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

editors/code/src/extension.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ let client: LanguageClient | null = null
3434
let cachedToolchainInfo: SetToolchainVersionParams | null = null
3535

3636
export async function activate(context: vscode.ExtensionContext): Promise<void> {
37+
await checkConflictingExtensions()
38+
3739
startServer(context).catch(consoleError)
3840
await registerBuildTasks(context)
3941
registerOpenBocCommand(context)
@@ -657,3 +659,37 @@ function registerBocWatcher(bocDecompilerProvider: BocDecompilerProvider): FileS
657659
})
658660
return bocWatcher
659661
}
662+
663+
async function checkConflictingExtensions(): Promise<void> {
664+
const conflictingExtensions = [
665+
{id: "tonwhales.func-vscode", name: "FunC"},
666+
{id: "ton-core.tolk-vscode", name: "Tolk"},
667+
]
668+
669+
const installedConflicting = conflictingExtensions.filter(ext => {
670+
const extension = vscode.extensions.getExtension(ext.id)
671+
return extension && extension.isActive
672+
})
673+
674+
if (installedConflicting.length === 0) {
675+
return
676+
}
677+
678+
const extensionNames = installedConflicting.map(ext => ext.name).join(", ")
679+
const message = `Conflicting extensions detected: ${extensionNames}. We recommended to disable them to avoid conflicts. TON extension already includes the same functionality.`
680+
681+
const action = await vscode.window.showWarningMessage(
682+
message,
683+
"Show conflicting extensions",
684+
"Ignore",
685+
)
686+
687+
if (action === "Show conflicting extensions") {
688+
await vscode.commands.executeCommand("workbench.view.extensions")
689+
690+
await vscode.commands.executeCommand(
691+
"workbench.extensions.search",
692+
`@id:${installedConflicting[0].id}`,
693+
)
694+
}
695+
}

0 commit comments

Comments
 (0)