Hey all,

would like to ping this topic up again, due to I think that some People already 
knows the differences and can help here to help me, to contribute more to 
NetBeans 😉. Otherwise please point me to the right person who can help here.


Cheers

Chris



Von: Christian Lenz
Gesendet: Freitag, 6. September 2019 14:46
An: [email protected]
Betreff: Creating code hints, fixes, suggestions, rules, etc.

Dear all,

due to missing hints + fixes which makes the live easier for developers, in 
editors which are not Java, I want to implement some HTML/CSS/SCSS/JS hints.

I looked into the netbeans code and there are Hint classes, Rule classes and I 
think HintRule and Fix and Suggestion classes and I don't know how to start and 
what the differences are between them.
I read this tutorial: 
https://platform.netbeans.org/tutorials/nbm-java-hint.html but it seems that 
hints/fixes for Java are bit different, there is a JavaFix class and we use 
some annotations. So to tell you my story, I want to create hints + fixes into 
the editor of HTML, CSS/SCSS/LESS and JS. I looked into the code of existing 
CSS/HTML hints but they are not consistent, they are using HintRule classes and 
sometimes other classes. So to start I need to know what is a Hint, what is a 
Rule, what is a Fix, what is a Suggestion, etc. So a clean tutorial about the 
differences of them and how which class is the best to extend the functionality.

Some more cases:
- sometimes hints w/o fixes doesn’t make sense.
- sometimes I want to have hints that are shown, when I open the file and 
sometimes only at a specific context when my cursor is there to not overload 
the whole file with hints/suggestions, etc.

Concrete examples for JS:
- convert anonymous function into arrow function (hint + fix)
- change var to let or const (2 fixes, one hint)
- convert require to Import (hint + fix)
- convert strings to ES6 string literals (hint + fix)
- change order of Imports alphabetically or in an other order (hint + fix)
- etc.

Concrete examples for scss (some of them are relevant for CSS too, but not all):
- convert from px to em and vice versa (hint + fix where the Cursor is)
- convert selected value into a variable (hint + fix, when value is selected)
- convert block into a mixin (hint + fix, when properties, code block and 
values are selected)

Concrete examples for (X)HTML:
- add missing width+height attributes of an img tag (hint + fix, maybe on the 
same line, when I select the image tag, maybe not)
- add missing alt attribute of an img tag (hint + fix, Maybe on the same line, 
when I select the image tag, Maybe not)
- etc.

I don’t want to discuss wheter all of them are useful or not, in my case they 
are and also very handy. So I only need help here to understand the logic to 
create those missing features and a lot more.


Cheers

Chris

Reply via email to