Skip to content

hardhat-vscode integration support#6630

Merged
antico5 merged 5 commits intov-nextfrom
lsp-support
May 6, 2025
Merged

hardhat-vscode integration support#6630
antico5 merged 5 commits intov-nextfrom
lsp-support

Conversation

@antico5
Copy link
Contributor

@antico5 antico5 commented Apr 24, 2025

This PR is meant to introduce all changes necessary for supporting hardhat3 projects on our vscode extension.

At the time, I aimed to introduce the bare minimal changes that would allow this integration:

  • Export the DependencyResolver class. The LSP can build its own dependency graph using this
  • Introduce a hook for reading solidity source files. This is necessary so we can read unsaved files from the editor
  • Inject a "readSourceFile" function down from the build system to the dependency resolver. As a first approach I was passing the HookManager down, but was suggested to instead use a function to avoid coupling. Then I had to define a helper factory and export it since I also need to use it from the LSP.

@changeset-bot
Copy link

changeset-bot bot commented Apr 24, 2025

🦋 Changeset detected

Latest commit: 5539400

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
hardhat Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@antico5 antico5 requested a review from alcuadrado May 4, 2025 14:33
@antico5 antico5 changed the title [WIP] hardhat-vscode integration support hardhat-vscode integration support May 5, 2025
"./config": "./dist/src/config.js",
"./hre": "./dist/src/hre.js",
"./plugins": "./dist/src/plugins.js",
"./lsp-helpers": "./dist/src/lsp-helpers.js",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prepend /internal

@@ -0,0 +1,3 @@
export { importUserConfig } from "./internal/config-loading.js";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move to hre exports


readSourceFile: (
context: HookContext,
absPath: string,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to absolutePath, nextAbsolutePath

import type { CompilerOutput, CompilerOutputError } from "./compiler-io.js";
import type { SolidityBuildInfo } from "./solidity-artifacts.js";

export type { Resolver } from "../../internal/builtin-plugins/solidity/build-system/resolver/types.js";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move to lsp helpers

@antico5 antico5 added this pull request to the merge queue May 6, 2025
Merged via the queue into v-next with commit b9eea77 May 6, 2025
84 checks passed
@antico5 antico5 deleted the lsp-support branch May 6, 2025 08:57
@github-project-automation github-project-automation bot moved this from Backlog to Done in Hardhat May 6, 2025
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 5, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants