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

Add support for guru as a docs tool #949

Merged
merged 8 commits into from
Jun 27, 2017
Merged

Add support for guru as a docs tool #949

merged 8 commits into from
Jun 27, 2017

Conversation

stamblerre
Copy link
Contributor

Support guru as a tool that can be used for jumping to definitions.

@msftclas
Copy link

@stamblerre,
Thanks for your contribution.
To ensure that the project team has proper rights to use your work, please complete the Contribution License Agreement at https://cla.microsoft.com.

It will cover your contributions to all Microsoft-managed open source projects.
Thanks,
Microsoft Pull Request Bot

}
});
let documentText = document.getText();
let documentArchive = document.fileName + '\n';
Copy link
Contributor

Choose a reason for hiding this comment

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

you can use getFileArchive() from util.ts to do this

@@ -39,8 +39,10 @@ export function definitionLocation(document: vscode.TextDocument, position: vsco
// Assume it's > Go 1.5
if (toolForDocs === 'godoc' || (ver && (ver.major < 1 || (ver.major === 1 && ver.minor < 6)))) {
return definitionLocation_godef(document, position, offset, includeDocs);
} else if (toolForDocs == 'guru') {
Copy link
Contributor

Choose a reason for hiding this comment

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

There are linting errors that is breaking the build.

  • == should be === in line 42
  • There is a trailing space in line 45

@@ -43,7 +43,7 @@ export class GoSignatureHelpProvider implements SignatureHelpProvider {
let funcName = declarationText.substring(0, nameEnd);
sig = declarationText.substring(sigStart);
si = new SignatureInformation(funcName + sig, res.doc);
} else {
} else if (res.toolUsed === 'gogetdoc') {
Copy link
Contributor

Choose a reason for hiding this comment

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

Both Signature Help and Hover Info features are currently broken.
Until guru has the feature to provide docs, you can call godoc to provide the docs.

Pull https://github.com/Microsoft/vscode-go/blob/1302fcf0f704f66c974e043258b7ed9783ba104b/src/goDeclaration.ts#L85-L105 out into a function and use it in both definitionLocation_godef and definitionLocation_guru

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Latest changes should fix this - if guru is set as the docsTool, I just passed in a config object with "godoc" set as the docsTool for provideHover and provideSignatureHelp.

@stamblerre stamblerre closed this Jun 16, 2017
@stamblerre stamblerre reopened this Jun 16, 2017
@msftclas
Copy link

@stamblerre,
Thanks for having already signed the Contribution License Agreement. Your agreement was validated by Microsoft. We will now review your pull request.
Thanks,
Microsoft Pull Request Bot

@ramya-rao-a
Copy link
Contributor

ramya-rao-a commented Nov 5, 2018

Hey @stamblerre

When using guru, the docs are never set on the output. See https://github.com/Microsoft/vscode-go/blob/0.6.93/src/goDeclaration.ts#L224. Therefore, for the hover feature, we fallback to using the combination of godef and godoc. Doesn't that bring about inconsistencies for you?

@stamblerre
Copy link
Contributor Author

@ramya-rao-a: I haven't noticed any bugs being filed about it. I think the reason for null docs is because guru doesn't provide any docs for definitions, just the position information.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants