Skip to content

Update uast-viewer and bblfsh/client-go to work with gitbase 0.18 #279

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

Merged
merged 5 commits into from
Nov 9, 2018

Conversation

carlosms
Copy link
Contributor

@carlosms carlosms commented Nov 5, 2018

Part of #248.

This PR is against a new branch instead of master because gitbase 0.18 is still in beta, and I'd like to keep master ready to be released at any time; in case we find bugs or minor improvements to do before the gitbase 0.18 final release. We can then merge the new branch to master.

Things that are missing but can be done cleanly in separate PRs:

  • Docs for the API changes
  • Docker build changes (I think the client-go.v3 makes some packages to build stuff not needed anymore)
  • The UAST mode selector

@carlosms carlosms changed the title Update uast-viewer and bblfsh/client-go to work with gitbase 0.18 [WIP] Update uast-viewer and bblfsh/client-go to work with gitbase 0.18 Nov 5, 2018
@carlosms carlosms changed the title [WIP] Update uast-viewer and bblfsh/client-go to work with gitbase 0.18 Update uast-viewer and bblfsh/client-go to work with gitbase 0.18 Nov 5, 2018
Gopkg.toml Outdated
@@ -7,7 +7,7 @@
non-go = true

[[prune.project]]
Copy link
Contributor

Choose a reason for hiding this comment

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

client-go is pure go project now. We can remove it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 done in 8f25ae5

Gopkg.toml Outdated
@@ -39,12 +39,16 @@
version = "1.2.2"

[[constraint]]
name = "gopkg.in/bblfsh/client-go.v3"
version = "3.0.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

3.1.0

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I forgot to mention I set this to the exact same version as gitbase, to have the same results from the queries and from the parsing we do in our side.
https://github.com/src-d/gitbase/blob/v0.18.0-beta.1/Gopkg.toml#L57

Copy link
Contributor

Choose a reason for hiding this comment

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

But your lock file uses 3.1.0:
540b3ec#diff-bd247e83efc3c45ae9e8c47233249f18R316

v3.0.0 doesn't have SyntaxErr.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's right, I had to update to 3.1.0 for the error. It got updated in the lock file but not in this one. Done in 8f25ae5

if resp.UAST != nil && req.Filter != "" {
filtered, err := tools.Filter(resp.UAST, req.Filter)
if req.Filter != "" {
results, err := applyXpath(resp, req.Filter)
Copy link
Contributor

Choose a reason for hiding this comment

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

resp, err := applyXpath(resp, req.Filter)

no need for new variable results

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done in 9bd3a90

}

resp.Children = append(resp.Children, filtered...)
results, err := applyXpath(reqNodes, req.Filter)
Copy link
Contributor

Choose a reason for hiding this comment

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

same, no need for results

})
.catch(err => this.setState({ uast: null, error: err }))
.then(() => this.setState({ loading: false }));
}

// Applies the uast-viewer object shape transformer, and expands all nodes
Copy link
Contributor

Choose a reason for hiding this comment

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

before it was expanding only first 2 levels.
The problem with expanding everything - uast is huge. For a big file, it will hang a browser.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see. Previously the default uast-viewer render matched when we used withUASTEditor in CodeViewer.js (the CODE modal), and uast-viewer directly in UASTViewer.js > UASTViewerPane.js` (the UAST modal).

Now the uast viewer without the editor is different, and shows all the UAST nodes collapsed. Should we try to mimic the expanded levels here, or do you think it makes sense to handle this in the uast-viewer project?

Copy link
Contributor

Choose a reason for hiding this comment

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

there is expandRootIds helper for that. Before it was included in transformer but caused some problems so now you need to call it explicitly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done in a8cacfd

Copy link
Contributor

@smacker smacker left a comment

Choose a reason for hiding this comment

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

the main problem is expanding all nodes. It will kill browser easily on some file like jquery.

Copy link
Contributor

@smacker smacker left a comment

Choose a reason for hiding this comment

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

👍

Signed-off-by: Carlos Martín <carlos.martin.sanchez@gmail.com>
Signed-off-by: Carlos Martín <carlos.martin.sanchez@gmail.com>
Signed-off-by: Carlos Martín <carlos.martin.sanchez@gmail.com>
Signed-off-by: Carlos Martín <carlos.martin.sanchez@gmail.com>
Signed-off-by: Carlos Martín <carlos.martin.sanchez@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants