Skip to content

Cannot detect declarations in other files #10

@Elsie19

Description

@Elsie19

I have the following tree:

.
├── Cargo.lock
├── Cargo.toml
└── src
    ├── main.rs
    ├── parse
    │   ├── grammar.rs
    │   └── internals
    │       ├── base.pest
    │       ├── command_substitution.pest
    │       ├── strings.pest
    │       └── variables.pest
    └── parse.rs

In src/parse/grammar.rs I have the following code:

use pest_derive::Parser;

#[derive(Parser)]
#[grammar = "parse/internals/strings.pest"]
#[grammar = "parse/internals/variables.pest"]
#[grammar = "parse/internals/command_substitution.pest"]
#[grammar = "parse/internals/base.pest"]
pub struct ElviParser;

Notice the placement of strings.pest and variables.pest: how variables.pest is defined after strings.pest.

If I edit variables.pest, I get the following error:

// Main rules
normalVariable = @{ variableIdent ~ "=" ~ anyString }   ■ Rule anyString is undefined

variableIdent = { !ASCII_DIGIT ~ (ASCII_ALPHANUMERIC | "_")+ }

Where anyString is defined in strings.pest. It compiles correctly, it's just the LSP not understanding this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions