CrossBreezeNL / crossmodel

An open-source logical data modeler to support the model driven data engineering approach.
GNU Affero General Public License v3.0
8 stars 3 forks source link

Text editor is not handling indentation and - prefix within collections automatically #50

Open harmen-xb opened 8 months ago

harmen-xb commented 8 months ago

When writing a YAML file by hand, and you type the property name of a collection and then press 'Enter', to get to the next line the identation is not automatically done. You have to indent it yourself to get the right auto-completion.

Since within the grammer it is known that we just typed the name of a collection/array the LSP/editor should be aware that indentation needs to happen.

After indentation for a collection we always need to start with a '- ' the describe the item in the collection, which can also be automated.

harmen-xb commented 2 months ago

@martin-fleck-at

I saw in Langium there now is official indent and dedent support: https://github.com/eclipse-langium/langium/issues/1016

I guess we can use this i.s.o. of our custom indent dedent stuff?

And also would using this help with solving this issue?

martin-fleck-at commented 2 months ago

Yes, I think that should help us get rid of some of our custom implementation. In general, I believe it might be good idea to upgrade our Langium version but there were some breaking changes, so we need to be careful.

harmen-xb commented 1 month ago

Retested after Langium upgrade to v3.2.0 and the LSP suggestions are better, but the indentation is not automaitcally done correct in the monaco editor with the CrossModel files.

For example when you have the following piece of code for an entity:

entity:
    id: TestEntity
    name: "TestEntity"
    attributes:

And the cursor is directly after attributes: and you press enter you would expect the new line to be indented and to start with a dash. Like this: entity:

    id: TestEntity
    name: "TestEntity"
    attributes:
        - 

But this doesn't happen, it just jump to the next line and indent it evenly with attributes:.