IntelliJ-EmmyLua icon indicating copy to clipboard operation
IntelliJ-EmmyLua copied to clipboard

LDoc is incorrectly parsed

Open necauqua opened this issue 5 years ago • 9 comments

Environment

name version
IDEA version 2019.2.2
EmmyLua version 1.3.0.99-IDEA182
OS Arch Linux

If we are speaking about the same LDoc, then current implementation in this plugin is wrong. It marks comments as docs only if all lines are started with --- although only the first one should start with that.

This is ok:

image

However this does not work, although it should (in LDoc manual scroll to nearest multiline example):

image

ctrl+q also shows no documentation for the latter case. A big example would be awesome wm.

Also, when you press Backspace after --- it removes all three characters. I guess this is intentional, but please at least add a config option to disable that

necauqua avatar Oct 19 '19 15:10 necauqua

Sorry, emmylua does not support LDoc。It's emmy-style doc(EmmyDoc), all lines must start with ---, the comment like @xxx is called annotation. All annotations are listed here.

tangzx avatar Oct 20 '19 01:10 tangzx

Aha, understood But LDoc is still widely used and if you use a well-documented library that uses LDoc then you cant see all that documentation. I mean that even partially supporting LDoc should be easy, just allow --- only to be the first line of the doc comment, LDoc also has annotations and most of them work the same way afaiu.

necauqua avatar Oct 20 '19 10:10 necauqua

(Related: https://github.com/EmmyLua/IntelliJ-EmmyLua/issues/75 and https://github.com/EmmyLua/IntelliJ-EmmyLua/issues/222)

adriweb avatar Oct 20 '19 10:10 adriweb

I would like to add my vote for LDoc support. LDoc can automatically generate full-fledged documentation from the comments and is widely used.

modo-lv avatar Jan 21 '21 23:01 modo-lv

Another 👍 from me. I found out about EmmyLua in IntelliJ and VS Code and I really, really like it. I would like also to be able to build some documentation using ldoc but with annotations being incompatible I'm stuck with choice between getting code completion or getting docs, sadly I have to choose none.

I'm not heavy Lua user and I don't know anything about IntelliJ details, however I would like to offer my help for example (I guess only testing and providing sample files are the only thing I'm capable for doing for now).

Novakov avatar Jun 29 '21 20:06 Novakov

I agree that standard LDoc support would be a valuable improvement, especially because existing linters and documentation renderers all expect LDoc.

redcatbear avatar Mar 23 '22 06:03 redcatbear

Did a little bit of code digging together with @kaklakariada to see if we could contribute to get a little bit more LDoc compatibility. The idea was to support LDocs tparam and treturn as synonyms in the parser, because they have the same syntax as EmmyDoc's param and return variant mostly.

We found a generated parser in Java and a BNF definition that looks like the origin of that generated code. What we didn't find is the build step that generates the Java code. The result code is checked into the repo, so we are guessing that there is an additional build step that has not been added to the Gradle build scripts. Or we are overlooking it maybe.

Can any of the original authors give us a hint?

redcatbear avatar Apr 12 '22 12:04 redcatbear

@tangzx, could you give us a hint please, where we can see the part of the build that turns the provided BNF into the generated Java?

redcatbear avatar Apr 19 '22 10:04 redcatbear

install idea grammar kit, and right click and select generate parse code. but emmylua perhaps won't choose compatible with LDoc. the emmylua doc has been accepted by many, If you are really interested in this, you can choose to fork this project and publish an independent plugin

CppCXY avatar Apr 19 '22 11:04 CppCXY