Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
fc84486c
Commit
fc84486c
authored
Jun 20, 2023
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix navigation between files in the same directory
parent
969ca17e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
3 deletions
+10
-3
getFullPathOfImportedFile.test.ts
ui/shared/monaco/utils/getFullPathOfImportedFile.test.ts
+9
-0
getFullPathOfImportedFile.ts
ui/shared/monaco/utils/getFullPathOfImportedFile.ts
+1
-3
No files found.
ui/shared/monaco/utils/getFullPathOfImportedFile.test.ts
View file @
fc84486c
...
@@ -9,6 +9,15 @@ it('construct correct absolute path', () => {
...
@@ -9,6 +9,15 @@ it('construct correct absolute path', () => {
expect
(
result
).
toBe
(
'
/foo/abc/contract.sol
'
);
expect
(
result
).
toBe
(
'
/foo/abc/contract.sol
'
);
});
});
it
(
'
construct correct absolute path if file is in the current directory
'
,
()
=>
{
const
result
=
getFullPathOfImportedFile
(
'
/abc/index.sol
'
,
'
./contract.sol
'
,
);
expect
(
result
).
toBe
(
'
/abc/contract.sol
'
);
});
it
(
'
returns undefined if imported file is outside the base file folder
'
,
()
=>
{
it
(
'
returns undefined if imported file is outside the base file folder
'
,
()
=>
{
const
result
=
getFullPathOfImportedFile
(
const
result
=
getFullPathOfImportedFile
(
'
/index.sol
'
,
'
/index.sol
'
,
...
...
ui/shared/monaco/utils/getFullPathOfImportedFile.ts
View file @
fc84486c
...
@@ -19,7 +19,7 @@ export default function getFullPathOfImportedFile(baseFilePath: string, imported
...
@@ -19,7 +19,7 @@ export default function getFullPathOfImportedFile(baseFilePath: string, imported
const
result
:
Array
<
string
>
=
baseFileChunks
.
slice
(
0
,
-
1
);
const
result
:
Array
<
string
>
=
baseFileChunks
.
slice
(
0
,
-
1
);
for
(
let
index
=
0
;
index
<
importedFileChunks
.
length
-
1
;
index
++
)
{
for
(
let
index
=
0
;
index
<
importedFileChunks
.
length
;
index
++
)
{
const
element
=
importedFileChunks
[
index
];
const
element
=
importedFileChunks
[
index
];
if
(
element
===
'
.
'
)
{
if
(
element
===
'
.
'
)
{
...
@@ -41,7 +41,5 @@ export default function getFullPathOfImportedFile(baseFilePath: string, imported
...
@@ -41,7 +41,5 @@ export default function getFullPathOfImportedFile(baseFilePath: string, imported
return
;
return
;
}
}
result
.
push
(
importedFileChunks
[
importedFileChunks
.
length
-
1
]);
return
'
/
'
+
result
.
join
(
'
/
'
);
return
'
/
'
+
result
.
join
(
'
/
'
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment