project-chip / zap

ZAP stands for ZCL Advanced Platform. It is used to configure clusters, attributes and other entities for Matter and ZigbeePro applications.
Apache License 2.0
133 stars 82 forks source link

Add new feature (show diff / find text) in generation preview #276

Open tecimovic opened 2 years ago

tecimovic commented 2 years ago

Generation preview currently shows the files that are generate. Which is SOMEWHAT useful, but not FULLY useful.

What would be fully useful, would be to show the DIFF between the files that you will generate and the files as they are now on the hard-drive. As you use zap, the valuable thing is not so much exactly what you generate, but the differences that arise in generated files as you modify the UI.

That existed in old Silicon Labs appbuilder flow, and it was useful. In zap, we lost the diff.

tecimovic commented 2 years ago

Could we use this?

https://github.com/rtfpessoa/diff2html

jingteng25742 commented 2 years ago

Updating ticket to include multiple features from the past. Find text - ability to search through generated content within Preview window Show diff - show colored / formatted diff between previous and current generation result

@tecimovic We should use git to generate the diff but it's unclear how the presence of git binary can be guaranteed since "git" binary doesn't seem to exist in nodejs world. diff2html seem to be a beautifier for git diff outputs.

jingteng25742 commented 2 years ago

https://www.npmjs.com/package/git-diff seems like a good alternative for diffing via git and leveraging existing diff module if git is not installed