leptos-rs / start-axum

Starter template for use with the Leptos web framework and Axum.
The Unlicense
141 stars 26 forks source link

code is inactive due to #[cfg] directives: feature = "ssr" is disabled (inactive-code) #44

Closed oiwn closed 3 months ago

oiwn commented 3 months ago

What could be the way to actually activate certain features during development? Is it possible via local configuration?

I tried Helix/Neovim with rust analyser and in both got:

code is inactive due to #[cfg] directives: feature = "ssr" is disabled

gbj commented 3 months ago

You should tell rust-analyzer to activate all features, or specifically to activate the ssr feature, in your rust analyzer config. Here's my nvim setup, for example:

local rt = require("rust-tools")
rt.setup({
    server = {
        settings = {
            ["rust-analyzer"] = {
                -- ...
                -- activate all features of crates
                cargo = {
                    allFeatures = true,
                },
            -- ...
oiwn commented 3 months ago

Thank you! also it's possible to add default = ["ssr"] to [features] in Cargo.toml