Environment
- VS Code: 1.130.0
- Extension: Solidity by Nomic Foundation v0.8.29
- OS: macOS (Apple Silicon)
- Node.js: v24.10.0
- Foundry: 1.7.1
- Hardhat: 3.11.1
Description
I'm using a standard Foundry project.
Import completion works correctly, for example:
import "@openzeppelin/contracts/access/Ownable.sol";
However, basic Solidity keyword/type completion does not work at all.
Examples that don't appear in completion:
contract
interface
library
struct
enum
address
uint256
mapping
event
modifier
Pressing Ctrl+Space also shows no language-server suggestions for these keywords.
Other language features continue to work:
- ✅ Import path completion
- ✅ Go to Definition
- ✅ Workspace indexing
- ❌ Keyword/type completion
Reproduction
forge init test-lsp
cd test-lsp
forge install OpenZeppelin/openzeppelin-contracts
code .
Install:
- Solidity by Nomic Foundation v0.8.29
Open src/Counter.sol.
Type:
Expected:
Actual:
No completion is shown.
Language Server Output
[indexing] Found projects:
- Type: Foundry
Base path: .../test-lsp
- Type: Hardhat
Base path: .../test-lsp/lib/openzeppelin-contracts
Config file: .../lib/openzeppelin-contracts/hardhat.config.js
[openzeppelin-contracts] Error loading HRE:
Cannot find module '/.../node_modules/hardhat/register.js'
[indexing] Scan complete, 486 sol files found
[indexing] Analyzing 1 solidity files
[indexing] Finished analyzing
Additional Information
The extension appears to detect lib/openzeppelin-contracts as a Hardhat project because the dependency contains a hardhat.config.js.
However, the extension then attempts to load:
Hardhat 3 no longer exports this entrypoint.
Verification:
node -p "require.resolve('hardhat/register')"
returns
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]:
Package subpath './register' is not defined by "exports"
while
node -p "require.resolve('hardhat')"
correctly returns
.../node_modules/hardhat/dist/src/index.js
Hardhat version:
Its package exports do not include ./register.
Notes
I'm not sure whether the missing keyword completion is directly caused by the failed Hardhat initialization, but the two issues consistently occur together in a clean Foundry project.
The project itself is otherwise functional:
- Forge builds successfully.
- Import completion works.
- Go to Definition works.
- Only keyword/type IntelliSense appears to be missing.
Environment
Description
I'm using a standard Foundry project.
Import completion works correctly, for example:
However, basic Solidity keyword/type completion does not work at all.
Examples that don't appear in completion:
contractinterfacelibrarystructenumaddressuint256mappingeventmodifierPressing
Ctrl+Spacealso shows no language-server suggestions for these keywords.Other language features continue to work:
Reproduction
Install:
Open
src/Counter.sol.Type:
Expected:
Actual:
No completion is shown.
Language Server Output
Additional Information
The extension appears to detect
lib/openzeppelin-contractsas a Hardhat project because the dependency contains ahardhat.config.js.However, the extension then attempts to load:
Hardhat 3 no longer exports this entrypoint.
Verification:
node -p "require.resolve('hardhat/register')"returns
while
node -p "require.resolve('hardhat')"correctly returns
Hardhat version:
Its package exports do not include
./register.Notes
I'm not sure whether the missing keyword completion is directly caused by the failed Hardhat initialization, but the two issues consistently occur together in a clean Foundry project.
The project itself is otherwise functional: