-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: allow using raw docstring for type docs #28
Conversation
config/config.go
Outdated
@@ -33,6 +33,7 @@ type ProcessorConfig struct { | |||
IgnoreTypes []string `json:"ignoreTypes"` | |||
IgnoreFields []string `json:"ignoreFields"` | |||
IgnoreGroupVersions []string `json:"ignoreGroupVersions"` | |||
TypeDocstringRaw bool `json:"typeDocstringRaw"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Naming: maybe this is more explicit?
TypeDocstringRaw bool `json:"typeDocstringRaw"` | |
UseRawDocstring bool `json:"useRawDocstring"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated 👍
processor/processor.go
Outdated
@@ -265,6 +265,10 @@ func (p *processor) processType(pkg *loader.Package, info *markers.TypeInfo, dep | |||
Doc: info.Doc, | |||
} | |||
|
|||
if p.typeDocstringRaw && info.RawDecl != nil { | |||
typeDef.Doc = info.RawDecl.Doc.Text() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a comment?
Also, I see a new line added at the end, should we remove it?
typeDef.Doc = info.RawDecl.Doc.Text() | |
// use raw comments doc to support multi-line and indent preservation | |
typeDef.Doc = strings.TrimSuffix(info.RawDecl.Doc.Text(), "\n") // remove trailing newline |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
commend add and newline trimmed 👍
7b7e9c0
to
c81a784
Compare
c81a784
to
3011fd5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@thbkrkr it would be great to have this released :) |
closes #27