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 645
Extra info now checks doc #424
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,19 +32,29 @@ suite('Go Extension Tests', () => { | |
|
||
test('Test Hover Provider', (done) => { | ||
let provider = new GoHoverProvider(); | ||
let testCases: [vscode.Position, string][] = [ | ||
let printlnDoc = `Println formats using the default formats for its operands and writes to | ||
standard output. Spaces are always added between operands and a newline | ||
is appended. It returns the number of bytes written and any write error | ||
encountered. | ||
` | ||
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. Not sure I really like how templates strings break indentation, but it does not destroy the file's column count that way |
||
let testCases: [vscode.Position, string, string][] = [ | ||
// [new vscode.Position(3,3), '/usr/local/go/src/fmt'], | ||
[new vscode.Position(9, 6), 'main func()'], | ||
[new vscode.Position(7, 2), 'import (fmt "fmt")'], | ||
[new vscode.Position(7, 6), 'Println func(a ...interface{}) (n int, err error)'], | ||
[new vscode.Position(10, 3), 'print func(txt string)'] | ||
[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, expected]) => | ||
let promises = testCases.map(([position, expectedSignature, expectedDocumentation]) => | ||
provider.provideHover(textDocument, position, null).then(res => { | ||
assert.equal(res.contents.length, 1); | ||
assert.equal(expected, (<{ language: string; value: string }>res.contents[0]).value); | ||
if (expectedDocumentation == null) { | ||
assert.equal(res.contents.length, 1); | ||
} else { | ||
assert.equal(res.contents.length, 2); | ||
assert.equal(expectedDocumentation, (<{ language: string; value: string }>res.contents[0]).value); | ||
} | ||
assert.equal(expectedSignature, (<{ language: string; value: string }>res.contents[res.contents.length-1]).value); | ||
}) | ||
); | ||
return Promise.all(promises); | ||
|
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.
I think that passing this as a string will format in a slightly different way which matches what other extensions do: https://github.com/Microsoft/vscode/search?utf8=%E2%9C%93&q=%22new+Hover%22
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.
Sorry about that, didn't notice that there was a simple string constructor for this