SketchUp / sketchup-ruby-api-tutorials

SketchUp Ruby API Tutorials and Examples
MIT License
214 stars 145 forks source link

in `require': cannot load such file -- extensions.rb (LoadError) #15

Open renchiyuan opened 5 years ago

renchiyuan commented 5 years ago

Need help. I don't know what is wrong. require "extensions.rb" cant find the file. But require "sketchup.rb" is right.

thomthom commented 5 years ago

Are you getting this error from one of the examples? Can you post the full error, including the backtrace?

thomthom commented 5 years ago

What version of SketchUp? What platform? Windows or Mac?

bkvsy commented 5 years ago

I think I have similar issue here. After setting VSCode on win10 according to wiki I'm getting "Required path extensions.rb could not be resolved." from solargraph. I'm using Sketchup 2018

sgerr

thomthom commented 5 years ago

I think I have similar issue here. After setting VSCode on win10 according to wiki I'm getting "Required path extensions.rb could not be resolved." from solargraph. I'm using Sketchup 2018

@bkvsy - what does your .solargraph.yml file look like?

It would need to have a path to the SketchUp Tools directory where this file is located. See example in the VSCode project example we recently created:

https://github.com/SketchUp/sketchup-extension-vscode-project/blob/955260622c15048532b47f1c5f2ca5a36a7e81b7/.solargraph.yml#L2

thomthom commented 5 years ago

Link to the front page of the VSCode example repository: https://github.com/SketchUp/sketchup-extension-vscode-project

thomthom commented 5 years ago

Oh, just noticed the comment that sketchup.rb isn't flagged. If you jump to that file (F12 when you have the caret set to that line) what file does VSCode open?

bkvsy commented 5 years ago

@thomthom my .solargraph.yml was copied from the Wiki

I'm maybe doing something wrong here but pressing F12 in VS in any configuration produces no results.

Surprisingly, when I copied your sketchup-extension-vscode-project repo and changed require_paths in .solargraph.yml to some random path on different drive and added random .rb in 'require' section Solargraph is not reacting.

sgerr2

thomthom commented 5 years ago

Surprisingly, when I copied your sketchup-extension-vscode-project repo and changed require_paths in .solargraph.yml to some random path on different drive and added random .rb in 'require' section Solargraph is not reacting.

Is there any message in the statusbar about Solargraph not starting?

I some times open the VSCode Developer Console to check for hints to errors preventing solargraph from starting. (Help > Toggle Developer Tools)

Do you see any hints there?

Btw, what version of Ruby and the Solargraph gem do you have installed?

bkvsy commented 5 years ago

Ruby version 2.5.3p105 Solargraph 0.31.3

Warnings from dev tools: log

thomthom commented 5 years ago

Hm... that is strange. I don't see any issues there. Could you perhaps zip you a minimal example where the require 'extensions.rb' isn't working and attach it here? Maybe there is some subtle difference in our configs...

bkvsy commented 5 years ago

InitialSkpIDE.zip

thomthom commented 5 years ago

I'm seeing the same thing on my machine. I'll dig into and see if I can figure out what is going on.

thomthom commented 5 years ago

Turns out I've gone through this before - I'd just forgotten.

Currently solargraph expects the require_paths to be relative to the .solargraph.yml file. So the Program Files path doesn't do anything right now.

And in my own projects and the VSCode example (https://github.com/SketchUp/sketchup-extension-vscode-project/blob/master/.solargraph.yml) the require_not_found reporter is excluded from the set of reporters. Only rubocop is enabled.

reporters:
- rubocop
bkvsy commented 5 years ago

Thank you sensei @thomthom Copying references from .../Tools/ to the repository path is working for me

DanRathbun commented 4 years ago

@thomthom So apparently this issue was solved. But (again) I feel this issue was not a "Ruby API Tutorials" issue. This issue should be moved to the Debugger or a new repo on using VSCode or other IDEs.