-
Notifications
You must be signed in to change notification settings - Fork 23
Render documentation and relationships in the snapshot tests #97
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
Conversation
|
||
const lsiftyped = lsif.lib.codeintel.lsiftyped | ||
|
||
export function formatSnapshot( |
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 took the liberty to extract this functionality into a separate file so that it's easier to reuse between projects.
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 it's fine to copy-paste this logic for now while the format is still evolving. The actual formatting logic is fairly simple to port between languages
@@ -141,16 +141,17 @@ export class FileIndexer { | |||
sym: ts.Symbol, | |||
symbol: LsifSymbol | |||
): void { | |||
const documentation = [ |
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.
The diff in the snapshots was difficult to understand with this bugfix so I included it in the PR
// documentation ```ts\nProps\n``` | ||
// documentation Takes loading prop, input component as child |
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.
Is repeating the documentation
on multiple lines intentional? TJ's PR uses a separate character from the second line.
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.
const isDefinition = | ||
(occurrence.symbol_roles & lsiftyped.SymbolRole.Definition) > 0 |
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.
Maybe !!
or !== 0
would be more idiomatic here rather than > 0
?
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 not sure what's most idiomatic, this is how I would have written it in Java :/
Previously, the snapshot tests only displayed occurrence roles and symbols. Now, the additionally display the
SymbolInformation.{documentation,relationships}
fields for definition occurrences.Test plan
See updated snapshot tests.