01 Days 08 Hrs

🥳 Late-Bird Launch Is Coming on Feb 29th!

🥳 Late-Bird Launch Is Coming on Feb 29th!

Revit API Autocomplete in VSCode

Let's finish setting up our Dev Environment for Revit API. Revit API will help you a lot when you code, so it's quite important to add it early on. You can choose between pyCharm or VS Code!

Revit API Autocomplete in VSCode

Let's finish setting up our Dev Environment for Revit API. Revit API will help you a lot when you code, so it's quite important to add it early on. You can choose between pyCharm or VS Code!


Revit API AutoComplete in VS Code

Visual Studio Code is another popular IDE that we could use for Revit API.

I heard from some people that they struggled to make pyCharm Autocomplete work correctly, even though they followed all the steps.

So if you are in the same position you can use VS Code, as it has a simpler way of adding autocomplete for Revit API.

💡 But keep in mind that I will keep using pyCharm for my tutorials, but you can choose any IDE.

Download and Install VS Code

It's very straight-forward. We need to go to VS Code website and download an installer.

💡During installation you can select all these tick boxes.

Once you install it, open VS Code.

👈This is how it looks.

Setup python AutoComplete

VS Code is made for many languages, and so we need to make sure we configure it for python.

To do that:

  • Go to Extensions

  • Search for Python

  • Install python Extension

Once you find and install python extension you might need to restart VS Code for it to work correctly.

Test Python AutoComplete

Create a new python file in VS Code and test AutoComplete. Write something using default libraries and see if you get auto-suggestions and doc string.

For example you can use this code example:

import os
os.path.join() # This should give autosuggestions 

If it works, we are ready to go to the next step.

Download Revit API stubs

Now we need to download Revit API Stubs.

These are files that have information about Revit API Classes, so our IDE can understand what we are doing and help us with suggestions.

Use this link to download them or scroll and use a button on the top.

Once you have your stubs, choose any location on your computer where they will be secure, so you don't accidentally delete them.

I prefer keeping them in %APPDATA% folder, but you can choose anywhere you like!

Setup Revit API + pyRevit Autocomplete

Now we have everything to add Revit API Autocomplete to VS Code.

First of all we need to open settings.json file for python.

  • Go to Extensions

  • Find your installed python Extension

  • Right-Click and select Extension Settings

  • Search for a section 'Python > Auto Complete: Extra Paths'

  • Click on 'Edit in settings.json'

Once you click on Edit in settings.json it will open interpreters settings file.

Use the following code Snippet as a base.
Then go and modify paths!

💡And make sure you have double-slashes '\\'.

Single slashes might not work correctly, because in programming they often have different meaning in strings.

    "window.zoomLevel": 2,
    "python.pythonPath": "C:\\Python27\\python.exe",
    "python.analysis.extraPaths": [
        "C:\\Users\\{USERNAME}\\AppData\\Roaming\\RevitAPI stubs\\RVT 23",

You can add paths to:

  • Revit API Stubs

  • pyRevit lib

  • Your custom library (I will teach you later how to create one)

Once you do that, go and test if Revit API Autocomplete works.
You can try to write this snippet, and see if it helps you along the way.

from Autodesk.Revit.DB import *

collector = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Walls).ToElements()
Bonus: VS Code Web on GitHub

Lastly, let me show you a really interesting feature of VS Code on Web.

IF you go to any GitHub repository, for example my github.com/ErikFrits/EF-Tools
Now, change the URL, instead of .com write .dev and see what happens!


This will open GitHub repository in an online version of VS Code.
And it's so much better to browse through files and code than using regular GitHub website.

You can also make changes and commit them as it has support for that.

However, I haven't found a way to implement Revit API Stubs in an online version. And when you look at python extnsion in online version, it mentions that it has limited support in Web version

But if you know something about it, please let me know.


pyCharm Autocomplete will speed up and help you write Revit API scripts. I highly recommend setting it up before moving to the next lessons.

✅ Download VS Code
✅ Setup Revit API Autocomplete

❓ Ask in Discord if you need help.

⌨️ Happy Coding!


How do I run Revit API code in VS Code?

Should I use pyCharm or VS Code?

Revit API Newsletter

Get short Revit API Tips and Tricks
directly in your email.

Join over 1550 Revit API Enthusiasts