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

Fix in-memory cache issue and add some nice minor utilities #57

Merged
merged 4 commits into from May 15, 2018

Conversation

Projects
None yet
2 participants
@douglascamata
Copy link
Contributor

douglascamata commented May 14, 2018

With this PR Solargraph does a complete parse of the codebase at its initialization.

I was able to achieve almost instantaneous Go To Definition on different constants after using this feature for the first time.

It also kept working all when I moved definitions from file to file or removed some.

I have no idea why, but I suspect the autoloading was not working well with the cache of the variables in the famous form of:

def my_var
  @my_var ||= ExpensiveCalculation.do_it()
end

This can probably be applied in other places and also improve performance in other areas.

douglascamata added some commits May 14, 2018

Add `rake console` and `rake spec` commands
Running `rake console` will automatically start an IRB session with the
library loaded.

Running `rake spec` will run all the specs in the project.
By default do not process the `.bundle`
It's a common HUGE directoy that we have in big codebases using `bundler` and can slow everything down.
Fix initialization of maps and stores inside Solargraph::ApiMap
It seems like they are not playing nice with autoload.

After this change I was able to achieve close-to-instantenous Go To Definition on a very big Rails project using Solargraph's VSCode extension.
Improve the `rake console` task to use Pry instead of IRB
Pry is a much better Ruby REPL! :D
@@ -13,7 +13,7 @@ class Config
def initialize workspace = nil
@workspace = workspace
include_globs = ['**/*.rb']
exclude_globs = ['spec/**/*', 'test/**/*', 'vendor/**/*']
exclude_globs = ['spec/**/*', 'test/**/*', 'vendor/**/*', '.bundle/**/*']

This comment has been minimized.

@douglascamata

douglascamata May 14, 2018

Contributor

This is a bit of a personal touch. WDYT, @castwide?

This comment has been minimized.

@castwide

castwide May 15, 2018

Owner

Looks good to me. As a general rule, Solargraph should exclude folders that contain gem caches.

@castwide castwide merged commit c85f287 into castwide:master May 15, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment