New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Thrift code intelligence #669
Comments
Closing in favor of #981 |
Re-opening this as a Thrift focused child issue of #981. I'll add the design doc to the issue description and we can then discuss the proposal in the issue comments. |
I have updated this issue's description with a first proposal for basic Thrift code intelligence. Before discussing implementation, I would like to gather as much feedback from potential users as possible on the proposed UX and user flow. |
Will it be possible to jump to definition and jump back to all references as in:
P.S. I'm super excited about this feature! |
Hi @aisbaa,
Since you could have multiple identical
That would be just the same user flow as clicking
Glad to hear! If you find some time, it'd be great to know in more detail how this feature would help you in your daily job. Detailed user feedback makes for better products! |
In deed 1-1 mapping sounds tricky - |
Closing this issue as we are consolidating discussion in #981 |
Proposal
(By @tsenart)
This proposal describes a Sourcegraph extension that provides basic code intelligence for projects using the Thrift Interface Description Language (IDL) that check-in the code-generated servers and clients.
The Thrift project has extensive language bindings with which language specific client and server code is generated using the
thrift
CLI tool.Every supported language has its code generated in a deterministic way by the
thrift
tool which allows us to find the generated code with a high degree of confidence using hierarchical search. Since namespaces and the resulting output package names and directories are configurable by Thrift users, the only heuristic we can rely on to find generated code files is to look for this always-present comment line in those files:Autogenerated by Thrift Compiler
.While this first search term filters results to Thrift generated files, we need another term to look for the specific symbol the user has searched for. Because Thrift's code generation is deterministic, we can use its pre-determined naming rules for each supported language bindings to find the correspondent definitions and their position. As it turns out, this is easy, because Thrift maintains the inflection of the defined names in the generated code.
As an example, this Thrift service has the following code generated in Go and Java:
Thrift
Go
Java
Other languages also yield precise search results with identical name inflection as the source
.thrift
file names.Implementation
As a first milestone, it would be sufficiently useful to have a
Find generated code
button in the hover panel over a symbol in a.thrift
file. As an example, if a user wouldFind generated code
for the aboveAddService
, we'd perform the following cross-repo hierarchical search:In the search results page, matches would be ideally ordered with the following priority:
After clicking on a file match of a language that has an enabled extension, users can use that extension's functionality to find cross-repo external references, go to definitions and look-up documentation.
Constraints
In summary, this proposal works under the given constraints:
thrift
CLI tool must be checked-in to the source control management system.The text was updated successfully, but these errors were encountered: