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

Rust-analyzer unable to open compiled template file #157

Open
jcuffe opened this issue Jul 10, 2024 · 7 comments
Open

Rust-analyzer unable to open compiled template file #157

jcuffe opened this issue Jul 10, 2024 · 7 comments

Comments

@jcuffe
Copy link

jcuffe commented Jul 10, 2024

My VSCode's rust-analyzer is reporting an error while attempting to load the output file specified by the derive macro:
image

I think it's likely that I'm seeing this due to some improper configuration, but I'm not sure where to look. I've verified that the file exists, and this error isn't shown when running cargo clippy.

@bismitpanda
Copy link

This happens maybe because rust-analyzer cannot open non .rs files. If you close that file from the editor it stops showing.

@ghost
Copy link

ghost commented Jul 19, 2024

I have the same issue, and It seems to be caused by a include! macro in sailfish-compiler, I would've debugged it but unfortunately I don't have time

@Pranoy1c
Copy link

I am facing this same problem. Is there a way to fix this?

@panda-dev24 what do you mean by "if you close that file from the editor"? And why would that stop showing it?

@bismitpanda
Copy link

I am facing this same problem. Is there a way to fix this?

@panda-dev24 what do you mean by "if you close that file from the editor"? And why would that stop showing it?

It seems like it is an issue with rust-analyzer not being able to include non rs files. So if you close the file from the editor, rust analyzer stops complaining.

@Pranoy1c
Copy link

I posted this on Stack Overflow and the answer was that:

Since sailfish compiles the templates into files without any extension, it is not found by rust-analyzer.

This can be resolved when either sailfish creates and uses .rs files

https://stackoverflow.com/a/78886929/1634905

Can Sailfish create files with .rs extension?

@bismitpanda
Copy link

bismitpanda commented Aug 20, 2024

This line

output_file.push(filename_hash(&input_file, &config));

If it is changed to add the .rs extension after the filename_hash function call, it will be resolved. But I am not sure the file produced is valid rust.

@clispios
Copy link

clispios commented Nov 9, 2024

I am also experiencing this same issue. It would be nice to not have this be a glaring error in my editor (neovim) even if it compiles fine.

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

No branches or pull requests

4 participants