VS Code not showing API Stubs

I got a new computer and got VSCode set up. I followed the directions here but for some reason I’m unable to get the stubs to be recognized.

Any idea what to try? @thomthom


Just running yard shows this.

OK I tried all the same stuff again (about 6 times actually) and now it is suddenly working. It remains a mystery.

UPDATE: I think the fix was adding my gems path to the .solargraph.yml

- "C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems"

Your output shows that you were in the “Building Creator” repo.

To generate yard docs from the SketchUp API you need to be in it’s repo as it’s .yardopts file would have paths relative to this file. (Ie, running yard with no command line args will make it look for a .yardopts file to get it’s arguments.)

Well yard would need the SketchUp API documentation YARD template plugin which can be installed as a Ruby gem. The default .yardopts file for the stubs repo assumes this gem plugin is installed.

I ran all four commands listed in the instructions. Would that have installed the plugin?

gem install yard
gem install solargraph
gem install sketchup-api-stubs
yard gems sketchup-api-stubs

BTW, the command to generate YARD docs is yardoc not yard

No. The instructions are here:

1 Like

This didn’t work for you? When I saw the title I thought it was because YARD hadn’t indexed the stubs gem yet. yard gems sketchup-api-stub should have taken care of that.

Hm… I’ve never had to do that. The only times I’ve had issues is when I used Bundler to install the stubs, because then the hook that kicks of YARD indexing doesn’t trigger.

How did you setup Solargraph? Can we see the .solargraph.yml and any VSCode settings related to Solargraph.

yardooc is just short for yard doc

Yea, when using the API stubs you only need to install the gem and ensure YARD index it. No need to pull the repo and build them yourself.

From the gems folder? C:\Ruby26-x64\lib\ruby\gems\2.6.0\gems


# To allow solargraph to resolve the require paths correctly, add the path
# to the Tools directory of one of your SketchUp installations.
# You also want to add the path to where you have the extension's sources.
# (In this example it would be in a `src` directory relative to .solargraph.yml)
- "C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems"
- "C:/Program Files/SketchUp/SketchUp 2018/Tools"
- "RBScripts/Building_Creator/lib"

# This will load the stubs for the SketchUp API.
- sketchup-api-stubs

# Exclude files that doesn't need to be parsed. Avoids noise and improve performance.
- /build/**/*
- "**/staging/**/*"
- /ThirdParty/**/*

- "**/*.rb"

- rubocop


    "solargraph.diagnostics": true,
    "solargraph.autoformat": true,
    "editor.formatOnPaste": true

That command didn’t seem to do anything. (no output)

I see you did a gem install, and that did trigger yard to parse the docs. (It’s when you use Bundler that this doesn’t happen.)

Did you get the stubs to work in VSCode in the end? Or is it still an issue?

This seems to be working although I don’t know if it’s ‘right’.


That looks to be working as expected. It’s picked up on the fact that cmd is a UI::Command and providing the documentation for #menu_text.