Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Autocompletion doesn't work when require file #147

Closed
jakitliang opened this issue May 5, 2017 · 4 comments
Closed

Autocompletion doesn't work when require file #147

jakitliang opened this issue May 5, 2017 · 4 comments
Labels

Comments

@jakitliang
Copy link

jakitliang commented May 5, 2017

Environment

  • vscode-ruby version: 0.12.1
  • Ruby version: 2.4.0 / 2.3.3
  • VS Code version: 1.12.1
  • Operating System: macOS Sierra 10.12.2
  • Hardware (optional): MacBook Pro 2016 late / Mac Mini

Expected behavior

My project has two file:

  • #my_class.rb
  • test.rb

In my_class.rb, I wrote a simple bare bone MyClass for demo.

In test.rb, I wrote require_relative 'my_class', which can require MyClass.

And I expected that then I'll use this class.

Actual behavior

Code autocompletion behave strange, having no autocompletion but I feel something fall into error.

Steps to reproduce the problem

I open DevTool so that I can see those:

runtime_data_with_class': -:4:in require_relative': cannot infer basepath (LoadError) (Rcodetools::ProcessParticularLine::NewCodeError)
from -:4:in <main>' from /Users/***/.rvm/gems/ruby-2.4.0/gems/rcodetools-0.8.5.0/lib/rcodetools/completion.rb:287:in candidates_with_class'
from /Users//.rvm/gems/ruby-2.4.0/gems/rcodetools-0.8.5.0/lib/rcodetools/completion.rb:295:in candidates' from /Users/***/.rvm/gems/ruby-2.4.0/gems/rcodetools-0.8.5.0/lib/rcodetools/completion.rb:313:in completion_code'
from /Users/
/.rvm/gems/ruby-2.4.0/gems/rcodetools-0.8.5.0/lib/rcodetools/completion.rb:206:in run' from /Users/***/.rvm/gems/ruby-2.4.0/gems/rcodetools-0.8.5.0/bin/rct-complete:45:in <top (required)>'
from /Users//.rvm/gems/ruby-2.4.0/bin/rct-complete:23:in load' from /Users/***/.rvm/gems/ruby-2.4.0/bin/rct-complete:23:in

'
from /Users/
/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in eval' from /Users/***/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in '

qq20170505-163649

qq20170505-163714

@rebornix rebornix added the bug Bug reports label Aug 13, 2017
@Kanatatsuki
Copy link

same problem here,
and the bug seems to be:

/Users/XXXXXX/.rvm/gems/ruby-2.4.1/gems/rcodetools-0.8.5.0/lib/rcodetools/completion.rb:166:in runtime_data_with_class': -:10: syntax error, unexpected ')' (Rcodetools::ProcessParticularLine::NewCodeError) | x.to_s}.grep(/^\[1,2,3\]/e/);_xmp_1502777639_54194_535858_ ^ from /Users/XXXXXX/.rvm/gems/ruby-2.4.1/gems/rcodetools-0.8.5.0/lib/rcodetools/completion.rb:287:in candidates_with_class'
from /Users/XXXXXX/.rvm/gems/ruby-2.4.1/gems/rcodetools-0.8.5.0/lib/rcodetools/completion.rb:295:in candidates' from /Users/XXXXXX/.rvm/gems/ruby-2.4.1/gems/rcodetools-0.8.5.0/lib/rcodetools/completion.rb:313:in completion_code'
from /Users/XXXXXX/.rvm/gems/ruby-2.4.1/gems/rcodetools-0.8.5.0/lib/rcodetools/completion.rb:206:in run' from /Users/XXXXXX/.rvm/gems/ruby-2.4.1/gems/rcodetools-0.8.5.0/bin/rct-complete:45:in <top (required)>'
from /Users/XXXXXX/.rvm/gems/ruby-2.4.1/bin/rct-complete:23:in load' from /Users/XXXXXX/.rvm/gems/ruby-2.4.1/bin/rct-complete:23:in

'
from /Users/XXXXXX/.rvm/gems/ruby-2.4.1/bin/ruby_executable_hooks:15:in eval' from /Users/XXXXXX/.rvm/gems/ruby-2.4.1/bin/ruby_executable_hooks:15:in '

@jeffbax
Copy link

jeffbax commented Sep 11, 2017

Yup, that is what I see as well

Using

  • macOS 10.12.6
  • vscode 1.13.1
  • vscode-ruby 0.14.0
  • ruby 2.4
  • rct-complete 0.8.5
  • ruby-debug-ide-0.6.0
  • debase-0.2.2.beta10

With fully qualified the path to the rbenv shim rct-complete and configured the ruby.locate user settings.

One of the other things I ran into getting to this other error point was surprise that the extensions didn't seem to respect the local rbenv -- and it was always defaulting to global (and one couldn't make it a workspace setting to point to a different one, it had to be a user setting)

I'm pretty new to Ruby for work, so trying a bunch of things to get to where I was with VSCode + Python... but a lot to learn yet in regards to trying to help fix this I think.

@castwide
Copy link
Contributor

castwide commented Feb 1, 2018

#248 should resolve this issue.

@wingrunr21
Copy link
Collaborator

Closing for issue cleanup. Apologies if this is still an issue. We are working to improve the core extension experience.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants