-
Notifications
You must be signed in to change notification settings - Fork 39
Add signature pretty-printer to lsif-semanticdb conversion process #131
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
Changes from all commits
9b8cbe0
54402af
23322e7
2dbe8af
d7c07a7
b4f1182
7ebdfe5
2135c05
f170c72
b284432
4fc0ce9
2a08071
580aabd
d82dd45
8bb41e6
87068e0
a285b29
2c6a47d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -76,6 +76,8 @@ private Stream<Integer> processPath(Path path, Set<String> isExportedSymbol) { | |
| } | ||
|
|
||
| private Integer processDocument(LsifTextDocument doc, Set<String> isExportedSymbol) { | ||
| Symtab symtab = new Symtab(doc.semanticdb); | ||
|
|
||
| int documentId = writer.emitDocument(doc); | ||
| Set<String> localDefinitions = | ||
| doc.semanticdb.getOccurrencesList().stream() | ||
|
|
@@ -112,9 +114,21 @@ private Integer processDocument(LsifTextDocument doc, Set<String> isExportedSymb | |
| } | ||
|
|
||
| // Hover | ||
| ArrayList<MarkedString> markedStrings = new ArrayList<>(); | ||
| String documentation = symbolInformation.getDocumentation().getMessage(); | ||
| if (!documentation.isEmpty()) { | ||
| int hoverId = writer.emitHoverResult(doc.semanticdb.getLanguage(), documentation); | ||
| markedStrings.add(new MarkedString(Semanticdb.Language.UNKNOWN_LANGUAGE, documentation)); | ||
|
Contributor
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. Why do we use unknown language here?
Contributor
Author
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. Im a bit unsure about how to approach this one.
Contributor
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. What do you think about adding a new
Contributor
Author
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. That sounds good for a follow-up PR after discussing in our 1:1 👍 |
||
| } | ||
|
|
||
| if (symbolInformation.hasSignature()) { | ||
| markedStrings.add( | ||
| new MarkedString( | ||
| doc.semanticdb.getLanguage(), | ||
| new SignatureFormatter(symbolInformation, symtab).formatSymbol())); | ||
| } | ||
|
|
||
| if (!markedStrings.isEmpty()) { | ||
| int hoverId = writer.emitHoverResult(markedStrings.toArray(new MarkedString[0])); | ||
| writer.emitHoverEdge(ids.resultSet, hoverId); | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| package com.sourcegraph.lsif_semanticdb; | ||
|
|
||
| import com.sourcegraph.semanticdb_javac.Semanticdb; | ||
|
|
||
| public class MarkedString { | ||
| public final String value; | ||
| public final Semanticdb.Language language; | ||
|
|
||
| public MarkedString(Semanticdb.Language language, String value) { | ||
| this.value = value; | ||
| this.language = language; | ||
| } | ||
| } |
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.
Can we use
Documentationinstead?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.
we (currently) dont emit Documentation in the snapshots, only the Signature with DisplayName as fallback.
This should probably still not use Documentation even if we did, if we decide to go ahead with the original "musing" of formatting documentation in a fashion similar to
Lorem ipsum ... facilisis, in convallis ex imperdiet., truncating for brevityThere 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 see, the
android.view.Viewclass is indeed missing from the classpath that we're using in the snapshotsThe class is defined in
android.jarfrom the SDKThere 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.
Its weird because many other android types do resolve. 🤷