diff --git a/toolchains/solidity/extension/src/extension.ts b/toolchains/solidity/extension/src/extension.ts index e2bb06f0..1b375188 100644 --- a/toolchains/solidity/extension/src/extension.ts +++ b/toolchains/solidity/extension/src/extension.ts @@ -6,6 +6,7 @@ import { } from 'vscode-languageclient/node'; import { createLinterClient } from './linter'; import { createFoundryCompilerClient } from './foundry-compiler'; +import registerForgeFmtLinter from "./fmt-wrapper"; let linterClient: LanguageClient; let foundryCompilerClient: LanguageClient; @@ -17,13 +18,16 @@ export async function activate(context: ExtensionContext) { context.subscriptions.push(linterClient); context.subscriptions.push(foundryCompilerClient); + registerForgeFmtLinter(context); + const folders = workspace.workspaceFolders; if (folders) { const files = await workspace.findFiles('**/*.sol', `${folders[0].uri.fsPath}/**`); files.forEach(file => { - if (!file.path.includes('forge-std')) + if (!file.path.includes('forge-std')) { workspace.openTextDocument(file); + } }); } diff --git a/toolchains/solidity/extension/src/fmt-wrapper.ts b/toolchains/solidity/extension/src/fmt-wrapper.ts index 2a629992..08549f6c 100644 --- a/toolchains/solidity/extension/src/fmt-wrapper.ts +++ b/toolchains/solidity/extension/src/fmt-wrapper.ts @@ -197,7 +197,7 @@ function registerForgeFmtLinter(context: vscode.ExtensionContext) { } ); - const linter = vscode.languages.registerDocumentFormattingEditProvider( + const formatter = vscode.languages.registerDocumentFormattingEditProvider( "solidity", { provideDocumentFormattingEdits: (document) => { @@ -239,7 +239,7 @@ function registerForgeFmtLinter(context: vscode.ExtensionContext) { context.subscriptions.push(lintSolFile); context.subscriptions.push(lintSolWorkspace); - context.subscriptions.push(linter); + context.subscriptions.push(formatter); } export default registerForgeFmtLinter;