Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prevent crash when listing symbols in invalid config #273

Merged
merged 2 commits into from
Oct 9, 2020

Conversation

radeksimko
Copy link
Member

@radeksimko radeksimko commented Oct 9, 2020

We previously ignored all diagnostics, which includes both minor and major, the latter of which prevent the HCL parser from parsing anything and therefore resulting in nil being returned from ParseBlockFromTokens which was then unexpected outcome for Blocks().

Example of such invalid config

provider "aws"
  access_key = "value"
}

The crash didn't occur during completion because it uses some other position-based methods which would already stop before stepping further into the parser internals and in particular into ParseBlockFromTokens. Symbol listing however is not position based and so listing symbols on an invalid config leads to a crash.

@radeksimko radeksimko added the bug Something isn't working label Oct 9, 2020
@paultyng paultyng requested a review from appilon October 9, 2020 12:47
@radeksimko radeksimko merged commit 4b1d959 into master Oct 9, 2020
@radeksimko radeksimko deleted the b-fix-crash branch October 9, 2020 13:39
@radeksimko radeksimko changed the title fix: prevent crash when listing symbols fix: prevent crash when listing symbols in invalid config Oct 9, 2020
@ghost
Copy link

ghost commented Nov 8, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the context necessary to investigate further.

@ghost ghost locked as resolved and limited conversation to collaborators Nov 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants