langium icon indicating copy to clipboard operation
langium copied to clipboard

Various code actions about types

Open pluralia opened this issue 2 years ago • 3 comments

Write some code actions as quick fixes for validations from #426:

  • [ ] type names duplication -> removes a duplicated type
  • [x] validation of property name duplication (#430) -> removes a duplicated property (dupes are flagged as an error, but no action to remove)

More code actions:

  • [ ] adds a declared type by inferred type name
  • [ ] replaces a dummy rule with a declared type
  • [x] adds return T to rule for general error The type 'T' is already explicitly declared and cannot be inferred. From #449.

pluralia avatar Mar 11 '22 08:03 pluralia

Added a third case to more code actions above.

montymxb avatar May 27 '22 09:05 montymxb

I can take this one :octocat:

montymxb avatar May 30 '22 08:05 montymxb

This one has been around for awhile. I would vote to close this out and create separate issues instead:

  • generate declared type for rule (from inferred type)
  • identify & recommend replacing a dummy rule with a declared type
  • code action to remove unused/duplicated declared type (first of non-unique list)
  • code action to remove unused/duplicated property (first of non-unique list)

The last two are akin to how TS support handles duplicate declarations, offering to remove the leading one of any number.

montymxb avatar Mar 09 '23 15:03 montymxb