jmacdonald / amp

A complete text editor for your terminal.

Home Page:https://amp.rs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Immediate panic when I put a custom syntax in ~/Library/Application\ Support/amp/syntaxes/

mnemnion opened this issue · comments

This is a syntax which I've used successfully with bat in the past.

Running amp after moving one .sublime-theme file into the indicated directory causes an immediate panic with this message:

thread 'main' panicked at 'attempted to leave type `linked_hash_map::Node<yaml::Yaml, yaml::Yaml>` uninitialized, which is invalid', /private/tmp/rust-20210325-49675-3ca9nq/rustc-1.51.0-src/library/core/src/mem/mod.rs:671:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

So I did, giving this

thread 'main' panicked at 'attempted to leave type `linked_hash_map::Node<yaml::Yaml, yaml::Yaml>` uninitialized, which is invalid', /private/tmp/rust-20210325-49675-3ca9nq/rustc-1.51.0-src/library/core/src/mem/mod.rs:671:9
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::panic
   3: linked_hash_map::LinkedHashMap<K,V,S>::insert
   4: yaml_rust::yaml::YamlLoader::insert_new_node
   5: <yaml_rust::yaml::YamlLoader as yaml_rust::parser::MarkedEventReceiver>::on_event
   6: yaml_rust::parser::Parser<T>::load_node
   7: yaml_rust::parser::Parser<T>::load_mapping
   8: yaml_rust::parser::Parser<T>::load
   9: yaml_rust::yaml::YamlLoader::load_from_str
  10: syntect::parsing::yaml_load::<impl syntect::parsing::syntax_definition::SyntaxDefinition>::load_from_str
  11: syntect::parsing::syntax_set::load_syntax_file
  12: syntect::parsing::syntax_set::SyntaxSet::load_syntaxes
  13: amp::models::application::Application::new
  14: amp::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Leaving off the xterm commands which restore the terminal to cooked mode and so on.

This .sublime-syntax doesn't rely on any other syntaxes, it's self-contained, and works in Sublime Text and bat.

I can provide the syntax file if that would be helpful.

commented

@mnemnion this seems related to: #205

@mnemnion thanks for the heads up! How did you go about installing amp? I can issue a new release for this, but want to make sure I'm covering your installation method.

Hi @jmacdonald I used Homebrew. I do have the Rust toolchain already, so if you want to give me a heads-up I'd be happy to test a release. Thanks!