mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
lsp: Adds support for include paths and have {projectUri}/node_modules added by default.
- Factor out FileRepository's path resolving into own public function. - Fixes sourceUnitNameToUri() path resolving in relation to include paths being used. - Adding an solAssert(). - adds nother test for include-paths (bad include) - Fixes a case on Windows there an ill-formed URI was generated. - Dropping unnecessary if-branch when translating from sourceUnitName to URI.
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
// SPDX-License-Identifier: UNLICENSED
|
||||
pragma solidity >=0.8.0;
|
||||
|
||||
import "my-module/test.sol";
|
||||
|
||||
contract MyContract
|
||||
{
|
||||
function f(uint a, uint b) public pure returns (uint)
|
||||
{
|
||||
return MyModule.add(a, b);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// test:
|
||||
@@ -0,0 +1,10 @@
|
||||
// SPDX-License-Identifier: UNLICENSED
|
||||
pragma solidity >=0.8.0;
|
||||
|
||||
import "rootlib.sol";
|
||||
|
||||
contract MyContract
|
||||
{
|
||||
}
|
||||
// ----
|
||||
// rootlib:
|
||||
@@ -0,0 +1,11 @@
|
||||
// SPDX-License-Identifier: UNLICENSED
|
||||
pragma solidity >=0.8.0;
|
||||
|
||||
import "test.sol";
|
||||
// ^^^^^^^^^^^^^^^^^^ @IncludeLocation
|
||||
|
||||
contract SomeContract
|
||||
{
|
||||
}
|
||||
// ----
|
||||
// file_not_found_in_searchpath: @IncludeLocation 6275
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// SPDX-License-Identifier: UNLICENSED
|
||||
pragma solidity >=0.8.0;
|
||||
|
||||
library MyModule
|
||||
{
|
||||
function add(uint a, uint b) public pure returns (uint)
|
||||
{
|
||||
return a + b;
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// SPDX-License-Identifier: UNLICENSED
|
||||
pragma solidity >=0.8.0;
|
||||
|
||||
library MyRootLib
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user