This repository has been archived by the owner on Jul 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 646
Use gogetdoc instead of godef and godoc #622
Merged
Merged
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
b959666
use gogetdoc, remove godef
leaxoy 5946333
test cases
leaxoy b67a551
use `import` for gogetdoc return value
leaxoy 58cc5de
vendor test case
leaxoy 9f9db0f
use debug, not console.log
leaxoy c5268dc
Merge branch 'master' of https://github.com/Microsoft/vscode-go
leaxoy 0020119
Support both godef and gogetdoc
ramya-rao-a aa102a8
Adding tests for definition provider
ramya-rao-a d0c6671
fix tests
ramya-rao-a 73dbfc4
Fix signature for methods extending structs
ramya-rao-a 8fb8dbc
Update Readme and install logic
ramya-rao-a File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,28 +53,38 @@ encountered. | |
`; | ||
let testCases: [vscode.Position, string, string][] = [ | ||
// [new vscode.Position(3,3), '/usr/local/go/src/fmt'], | ||
[new vscode.Position(9, 6), 'func main()', null], | ||
[new vscode.Position(7, 2), 'package fmt', null], | ||
[new vscode.Position(7, 6), 'func Println(a ...interface{}) (n int, err error)', printlnDoc], | ||
[new vscode.Position(10, 3), 'func print(txt string)', null] | ||
[new vscode.Position(9, 6), 'main func()', null], | ||
[new vscode.Position(7, 2), 'import (fmt "fmt")', null], | ||
[new vscode.Position(7, 6), 'Println func(a ...interface{}) (n int, err error)', printlnDoc], | ||
[new vscode.Position(10, 3), 'print func(txt string)', null] | ||
]; | ||
let uri = vscode.Uri.file(path.join(fixturePath, 'test.go')); | ||
vscode.workspace.openTextDocument(uri).then((textDocument) => { | ||
let promises = testCases.map(([position, expectedSignature, expectedDocumentation]) => | ||
provider.provideHover(textDocument, position, null).then(res => { | ||
// TODO: Documentation appears to currently be broken on Go 1.7, so disabling these tests for now | ||
// if (expectedDocumentation === null) { | ||
// assert.equal(res.contents.length, 1); | ||
// } else { | ||
// assert.equal(res.contents.length, 2); | ||
// assert.equal(expectedDocumentation, <string>(res.contents[0])); | ||
// } | ||
assert.equal(expectedSignature, (<{ language: string; value: string }>res.contents[0]).value); | ||
}) | ||
); | ||
return Promise.all(promises); | ||
}, (err) => { | ||
assert.ok(false, `error in OpenTextDocument ${err}`); | ||
|
||
getGoVersion().then(version => { | ||
if (version.major > 1 || (version.major === 1 && version.minor > 5)) { | ||
testCases[0][1] = 'func main()'; | ||
testCases[1][1] = 'package fmt'; | ||
testCases[2][1] = 'func Println(a ...interface{}) (n int, err error)'; | ||
testCases[3][1] = 'func print(txt string)'; | ||
} | ||
return vscode.workspace.openTextDocument(uri).then((textDocument) => { | ||
let promises = testCases.map(([position, expectedSignature, expectedDocumentation]) => | ||
provider.provideHover(textDocument, position, null).then(res => { | ||
// TODO: Documentation appears to currently be broken on Go 1.7, so disabling these tests for now | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we give reenabling these tests a shot? When this was commented, they worked on my machine There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @abarisain Done! |
||
// if (expectedDocumentation === null) { | ||
// assert.equal(res.contents.length, 1); | ||
// } else { | ||
// assert.equal(res.contents.length, 2); | ||
// assert.equal(expectedDocumentation, <string>(res.contents[0])); | ||
// } | ||
assert.equal(expectedSignature, (<{ language: string; value: string }>res.contents[0]).value); | ||
}) | ||
); | ||
return Promise.all(promises); | ||
}, (err) => { | ||
assert.ok(false, `error in OpenTextDocument ${err}`); | ||
return Promise.reject(err); | ||
}); | ||
}).then(() => done(), done); | ||
}); | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Does that work for methods that have a signature like
func (l *Struct) Add(a int, b int) {
? I did it somewhat differently for that reason https://github.com/abarisain/vscode-go/blob/gogetdoc2/src/goSignature.ts#L33-L40If it does, then sorry! Haven't had the time to test this branch yet.
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.
In such case it thinks the receiver is the first param, thats a bug.
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.
Fixed it, Took your code and tested. Will push the changes soon.
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.
@abarisain The changes are in