Eleventy - Get autocompletion and doc info in your eleventy config in VS Code
In VS Code, you don’t get autocompletion in your eleventy config. You don’t get doc info about functions when you hover over them.
Let’s change this!
Add autocompletion and hover information
We need to add a JSDoc annotation to tell VS Code where the definition of the config
parameter is. It is defined in UserConfig.js
. If you add the following, it will import whatever JSDoc info is available in UserConfig.js
from the @11ty/eleventy
package.
Now, you get autocompletion!
And doc info when you hover over functions!
Some functions in UserConfig.js
are missing JSDoc info, therefore you will not see info for all functions. I looked at the issues on the eleventy repo and saw that were some efforts to add more JSDoc annotations to the codebase in the past, but it has fallen by the wayside. That’s the hustle of a big project I guess!
Anyway, this should save you some round trips to the https://www.11ty.dev/docs!