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

Content assist with reference is broken when the same rule is possible in context twice #1626

Open
cdietrich opened this issue Aug 13, 2024 · 0 comments
Labels
bug Something isn't working completion Completion related issue

Comments

@cdietrich
Copy link
Contributor

given the grammar

entry Model:
    'model' name=ID '{'
        enitities+=Entity*
        elements+=Element*
    '}';

Entity: "entity" name=ID "{"
    fields+=Field*
    '}';

Field:
    name=ID;

Element:
    name=ID ":" type=TypeWithEverythingAndSauce;

TypeWithEverythingAndSauce:
    InlineType | Type | FieldType;

InlineType:
    {infer InlineType} 'inline' '<' '{' '}' '>';

BuiltInType infers BuiltInType:
    TextType |
    NumberType;

TextType infers DataType:
    name='Text';
NumberType infers DataType:
    name='Number';

FieldType:
    'field''<' entity=[Entity:ID] '.' field=FieldRefOrBuiltInField'>';

Type:
    BuiltInType | FieldType;

FieldRef:
    field=[Field:ID];

BuiltInFieldId infers BuiltInField:
    name="id";

FieldRefOrBuiltInField:
    FieldRef | BuiltInFieldId;

and scope provider

export class HelloWorldScopeProvider extends DefaultScopeProvider {
    override getScope(context: ReferenceInfo): Scope {
        if (isFieldRef(context.container)) {
            if (context.property === "field") {
                return this.createScopeForNodes(context.container.$container.entity.ref?.fields || []);
            }
        }
        return super.getScope(context);
    }
}

content assist does not work here

model mymodel {
    entity MyEntitiy { yyyy}
    xxxx: field<MyEntitiy.|yyyy>
}
grafik

when removing the redunant FieldType from TypeWithEverythingAndSauce it works as expected

grafik
@cdietrich cdietrich added the bug Something isn't working label Aug 13, 2024
@msujew msujew added the completion Completion related issue label Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working completion Completion related issue
Projects
None yet
Development

No branches or pull requests

2 participants