-
-
Notifications
You must be signed in to change notification settings - Fork 159
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
Is require_paths relative to workspace? #162
Comments
Oooh..... I just realized that I have inadvertently omitting require_paths:
- "C:/Program Files/SketchUp/SketchUp 2018/Tools"
- src
require:
- sketchup-api-stubs/autoload/sketchup.rb
reporters:
- rubocop Aaand... I just realized I've had this discovery before..... castwide/vscode-solargraph#56 (comment) I'm sorry for the noise. |
Btw, would it be to naive to allow for absolute paths in Would you accept a PR that let Solargraph append |
That sounds like a good change, yes. There might need to be an accompanying change in the mapping process that looks for unresolved require paths, but I wouldn't expect it to be too troublesome. |
Has support for absolute paths in |
Not yet, but since you reminded me, I added it to the roadmap. |
I'm trying to help out on a reported issue in a VSCode + Solargraph setup example I've provided:
SketchUp/sketchup-ruby-api-tutorials#15
Given a
.solargraph.yml
like this: (Example project at SketchUp/sketchup-ruby-api-tutorials#15 (comment))And a
src/sample.rb
like this: (Along with a dummysrc/sample/main.rb
)require 'sketchup.rb
is flagged as not resolved:sketchup.rb
is located in theC:/Program Files/SketchUp/SketchUp 2018/Tools
directory.I've used this setup for my own projects, but not seen this issue. For example, this project have similar setup but does not yield the require warning:
https://github.com/thomthom/true-bend
I looked around in the source code for solargraph, and I now I'm wondering how I don't see that in all my projects. There are two things which appear to not make this scenario work:
.rb
is automatically appended to the path when checking if a path can be required:solargraph/lib/solargraph/workspace.rb
Lines 93 to 102 in bf6d147
In my case,
require 'sketchup.rb
includes the file extension for legacy reasons. So it then looks like solargraph looks forsketchup.rb.rb
. Am I reading the code right?require_paths
in.solargraph.yml
is always prefixed with the path of the workspace?solargraph/lib/solargraph/workspace.rb
Lines 174 to 181 in bf6d147
So if I understand the code correctly, solargraph expects
require
statements to omit.rb
andrequire_paths
to be relative to the workspace? If that is correct, then I'm confused to why I don't see the same require warning in my other projects. Any ideas?The text was updated successfully, but these errors were encountered: