Skip to content

2.3 Extension Project

Eric Snow edited this page Jul 29, 2020 · 5 revisions

Directory Structure

<project>
    src/  # will be copied to .build/src-python and included in .vsix
        README
        extension.py
        <data files>
        <other modules & packages>
    tests/
        __init__.py
        __main__.py
        ...
    .templates/  # used to generate `.build`
        ...
    .gitignore  # (ignore the .build directory)
    README
    LICENSE
    setup.cfg  # holds project metadata
    setup.py  # ??? This isn't actually meant to be pip-installed...
    tool.py  # incl. generate, etc. from vscode.extension.project.__main__
    .build/  # autogenerated ("generate" can also target external dir)
        .vscode/
        tests/
        src/
             extension.ts
             ...
        src-python/  # on sys.path
            ...  # copied from project
        lib/  # on sys.path
            vscode/  # a copy of the lib used to init/generate the project
                ...
            <any other vendored Python libs>
        package.json
        ...

Project Commands

tool.py:

  • generate - create the (typescript) extension source tree (in .build or some other target dir)
  • build - compile the generated typescript extension, etc.
  • edit - open the generated extension in VS Code
  • test - run all the tests, including in the generated extension
  • package - generate the .vsix file
  • publish - push the extension to the marketplace