Skip to content

VSCode integration with remappings.txt #2019

@douglasqian

Description

@douglasqian

Component

Forge

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (2457e5f 2022-06-16T00:04:29.19997Z)

What command(s) is the bug in?

No response

Operating System

macOS (Intel)

Describe the bug

Context

Been others report this issue on the support Telegram as well, and it doesn't seem like there is a great resolution beyond what is covered in this page (which most seem to have already tried):
https://book.getfoundry.sh/config/vscode.html

VSCode doesn't seem to be picking up what I have defined in remappings.txt.
image

Not a blocker because I can still run forge build and forge test just fine, but wondering if there is something I'm missing here.

Other config files

Using v0.0.139 (latest) of Juan Blanco's Solidity VSC extension

This is what my remappings.txt looks like:

ds-test/=lib/forge-std/lib/ds-test/src/
forge-std/=lib/forge-std/src/
@openzeppelin/=lib/openzeppelin-contracts/

This is what my foundry.toml looks like:

[default]
src = 'src'
out = 'out'
libs = ['lib']
solc_version = "0.8.10"

# See more config options https://github.com/foundry-rs/foundry/tree/master/config

This is what my VSC settings.json looks like:

{
    "solidity.defaultCompiler": "remote",
    "solidity.compileUsingRemoteVersion": "v0.8.10",
    "solidity.packageDefaultDependenciesContractsDirectory": "src",
    "solidity.packageDefaultDependenciesDirectory": "lib",
    "solidity.remappings": ["forge-std/=lib/forge-std/src/", "@openzeppelin/=lib/openzeppelin-contracts/"]
}

That last line I decided to add because I saw someone recommend it on the support Telegram but the problem persists.

Any help would be much appreciated! Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions