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

panic on a svelte file #421

Closed
Canop opened this issue Jan 20, 2022 · 3 comments · Fixed by #427
Closed

panic on a svelte file #421

Canop opened this issue Jan 20, 2022 · 3 comments · Fixed by #427
Labels

Comments

@Canop
Copy link
Contributor

Canop commented Jan 20, 2022

Here's the file:

<script>
	import Navigation from '$lib/pages/Navigation.svelte';

	import '../app.postcss';
</script>

<Navigation />

<slot />

<style global lang="postcss">
	body,
	#svelte {
		@apply w-full h-full;
		@apply bg-neutral-100;
	}
</style>

It breaks both bat and broot, both using syntect 4.6.0.

image

thread 'main' panicked at 'Can only call resolve on linked references: ByScope { scope: <source.postcss>, sub_context: None }', /home/dys/.cargo/registry/src/github.com-1ecc6299db9ec823/syntect-4.6.0/src/parsing/syntax_definition.rs:191:18
stack backtrace:
   0: rust_begin_unwind
             at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/panicking.rs:517:5
   1: std::panicking::begin_panic_fmt
             at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/panicking.rs:460:5
   2: syntect::parsing::parser::ParseState::push_meta_ops
   3: <bat::printer::InteractivePrinter as bat::printer::Printer>::print_line
   4: bat::controller::Controller::print_file
   5: bat::controller::Controller::run_with_error_handler
   6: bat::run_controller
   7: bat::run
   8: bat::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
@Enselic
Copy link
Collaborator

Enselic commented Jan 20, 2022

Thank you for the bug report.

This is most likely a variant of sharkdp/bat#915

The plan is to fix this whole category of problems by falling back to Plain Text when referenced syntaxes are missing. This is what Sublime Text seems to be doing. There is some prototype code for that linked to from that issue. I hope to get around converting that prototype code to production code at some point, but there are currently more high prio things to do before that.

I don't think there is a ticket in syntect for this work, so we can keep this ticket open for that.

@Enselic Enselic added the bug label Jan 20, 2022
@Canop
Copy link
Contributor Author

Canop commented Jan 21, 2022

The problem IMO isn't about the fallback plan: that's the concern of the application instead and it must already have those plans for many other cases. What's crucial is that there's no panic in the syntect library but an error so that the program doesn't crash.

@keith-hall
Copy link
Collaborator

What's crucial is that there's no panic in the syntect library but an error so that the program doesn't crash.

#98 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants