We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c7068a4 commit f2ab229Copy full SHA for f2ab229
private/buf/buflsp/symbol.go
@@ -357,9 +357,17 @@ func (s *symbol) getDocsFromComments() string {
357
case token.Comment:
358
comments = append(comments, commentToMarkdown(t.Text()))
359
}
360
- if !cursor.PeekPrevSkippable().Kind().IsSkippable() {
+ prev := cursor.PeekPrevSkippable()
361
+ if !prev.Kind().IsSkippable() {
362
break
363
364
+ if prev.Kind() == token.Space {
365
+ // Check if the whitespace contains a newline. If so, then we break. This is to prevent
366
+ // picking up comments that are not contiguous to the declaration.
367
+ if strings.Contains(prev.Text(), "\n") {
368
+ break
369
+ }
370
371
t = cursor.PrevSkippable()
372
373
// Reverse the list and return joined.
0 commit comments