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

Helix is no longer compatible with Sveltekit page and layout naming conventions #9331

Closed
DaveTJones opened this issue Jan 13, 2024 · 1 comment · Fixed by #9333
Closed

Helix is no longer compatible with Sveltekit page and layout naming conventions #9331

DaveTJones opened this issue Jan 13, 2024 · 1 comment · Fixed by #9333
Labels
C-bug Category: This is a bug E-has-instructions Call for participation: Has instructions for fixing the issue and opening a PR

Comments

@DaveTJones
Copy link

Summary

Attempting to create a new page or layout file for Sveltekit by passing the desired name of the file to Helix as an argument now results in an error:

> hx +layout.svelte

Error: could not parse arguments

Caused by:
    bad line number after +

This can be worked around, but is annoying. Could this be avoided by providing fallback behaviour or parsing arguments which have a file extension differently to other arguments? If so I'm happy to try implementing a fix.

Reproduction Steps

I tried this:

  1. hx +layout.svelte

I expected this to happen:
A buffer to open that would later be saved as '+layout.svelte'

Instead, this happened:
Helix attempted to parse the file name as a line number

Helix log

~/.cache/helix/helix.log
please provide a copy of `~/.cache/helix/helix.log` here if possible, you may need to redact some of the lines

Platform

Linux

Terminal Emulator

Alacritty

Installation Method

source

Helix Version

23.10-190-g17dd102e

@DaveTJones DaveTJones added the C-bug Category: This is a bug label Jan 13, 2024
@the-mikedavis
Copy link
Member

I think it's reasonable to interpret the argument as a file if we can't parse the number instead of returning an error like we do now. In this block:

arg if arg.starts_with('+') => {
let arg = &arg[1..];
line_number = match arg.parse::<usize>() {
Ok(n) => n.saturating_sub(1),
_ => anyhow::bail!("bad line number after +"),
};

let's set line_number when the arg.parse::<usize>() is ok and push the arg to the args.files vec otherwise.

@pascalkuthe pascalkuthe added the E-has-instructions Call for participation: Has instructions for fixing the issue and opening a PR label Jan 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug E-has-instructions Call for participation: Has instructions for fixing the issue and opening a PR
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants