JetBrains / MPS-extensions

MPS-extensions aims to ease language development within MPS.
https://jetbrains.github.io/MPS-extensions/
Apache License 2.0
83 stars 52 forks source link

de.slisson.mps.structure.Table Action map is ignored for Partial tables #643

Open TomasLajcin opened 1 year ago

TomasLajcin commented 1 year ago

Hello, We prepared sample project to demonstrate the issue. I used ActionMap for concept Table(de.slisson.mps.structure.Table) to handle actions Delete, Cut,... The concept Table has Table_Editor and I set Table_ActionMap for vertical%rows% which are partial tables. The problem is Table_ActionMap is ignored and no action are handled. Could somebody try to fix it or provide some workaround? Is there any documentation for Table or PartialTable?

See sample project in attachment. The model node to test it is de.bluefu.tables.sandbox.Some Catalogue.

There are details about used MPS and extensions: com.mbeddr.platform.mbeddr.version=2021.2-2021.2.23417.b054e9b JetBrains MPS 2021.2.5 Build #MPS-212.5284.1355, built on March 18, 2022

Thank you for your answer. de.bluefu.tables-master.zip ExampleInModel

alexanderpann commented 1 year ago

Unfortunately, action maps can't be added at arbitrary places, so I can only try to provide a workaround. For the \ cells, add the action map to the editor of Value. You can do it the same way for First Sub Row , Second Sub Row, and ColumnHeader. For Row 1 you can at least use the on-delete and insert new header method in the table editor.
The problem with functions like getHeaders is that they generate the editor cell for you and you can't easily add the action map. For single cells in queries, you can create them via editorContext.createCell where you can assign the action map to your cell. For the Row n cells this approach doesn't work because the row index wouldn't work.

In general,  you can right-click a cell in the editor -> Language Debug -> Show Cell In Explorer to see the actions that are actually assigned to those cells. If you need full control over the cells, you could alternatively also use a gridquery. It might help you figure out a workaround. There is demo language in this repository, that uses it:

Regarding documentation: This is all we have at the moment: https://jetbrains.github.io/MPS-extensions/extensions/editor/tables/

TomasLajcin commented 1 year ago

Thank you for your answer. I tried to modify action map to handle action CUT and DELETE. I testeed many versions MPS Extensions and I got following results for actions:

Is it possible to fix it please? image