Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Don`t process function signatures on comment lines #2496

Merged
merged 7 commits into from
May 7, 2019
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/goSignature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ export class GoSignatureHelpProvider implements SignatureHelpProvider {
for (let lineNr = position.line; lineNr >= 0 && maxLookupLines >= 0; lineNr-- , maxLookupLines--) {

const line = document.lineAt(lineNr);

// Stop processing if the line is a comment
if (line.text.trim().indexOf('//') === 0) {
return null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will only catch the case where the entire line starts with the comment.
What about the below case?

x, err := regexp.Match("abc", data) // I have some comment here,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is the most basic case of course. Either way, I'm noticing the bug isn't completely dependent on comments presence so there is still something else in it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decided to reuse the same function made for suggestions logic on this one

}

// if its current line, get the text until the position given, otherwise get the full line.
const [currentLine, characterPosition] = lineNr === position.line
? [line.text.substring(0, position.character), position.character]
Expand Down