Skip to content

Return undefined for finding file ranges on empty URI#620

Merged
aeisenberg merged 1 commit into
github:mainfrom
aeisenberg:aeisenberg/ast-viewer-no-location
Oct 19, 2020
Merged

Return undefined for finding file ranges on empty URI#620
aeisenberg merged 1 commit into
github:mainfrom
aeisenberg:aeisenberg/ast-viewer-no-location

Conversation

@aeisenberg

@aeisenberg aeisenberg commented Oct 16, 2020

Copy link
Copy Markdown
Contributor

Also, refactor resolveSourceFile to make it easier to read.
And add unit tests for resolveSourceFile.

This fixes a bug where clicking on an item in the AST viewer when the location is invalid threw an exception.

This PR also fixes a bug in resolveSourceFile where the pathWithinSourceArchive was being removed and appended to the sourceArchiveZipPath. In normal situations, we don't hit this bug because most database source archive uris have an empty path for the pathWithinSourceArchive.

Checklist

  • [ n/a ] CHANGELOG.md has been updated to incorporate all user visible changes made by this pull request.
  • [ n/a ] Issues have been created for any UI or other user-facing changes made by this pull request.
  • [ n/a ] @github/docs-content-dsp has been cc'd in all issues for UI or other user-facing changes made by this pull request.

@aeisenberg aeisenberg force-pushed the aeisenberg/ast-viewer-no-location branch 3 times, most recently from 95c68c3 to b119b46 Compare October 16, 2020 18:07
adityasharad
adityasharad previously approved these changes Oct 16, 2020

@adityasharad adityasharad left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks sensible. Thanks for the clear tests!

@aeisenberg

Copy link
Copy Markdown
Contributor Author

Please don't merge yet. The failing test is due to a legitimate bug in the source. Working on a fix now.

Also, refactor resolveSourceFile to make it easier to read.
And add unit tests for resolveSourceFile.

This commit fixes a bug in resolveSourceFile where the 
`pathWithinSourceArchive` was being removed and appended to the
`sourceArchiveZipPath`. In normal situations, we don't hit this bug
because most database source archive uris have an empty path for the
`pathWithinSourceArchive`.
@aeisenberg

Copy link
Copy Markdown
Contributor Author

@adityasharad could you take another look since this PR now fixes a second bug.

@aeisenberg aeisenberg merged commit c66fe07 into github:main Oct 19, 2020
@aeisenberg aeisenberg deleted the aeisenberg/ast-viewer-no-location branch November 24, 2020 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants