jhipster / jhipster-ide

An IDE for the JHipster Domain Language
https://jhipster.github.io/jhipster-ide
126 stars 36 forks source link

Should support custom field type in Visual Studio Code plugin #335

Closed n5ken closed 4 years ago

n5ken commented 4 years ago

I appended some custom field types like Image, File etc to my generator, but once I add these types to jdl, the output keeps showing error message and Grapiviz not able to produce class diagram any more, but it work normal in jhipster online IDE, so can we ignore the field type check in VS Code?

Example:

entity LockGatewayModel {
  sn String required unique 
  name String
  note String
  // Does not support Image type
  image Image
}
colameo commented 4 years ago

I appended some custom field types like Image, File etc to my generator,

can you send me the whole JDL file or the link to the repo?

colameo commented 4 years ago

...and btw a custom enhanced JDL type system is not supported. JDL Studio is different and less restrictive with syntax checks. You can also define a completely invalid JDL model which won't compile like this:

Screenshot 2020-03-19 at 18 40 43
n5ken commented 4 years ago

Yes, JDL Studio will ignore type check and generate class diagram properly, that is what exactly I want, and VS Code not re-rendering diagram if format check fail. (I like the diagram style that generated by Grapiviz more than the one download from JDL Studio)

image

PS: I tried to add image type to jdl.snippets.json, but with no luck.

image

colameo commented 4 years ago

Your snippet change won't help either...

Okay, let me explain (very) roughly how it works internally. The JH IDE is not "just an editor" with some nice syntax coloring and some sort of code completion functionality. You can compare it to a "mini IDE" which internally implements a compiler for a programming language (in our case for JDL) with the typically features like syntax coloring, syntax checks, semantic validation, code completion, searching for references, refactoring’s, validation and more.

So, if your model is invalid 'cause you "somehow" introduced new types then the internal "mechanism" will reject your model and nothing works (even diagram generation).

I’m closing this issue as there is nothing we can do here.