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 parenthesis inclusion #459

Merged
merged 1 commit into from Aug 17, 2020
Merged

fix parenthesis inclusion #459

merged 1 commit into from Aug 17, 2020

Conversation

asottile
Copy link
Contributor

Signed-off-by: Anthony Sottile asottile@umich.edu

this was crashing my text editor with something like this:

resource "a" "a" {
  b = ()
}
$ babi t.tf
Traceback (most recent call last):
  File "/home/asottile/bin/babi", line 8, in <module>
    sys.exit(main())
  File "/home/asottile/opt/venv/lib/python3.8/site-packages/babi/main.py", line 152, in main
    return c_main(stdscr, filenames, positions, stdin, perf)
  File "/home/asottile/opt/venv/lib/python3.8/site-packages/babi/main.py", line 57, in c_main
    res = _edit(screen, stdin)
  File "/home/asottile/opt/venv/lib/python3.8/site-packages/babi/main.py", line 29, in _edit
    screen.draw()
  File "/home/asottile/opt/venv/lib/python3.8/site-packages/babi/screen.py", line 258, in draw
    self.file.draw(self.stdscr, self.margin)
  File "/home/asottile/opt/venv/lib/python3.8/site-packages/babi/file.py", line 789, in draw
    file_hl.highlight_until(self.buf, self.buf.file_y + to_display)
  File "/home/asottile/opt/venv/lib/python3.8/site-packages/babi/hl/syntax.py", line 119, in highlight_until
    state, regions = self._hl(state, lines[i], i == 0)  # type: ignore
  File "/home/asottile/opt/venv/lib/python3.8/site-packages/babi/hl/syntax.py", line 63, in _hl_uncached
    new_state, regions = highlight_line(
  File "/home/asottile/opt/venv/lib/python3.8/site-packages/babi/highlight.py", line 782, in highlight_line
    search_res = state.cur.rule.search(
  File "/home/asottile/opt/venv/lib/python3.8/site-packages/babi/highlight.py", line 485, in search
    return _do_regset(idx, match, self, compiler, state, pos)
  File "/home/asottile/opt/venv/lib/python3.8/site-packages/babi/highlight.py", line 363, in _do_regset
    target_rule = compiler.compile_rule(rule.u_rules[idx])
  File "/home/asottile/opt/venv/lib/python3.8/site-packages/babi/highlight.py", line 663, in compile_rule
    ret = self._c_rules[rule] = self._compile_rule(grammar, rule)
  File "/home/asottile/opt/venv/lib/python3.8/site-packages/babi/highlight.py", line 631, in _compile_rule
    regs, rules = self._patterns(grammar, rule.patterns)
  File "/home/asottile/opt/venv/lib/python3.8/site-packages/babi/highlight.py", line 595, in _patterns
    tmp_regs, tmp_rules = self._include(
  File "/home/asottile/opt/venv/lib/python3.8/site-packages/babi/highlight.py", line 578, in _include
    grammar = self._grammars.grammar_for_scope(s)
  File "/home/asottile/opt/venv/lib/python3.8/site-packages/babi/highlight.py", line 708, in grammar_for_scope
    raw = self._raw_for_scope(scope)
  File "/home/asottile/opt/venv/lib/python3.8/site-packages/babi/highlight.py", line 690, in _raw_for_scope
    grammar_path = self._scope_to_files.pop(scope)
KeyError: 'expressions'

Signed-off-by: Anthony Sottile <asottile@umich.edu>
@hashicorp-cla
Copy link

hashicorp-cla commented Aug 15, 2020

CLA assistant check
All committers have signed the CLA.

@aeschright aeschright self-requested a review August 17, 2020 23:05
Copy link
Contributor

@aeschright aeschright left a comment

Choose a reason for hiding this comment

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

Thanks for catching this!

@aeschright aeschright merged commit 7175614 into hashicorp:master Aug 17, 2020
aeschright added a commit that referenced this pull request Aug 17, 2020
@asottile asottile deleted the fix_terraform_parenthesis branch August 18, 2020 02:40
@ghost
Copy link

ghost commented Oct 9, 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.

@hashicorp hashicorp locked as resolved and limited conversation to collaborators Oct 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants