-
Notifications
You must be signed in to change notification settings - Fork 28
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
Add and populate new SCIP SymbolInformation fields #677
Add and populate new SCIP SymbolInformation fields #677
Conversation
This copies the latest additions to the Document message: * a new language field and Language enum * a new text field, to embed the document content itself. This is meant for the new SymbolInformation::signature_documentation field. This also updates some documentation comments.
This copies the latest additions to the SymbolInformation message: * the documentation field is explicitly not meant for signature documentation anymore, instead a new signature_documentation field is added * a new display_name field is added * a new enclosing_symbol field is added for local symbols * a new kind field is added along with a Kind enum to have a finer-grained classification than the one provided by descriptor suffixes (and is especially useful for local symbols which don't have suffixes)
The SemanticDB schema already provides a display_name field, forward it to the SCIP output in scip-semanticdb. This also adds support to the ScipPrinters testing utility and updates the tests accordingly.
SemanticDB provides a structured version of the signature in the signature field. Instead of turning it into a markdown-encoded string for the documentation field, this builds a Document for the signature_documentation field. This also updates the ScipPrinters testing utility and the tests accordingly.
SemanticDB used to have a SymbolInformation::owner field with id 15. This re-introduces the field with the same semantics under the name enclosing_symbol. To be able to re-use the field 15, this moves the out-of-spec definition_relationships field to id 21.
This also adds support to the ScipPrinters testing utility.
This only populates the enclosing_symbol for local symbols, and updates the tests accordingly.
This also updates the ScipPrinters testing utility and the tests accordingly.
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.
Pointing to some things that I believe should be fixed upstream.
// ^^^ definition semanticdb maven maven/com.lihaoyi/ujson_2.13 1.4.0 ujson/BaseByteRenderer#out. | ||
// documentation ```scala\nprivate[this] val out: T\n``` | ||
// display_name out | ||
// signature_documentation scala private[this] val out: T | ||
// kind Method |
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.
This for instance should be a Field rather than a Method, but I believe this is due to a bug in semanticdb-scalac rather than scip-semanticdb.
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'm just going to confer with the council of Semanticdb experts to see if this is intentional due to Scalac class encoding, or accidental.
@@ -39,8 +39,10 @@ import java.util.ArrayList | |||
|
|||
internal class ActivityRecyclerPool { | |||
// ^^^^^^^^^^^^^^^^^^^^ definition semanticdb maven . . com/airbnb/epoxy/ActivityRecyclerPool# | |||
// display_name ActivityRecyclerPool | |||
// documentation ```kt\ninternal final class ActivityRecyclerPool\n``` |
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 kt files the signature documentation remains in documentation
for now because semanticdb-kotlinc does not provide the structured signature field and adds the signature to the SematicDB documentation
field already.
@nicolas-guichard thanks for the PR! I looked at some of the snapshots and the changes look great. Before I review the implementation, could you please sync this PR with main? I don't see anything controversial in the PR so far so hopefully we can get this merged and release soon. Alternatively, I can take over the PR and sync it myself. Let me know. In the background I will investigate the semanticdb scalac issue you highlighted - but it won't block this PR as I can reproduce it outside of scip-java. |
Thanks for the PR! I moved the commits on top of master in separate PR #707 along with a couple of fixes. We will likely need to wait before releasing this, until Sourcegraph product itself can support signature_documentation (given it's removed from |
…play_name (#677 #707) * Update Document from upstream scip.proto This copies the latest additions to the Document message: * a new language field and Language enum * a new text field, to embed the document content itself. This is meant for the new SymbolInformation::signature_documentation field. This also updates some documentation comments. * Update SymbolInformation from upstream scip.proto This copies the latest additions to the SymbolInformation message: * the documentation field is explicitly not meant for signature documentation anymore, instead a new signature_documentation field is added * a new display_name field is added * a new enclosing_symbol field is added for local symbols * a new kind field is added along with a Kind enum to have a finer-grained classification than the one provided by descriptor suffixes (and is especially useful for local symbols which don't have suffixes) * Forward display_name from SemanticDB to SCIP The SemanticDB schema already provides a display_name field, forward it to the SCIP output in scip-semanticdb. This also adds support to the ScipPrinters testing utility and updates the tests accordingly. * Move signature documentation to its new dedicated field SemanticDB provides a structured version of the signature in the signature field. Instead of turning it into a markdown-encoded string for the documentation field, this builds a Document for the signature_documentation field. This also updates the ScipPrinters testing utility and the tests accordingly. * Add back SemanticDB SymbolInformation::owner field SemanticDB used to have a SymbolInformation::owner field with id 15. This re-introduces the field with the same semantics under the name enclosing_symbol. To be able to re-use the field 15, this moves the out-of-spec definition_relationships field to id 21. * Forward enclosing_symbol from SemanticDB to SCIP This also adds support to the ScipPrinters testing utility. * Populate SymbolInformation::enclosing_symbol in semanticdb-javac This only populates the enclosing_symbol for local symbols, and updates the tests accordingly. * Build SCIP kind from SematicDB kind and properties This also updates the ScipPrinters testing utility and the tests accordingly. * semanticdb-javac: set kind to Variable for local variables --------- Co-authored-by: Nicolas Guichard <nicolas.guichard@kdab.com>
Fixes #666
Note that the result can only be as good as what the SemanticDB data provides, notably:
kind
andproperties
fields inSymbolInformation
scip-kotlin#66Test plan
This adds the new fields to the snapshot tests and makes sure they pass.
I have obviously not manually reviewed all 13054 insertions and 3893 deletions to tests/snapshots, but what I think is a reasonable subset.