Skip to content
This repository has been archived by the owner on Mar 4, 2021. It is now read-only.

Symbols using textDocument/documentSymbols only #6

Closed
wants to merge 12 commits into from
Closed

Conversation

beyang
Copy link
Member

@beyang beyang commented Jan 29, 2021

Subsumes #4. The main difference is that this PR no longer introduces a workspace/symbol vertex and special symbol type that are outside the LSIF spec. It keeps the exported/unexported tags that do extend the LSIF spec.

writer/emitter.go Outdated Show resolved Hide resolved
Copy link
Contributor

@efritz efritz left a comment

Choose a reason for hiding this comment

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

A few questions inline.

writer/emitter.go Outdated Show resolved Hide resolved
range.go Show resolved Hide resolved
Start _position `json:"start"`
End _position `json:"end"`
}
var payload Range
Copy link
Contributor

Choose a reason for hiding this comment

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

This may have been previously split for a performance optimization. I'll run this after a round of feedback to see if it still makes a big difference in reading.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah got it, happy to switch back. Is there a benchmark we could add that tracks this?

Copy link
Contributor

Choose a reason for hiding this comment

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

I can add one.

Copy link
Member Author

Choose a reason for hiding this comment

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

I went ahead and inlined the unmarshalling types in this function to try to save you some trouble. However, I wasn't sure how much of the performance benefit was due to inlining the types vs. not importing anything. For instance, I used an inline field type of Tags []protocol.SymbolTag instead of Tags []int, because the latter would have required creating a new slice and copying over the integer vales one by one. PTAL to see if this satisfies the concern.

I also added a test for unmarshalling a range with a tag (necessary now to test the conversion from inlined type value to exported type value).

symbol.go Outdated
}
}

type SymbolData struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we get comments on each of these fields? Looks like these are still non-standard.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm also unsure what in the spec this corresponds to.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added a docstring. It's not an extension, it's just the symbol-related embedded fields of the RangeTag struct, which corresponds to the DeclarationTag described in the spec: https://microsoft.github.io/language-server-protocol/specifications/lsif/0.5.0/specification/#documentSymbol

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like the Tags field is missing from the spec, though? Is that part a non-standard extension?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I just updated the docstring to mention https://github.com/microsoft/language-server-protocol/issues/1209, which proposes adding SymbolTag[] as a field, so that it mirrors the information present in lsp.DocumentSymbol.

symbol.go Show resolved Hide resolved
@beyang beyang requested a review from efritz February 22, 2021 16:50
@beyang
Copy link
Member Author

beyang commented Feb 25, 2021

@efritz is there any other feedback I should address?

@shrouxm
Copy link
Contributor

shrouxm commented Mar 3, 2021

closing as these changes were merged in sourcegraph/sourcegraph#18655

@shrouxm shrouxm closed this Mar 3, 2021
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.

None yet

3 participants