Skip to content

Commit dc9def6

Browse files
Import go to definition issues introduced with remappings #295 also discussion at #277
Removes "imp" snippet as it confuses the "import " + Ctrl Space to autocomplete all the defintions.
1 parent 12547ae commit dc9def6

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Diff for: snippets/solidity.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@
1818
"body": "pragma abicoder v2;"
1919
},
2020
"import contract": {
21-
"prefix": "imp",
22-
"body": "import '${1:contract}';"
21+
"prefix": "import",
22+
"body": "import ",
23+
"description": "Press Ctrl+Space to autocomplete imports"
2324
},
2425
"contract declaration": {
2526
"prefix": "con",

Diff for: src/server/definitionProvider.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -635,9 +635,9 @@ export class SolidityDefinitionProvider {
635635
private resolveImportPath(importPath: string, contract: Contract): string {
636636
if (contract.isImportLocal(importPath)) {
637637
return contract.formatContractPath(path.resolve(path.dirname(contract.absolutePath), importPath));
638-
} else if (this.project !== undefined) {
638+
} else if (this.project !== undefined && this.project !== null) {
639639
const remapping = this.project.findImportRemapping(importPath);
640-
if(remapping !== undefined) {
640+
if(remapping !== undefined && remapping != null) {
641641
return contract.formatContractPath(remapping.resolveImport(importPath));
642642
} else {
643643
const depPack = this.project.findDependencyPackage(importPath);

0 commit comments

Comments
 (0)