Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i've been trying to get this to work for days now #5151

Open
WynonaEngine opened this issue Apr 19, 2024 · 2 comments
Open

i've been trying to get this to work for days now #5151

WynonaEngine opened this issue Apr 19, 2024 · 2 comments
Assignees
Labels
status:needs-more-info There's not enough information to start working on this issue

Comments

@WynonaEngine
Copy link

WynonaEngine commented Apr 19, 2024

Hi guys and guylettes!

im using vscode on windows 11: i setup foundry and added hardhat to it and for the life of me i cannot get this thing to work properly.
i want codehinting to work as expected, linting, remappings, prettier and hardhat to simply just work.

i get lost in millions of config files, but i think im almost there?

i went to do the following:

  1. i got git
  2. i installed foundryup to get foundry working on windows.
  3. created a project in a folder using gitbash: forge init
  4. then i ran: npm install --save-dev @nomicfoundation/hardhat-toolbox @nomicfoundation/hardhat-foundry
  5. i added the two require lines in the hardhatconfig
  6. i got the openzeppelin contracts using forge install
  7. i installed the hardhat extension for vscode (i had the prettier formatter extension earlier)
  8. i npm'd the solidity prettier plugin

i could not figure out how to properly setup Prettier to work with this setup.
my .vscode settings file looks like this rn:

{
    "editor.formatOnSave": true,
    "[solidity]": {
      "editor.defaultFormatter": "esbenp.prettier-vscode" 
    },
    "prettier.configPath": ".prettierrc"
  } 

i'm assuming this might not be correct since it seems to format solidity files but won't any other file. (settings.json for example)

my .prettierrc file is like this now:

{
    "plugins": ["prettier-plugin-solidity"],
    "overrides": [
      {
        "files": "*.sol",
        "options": {
          "parser": "solidity-parse",
          "printWidth": 80,
          "tabWidth": 4,
          "useTabs": false,
          "singleQuote": false,
          "bracketSpacing": false
        }
      }
    ]
  }

Whats working now:

  1. forge seems to be working now
  2. Prettier seems to at least recognize solidity files
  3. codehinting looks alright now

Whats NOT working:

  1. remapping is SO totally not working (Without errors shown in vscode [since no linting works], only on compile using forge)
  2. clicking on any file in the import list using go to definition (will land me on an empty page saying "The file is not displayed in the text editor because it is a directory."
  3. clicking on any go to definition in code

What am i missing?
Thank you guys!

@WynonaEngine
Copy link
Author

WynonaEngine commented Apr 19, 2024

oh i forgot to mention: i cannot just start vscode to have this working.
I get the following error:
Hardhat project "v1" was not able to initialize correctly: Couldn't run forge. Please check that your foundry installation is correct.

for now i have to got to the project folder and use gitbash to start vscode. which is also less than desirable.

@kanej
Copy link
Member

kanej commented Apr 25, 2024

How are you setting up your remappings for forge? Could you paste the remappings?

@schaable schaable added status:needs-more-info There's not enough information to start working on this issue and removed status:triaging labels May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:needs-more-info There's not enough information to start working on this issue
Projects
Status: Backlog
Development

No branches or pull requests

3 participants