Skip to content
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

line_for_record returning nil when exporting in ruby project #148

Closed
iamcz opened this issue Dec 14, 2015 · 5 comments
Closed

line_for_record returning nil when exporting in ruby project #148

iamcz opened this issue Dec 14, 2015 · 5 comments
Labels

Comments

@iamcz
Copy link

iamcz commented Dec 14, 2015

I'm trying to use starscope with the ruby project (https://github.com/ruby/ruby) and exporting fails for ctags and cscope. I traced the error back to line_for_record, which seems to be returning nil.

I'm not sure of the root cause of this problem. Perhaps it is because the source code is a mix between Ruby and C. This might not be an issue if starscope is not meant to be used for mixed source projects, although I've tried it on a gem with a C extension and exporting didn't fail.

@eapache eapache added the bug label Dec 14, 2015
@eapache
Copy link
Owner

eapache commented Dec 14, 2015

Mixed language shouldn't be a problem unless some files are getting mis-detected. Which version of starscope are you using?

@iamcz
Copy link
Author

iamcz commented Dec 14, 2015

Version 1.5.1

@eapache
Copy link
Owner

eapache commented Dec 14, 2015

OK, gave this a quick look. I assume you're parsing the trunk of ruby/ruby, in which case you probably saw the following error scroll past while building the initial starscope db:

Starscope::Lang::Ruby raised "undefined method `name' for #<Parser::Source::Map:0x000000017cc288>" while extracting test/csv/test_encodings.rb

Ruby's trunk has made some syntax changes which are causing the parser (https://github.com/whitequark/parser) to fail. Starscope tries to be resilient and just skip the file when that happens, but I guess some bad data is still ending up in the database.

Your best bet is to manually upgrade to the pre-release parser gem (v2.3.0.pre.4) which should support the syntax in ruby's trunk. As far as I can tell once the parser is working Starscope should be able to export again. I'll also look at improving the resiliency here (and maybe better error messages).

@iamcz
Copy link
Author

iamcz commented Dec 14, 2015

I tried installing parser v2.3.0.pre.4 and it looks like there's a dependency error which is forcing me back to starscope version 1.3.1. Tried rebuilding the database but all starscope commands fail with a LoadError coming from backports (from parser). cannot load such file -- parser/ruby22 (LoadError).

@eapache
Copy link
Owner

eapache commented Dec 18, 2015

With the relaxed version requirement, does installing the parser pre-release solve this issue?

@eapache eapache closed this as completed Jan 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants