textX-LS icon indicating copy to clipboard operation
textX-LS copied to clipboard

Command to run generator from textX view

Open danixeee opened this issue 5 years ago • 4 comments

image

The idea is to have a context menu (when user right-clicks on a generator item) with following options:

  • New configuration
  • Uninstall generator

EDIT: Didn't find way to create context menu, I will add inline icons instead.

where New configuration option will open a new json file like:

{
  "models": [
    "./path/to/model"
  ],
  "grammar": "path/to/grammar",
  "ignoreCase": false,
  "overwrite": false,
  "outputPath": ""
}

After saving configuration file, it should be listed under appropriate generator.

Each configuration will have three actions:

  • remove
  • edit (json file)
  • run

Extra: Configurations could be displayed using a web-view and html inside VS Code (similar like settings in VS Code itself).

danixeee avatar Jan 09 '20 00:01 danixeee

image

A progress so far.

By default, configurations are saved under textX/generator-configurations but I will make that configurable (other fs location, database, ...).

@igordejanovic @goto40 Some thoughts/ideas?

danixeee avatar Feb 19 '20 00:02 danixeee

@danixeee Here are some thoughts:

  • I think that config file should have language and target as mandatory config options. Those two will decide where in the list of generators should this config file be found.
  • grammar should be given if language is any (like for example dot generator from any model).
  • ignoreCase should only be valid if grammar is given.

I'm rethinking the set of params to textX generators. Maybe it would be better if we have pass in file names instead of metamodel/model?

igordejanovic avatar Mar 26 '20 13:03 igordejanovic

@igordejanovic Thanks for feedback.

I think that config file should have language and target as mandatory config options. Those two will decide where in the list of generators should this config file be found.

From issue description:

The idea is to have a context menu (when user right-clicks on a generator item) with following options:

  • New configuration
  • Uninstall generator

When user clicks on generator item, I will have language and target information. I guess I will programatically add it to the configuration file, since it will be required for running a generator.

I'm rethinking the set of params to textX generators. Maybe it would be better if we have pass in file names instead of metamodel/model?

Do you mean instead of --language and --grammar? From a file name extension we could recognise multiple matching languages, so probably --language should be kept. Or we could try to parse a model until we find a conforming one.

danixeee avatar Mar 27 '20 00:03 danixeee

When user clicks on generator item, I will have language and target information. I guess I will programatically add it to the configuration file, since it will be required for running a generator.

Sounds good. So it will end up in the config file. If those values are changed then the generator will be "moved" visually under appropriate node in the generator list.

Do you mean instead of --language and --grammar? From a file name extension we could recognise multiple matching languages, so probably --language should be kept. Or we could try to parse a model until we find a conforming one.

I'm thinking about current parameters of the generators call in textX. Probably that change won't affect the CLI so if you are calling generator from CLI it should work without change. Still not sure whether we should change that though.

igordejanovic avatar Mar 27 '20 09:03 igordejanovic