pest-ide-tools icon indicating copy to clipboard operation
pest-ide-tools copied to clipboard

Crash in Language Server with invalid grammar

Open notpeter opened this issue 2 years ago • 0 comments

Describe the bug

Invalid (WIP) grammars can crash Pest Language Server

To Reproduce

  1. Type: Statement = { ( | "a" ) }
  2. Save.
  3. Watch language server crash 5 times.

I was in the middle of editing something. It was more complex than this, but basically was: Statement = { ( "b" | "a" ) } and I deleted the "b", but before I could type something new the lsp went kaput.

Log

thread 'main' panicked at 'Expected prefix or primary expression, found choice_operator(16, 17)', /Users/peter/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pest-2.7.2/src/pratt_parser.rs:346:18
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Expected behavior

LSP should never crash. Even on unexpected input.

Environment (please complete the following information):

  • OS: MacOS Ventura 13.4.1 (a)
  • Editor: vscode
  • Server Version: v0.3.3

notpeter avatar Aug 30 '23 02:08 notpeter